Commit Graph

973 Commits

Author SHA1 Message Date
Jingfang Liu 6bd4b565e8 Capture the apply status for individual resources after each apply.
If the inventory object supports status field, it is updated
after setting the inventory list at then of one apply process.

BREAKING CHANGE: Update the inventory client and inventory interfaces
to pass the apply/reconcile status.
2022-02-16 12:02:02 -08:00
Kubernetes Prow Robot b450b79991
Merge pull request #547 from rohitagarwal003/context
Don't store Context inside a struct, pass it explicitly to each function that needs it.
2022-02-16 07:52:38 -08:00
Rohit Agarwal 9a50bc7031 Don't store Context inside a struct, pass it explicitly to each function that needs it.
This is from the context package documentation: https://pkg.go.dev/context

Tested by running `go test ./...` inside `pkg/kstatus`.
2022-02-16 01:03:20 -08:00
Kubernetes Prow Robot f155aaf7fd
Merge pull request #538 from karlkfi/karl-lint-upgrade
chore: Upgrade golint, replace deprecated linters, and fix new lint errors
2022-02-15 22:10:36 -08:00
Karl Isenberg 69c2289534 chore: Disable stutter linter on actuation enums 2022-02-15 15:28:54 -08:00
Karl Isenberg 4b30ea4e83 chore: Rename fake.FakeStatusReader to fake.StatusReader 2022-02-15 15:22:42 -08:00
Karl Isenberg f265615342 chore: Rename fake.FakeClusterReader to fake.ClusterReader 2022-02-15 15:17:19 -08:00
Karl Isenberg 94c0b1c6f0 chore: export TaskStatusRunner - used externally 2022-02-15 14:50:34 -08:00
Karl Isenberg 5d235016f5 chore: unexport table printer internal types 2022-02-15 14:50:34 -08:00
Karl Isenberg 026b9cc5f8 chore: return exposed types from error matchers 2022-02-15 14:50:34 -08:00
Karl Isenberg eb749e933c chore: allow stuttering for PruneEventFactory 2022-02-15 14:50:34 -08:00
Karl Isenberg 8dfc33dd8e chore: rename printers to avoid stuttering 2022-02-15 14:50:34 -08:00
Karl Isenberg 280f3e2c8f chore: export table & event printer for extension 2022-02-15 14:50:34 -08:00
Karl Isenberg 6ce2c31c3e chore: export manifestreader.FakeLoader for tests 2022-02-15 14:50:34 -08:00
Karl Isenberg 4e94795493 chore: refactor inventory pkg to avoid stuttering 2022-02-15 14:48:39 -08:00
Karl Isenberg e2f4d4cada chore: rename event.EventType to reduce stuttering
BREAKING CHANGE: renamed Event.EventType to Event.Type
2022-02-15 14:33:52 -08:00
Karl Isenberg 7f561ae8b8 chore: result stuttering in info pkg 2022-02-15 14:30:10 -08:00
Karl Isenberg 26b16473c7 chore: reduce stuttering in cmd pkg 2022-02-15 14:30:10 -08:00
Karl Isenberg 3843c7e122 chore: replace += 1 with ++ 2022-02-15 14:30:09 -08:00
Karl Isenberg 57b5483e5b chore: Upgrade linter and replace deprecated pkgs 2022-02-15 14:30:09 -08:00
Kubernetes Prow Robot 8575b8be6e
Merge pull request #546 from karlkfi/karl-inventory-discovery
fix: Always copy ResourceVersion before update
2022-02-15 13:53:18 -08:00
Kubernetes Prow Robot 0680d3cb90
Merge pull request #542 from karlkfi/karl-actuation-api
chore: Move Inventory object to pkg/apis/actuation
2022-02-15 13:17:19 -08:00
Karl Isenberg 8bc791b048 fix: Always copy ResourceVersion before update
- Fix FakeDynamicClient to return an object from deletes
- Fix FakeDynamicClient to return DeepCopy to avoid mutation
- Fix InventoryClient to return a DeepCopy of the input when
  dry-run is enabled.
2022-02-15 13:05:38 -08:00
Kubernetes Prow Robot 1df6b210c2
Merge pull request #544 from karlkfi/karl-yaml-log7
chore: Log YAML to V7, instead of V4
2022-02-15 11:48:40 -08:00
Kubernetes Prow Robot 69f42a927d
Merge pull request #543 from karlkfi/karl-unsort
chore: Remove redundant object sorting
2022-02-15 11:14:39 -08:00
Kubernetes Prow Robot 397e503fbb
Merge pull request #540 from Liujingfang1/update-status
Use discovery client to check if inventory objects has subresource status
2022-02-15 10:17:12 -08:00
Kubernetes Prow Robot 3d6b4a718c
Merge pull request #541 from karlkfi/karl-filter-adoptall
chore: Move AdoptAll logic out of the Applier
2022-02-15 09:18:02 -08:00
Jingfang Liu 774f24b5e0 Use discovery client to check if inventory objects has subresource
status

Use the function `DiscoveryClient.ServerResourcesForGroupVersion`
to list all the resources in a group. Then check if the subresource
status is contained in the list.
2022-02-15 09:15:29 -08:00
Karl Isenberg 64fd95ebe7 chore: Log YAML to V7, instead of V4
- Rename "resource" to "object" in mutation code.
  Resource is a REST interface. Object is an instance of a Resource.
2022-02-14 23:03:21 -08:00
Karl Isenberg c1f572dc4c chore: Remove redundant object sorting
- The Solver Graph performs sorting.
  So the applier & destroyer don't need to.
2022-02-14 22:48:45 -08:00
Karl Isenberg bb84f24cb0 chore: Move Inventory object to pkg/apis/actuation
- Replace custom TypeMeta & ObjectMeta with standard metav1 structs
  to allow Inventory to satisfy the metav1.Object, runtime.Object,
  and client.Object interfaces. This should make the Inventory API
  easier to use and easily convertable to an Unstructured object.

BREAKING CHANGE: Move inventory.Inventory to actuation.Inventory (under pkg/apis/)
2022-02-14 22:44:50 -08:00
Karl Isenberg fca07d568c chore: Move AdoptAll logic out of the Applier 2022-02-14 21:39:26 -08:00
Kubernetes Prow Robot 2b7c073a37
Merge pull request #539 from karlkfi/karl-delete-uid
fix: Handle async object replacement
2022-02-10 14:17:09 -08:00
Kubernetes Prow Robot 8c08dd465a
Merge pull request #532 from Liujingfang1/update-status
add updateStatus function when applying the inventory object
2022-02-10 13:57:09 -08:00
Jingfang Liu d89ec46f46 add updateStatus function when applying the inventory object
This change splits part of the change from
https://github.com/kubernetes-sigs/cli-utils/pull/530.
2022-02-10 13:11:25 -08:00
Karl Isenberg 412341fa6f fix: Handle async object replacement
Fixes: https://github.com/kubernetes-sigs/cli-utils/issues/527
2022-02-10 12:50:14 -08:00
Kubernetes Prow Robot 872c4ee241
Merge pull request #533 from mortent/HandleContextCancelInKstatus
Avoid reporting context cancellation or deadline expiration as resource error
2022-02-09 14:09:49 -08:00
Morten Torkildsen 3f86e78b7a Avoid reporting context cancellation or deadline expiration as resource error 2022-02-09 11:02:56 -08:00
Kubernetes Prow Robot 3f2bc6abd1
Merge pull request #531 from karlkfi/karl-taskcontext-status
chore: Add Inventory to TaskContext
2022-02-03 12:10:58 -08:00
Karl Isenberg 5c095e8d66 chore: Add Inventory to TaskContext
- Add a new Inventory KRM object for storing the spec and status
  of the inventory objects in memory.
- Improve reconcile, apply, & delete status tracking in the
  TaskContext/Inventory to cover all possible statuses
- Move most of the convenience methods from the TaskContext into a
  new inventory.Manager.
- Fix a minor bug where object UID might have drifted (delete &
  recreate) between GET and DELETE.
2022-02-03 11:16:54 -08:00
Kubernetes Prow Robot 9091c48d25
Merge pull request #519 from mortent/ExposeClusterReaderOptions
Expose ClusterReader options in the API
2022-02-02 14:42:06 -08:00
Kubernetes Prow Robot 78a3dd55e8
Merge pull request #525 from Liujingfang1/revert
Revert "capture the apply/reconcile status in the inventory object"
2022-02-02 13:36:04 -08:00
Jingfang Liu 6e3bb7a9ad Revert "capture the apply/reconcile status in the inventory object"
This reverts commit edee25bd85.
2022-02-02 13:03:19 -08:00
Kubernetes Prow Robot add074116d
Merge pull request #514 from Liujingfang1/master
capture the apply status in the inventory object
2022-02-02 10:14:22 -08:00
Jingfang Liu edee25bd85 capture the apply/reconcile status in the inventory object
Capture the apply status for individual resources after each apply.
If the inventory object supports status field, it is updated
after setting the inventory list at then of one apply process.

BREAKING CHANGE: Update the inventory client and inventory interfaces
to pass the apply/reconcile status.
2022-02-02 09:54:59 -08:00
Kubernetes Prow Robot a5b5c83f8d
Merge pull request #524 from seans3/readme-update
Update README with basic library documentation
2022-02-02 02:54:21 -08:00
Sean Sullivan a361072343 Update README with basic documentation 2022-02-01 22:32:53 -08:00
Kubernetes Prow Robot 6f71842085
Merge pull request #521 from seans3/lint-fix
Fixes lint error
2022-02-01 15:18:52 -08:00
Sean Sullivan aac7d2d22a Fixes lint error 2022-02-01 14:22:07 -08:00
Morten Torkildsen 5986969dc0 Expose ClusterReader options in the API 2022-02-01 11:37:49 -08:00