Commit Graph

196 Commits

Author SHA1 Message Date
Stefan Prodan 98bc9777f6
Update dependencies to Go 1.22 and Kubernetes 1.29.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-03-27 16:13:20 +02:00
Stefan Prodan f812f045c6
Set module name to `github.com/fluxcd/cli-utils`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 08:45:35 +02:00
Simon Bein b2051cfe5a
update dependencies to k8s.io v0.27.2 2023-08-09 12:47:05 +10:00
Ramon Quitales c494d01128 refactor: Fix linting issues found in golangci-lint v1.50.0 2022-11-01 22:21:31 +00:00
Johnnie Chou ad9f752d67 add filtering and listing functionalities 2022-08-22 04:47:03 +00:00
Johnnie Chou 729997bee5 add Loader interface for easier customized implementation 2022-08-18 16:30:58 +00:00
Johnnie Chou 0dabf06e2c add json printer to support the json output format 2022-08-11 19:52:30 +00:00
Johnnie Chou 854aed09b9 add inventory_name column to include this information in table output format 2022-08-09 15:27:53 +00:00
Johnnie Chou 99d35d57cd add struct PrintData to add inventory name and namespace info in printed text and modify test cases to current expected output 2022-08-08 21:57:26 +00:00
Morten Torkildsen 5240fc4cdb Use builder for creating the destroyer 2022-08-03 12:19:19 +00:00
Gautier Delorme 38ab8f92b6 do not panic when the inventory object is missing
Signed-off-by: Gautier Delorme <gautier.delorme@gmail.com>
2022-07-26 18:51:46 +02:00
Kubernetes Prow Robot 2d682225d8
Merge pull request #577 from mengqiy/depbump
chore: update k8s libs to 1.24
2022-05-12 16:07:47 -07:00
Mengqi Yu ddc352f366 bump to k8s 1.24 2022-05-11 18:07:45 -07:00
Karl Isenberg c46949360e feat: replace StatusPoller w/ StatusWatcher
- Add DefaultStatusWatcher that wraps DynamicClient and manages
  informers for a set of resource objects.
  - Supports two modes: root-scoped & namespace-scoped.
  - Root-scoped mode uses root-scoped informers to efficiency and
    performance.
  - Namespace-scoped mode uses namespace-scoped informers to
    minimize the permissions needed to run and the size of the
    in-memory object cache.
  - Automatic mode selects which mode to use based on whether the
    objects being watched are in one or multiple namespaces.
    This is the default mode, optimizing for performance.
  - If CRDs are being watched, the creation/deletion of CRDs can
    cause informers for those custom resources to be created/deleted.
  - In namespace-scope mode, if namespaces are being watched, the
    creation/deletion of namespaces can also trigger informers to
    be created/deleted.
  - All creates/updates/deletes to CRDs also cause RESTMapper reset.
  - Allow pods to be unschedulable for 15s before reporting the
    status as Failed. Any update resets the timer.
- Add BlindStatusWatcher for testing and disabling for dry-run.
- Add DynamicClusterReader that wraps DynamicClient.
  This is now used to look up generated resources
  (ex: Deployment > ReplicaSets > Pods).
- Add DefaultStatusReader which uses a DelegatingStatusReader to
  wrap a list of conventional and specific StatusReaders.
  This should make it easier to extend the list of StatusReaders.
- Move some pending WaitEvents to be optional in tests, now that
  StatusWatcher can resolve their status before the WaitTask starts.
- Add a new Thousand Deployments stress test (10x kind nodes)
- Add some new logs for easier debugging
- Add internal SyncEvent so that apply/delete tasks don't start
  until the StatusWatcher has finished initial synchronization.
  This helps avoid missing events from actions that happen while
  synchronization is incomplete.
- Filter optional pending WaitEvents when testing.

BREAKING CHANGE: Replace StatusPoller w/ StatusWatcher
BREAKING CHANGE: Remove PollInterval (obsolete with watcher)
2022-05-10 10:40:05 -07:00
Karl Isenberg 534438cb62 feat: Use server-side throttling, if enabled 2022-04-27 09:58:48 -07:00
Jingfang Liu ebbd19deca fix: Use empty object status list when the StatusPolicyNone is used
This reduces the request size when StatusPolicyNone is used
2022-03-07 16:36:36 -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 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 26b16473c7 chore: reduce stuttering in cmd pkg 2022-02-15 14:30:10 -08:00
Morten Torkildsen 5986969dc0 Expose ClusterReader options in the API 2022-02-01 11:37:49 -08:00
Mikhail Mazurskiy 2c815d2843
feat!: applier configuration options
BREAKING CHANGE: NewApplierBuilder() is the new way to construct an Applier
BREAKING CHANGE: apply.Options renamed into apply.ApplierOptions
2022-01-29 10:04:03 +11:00
Kubernetes Prow Robot d45357db63
Merge pull request #517 from ash2k/ash2k/reset-mapper
fix: remove reflection hack
2022-01-24 13:47:14 -08:00
Mikhail Mazurskiy 0af069f2c5
chore!: remove RESTMapper caching as it's no longer needed
It's cached upstream now https://github.com/kubernetes/kubernetes/pull/103900

BREAKING CHANGE: CachingRESTClientGetter is removed
2022-01-24 15:11:52 +11:00
Morten Torkildsen 2fa891e701 fix: Remove support for multiple inventory objects with the same inventory id 2022-01-22 16:28:10 -08:00
Mikhail Mazurskiy 324950da0c
chore!: update dependencies to Kubernetes v1.23.2
BREAKING CHANGE: this might break library consumers
2022-01-21 12:54:03 +11:00
Morten Torkildsen 1b68c32813 fix: Remove preview/dry-run type from events output 2022-01-07 14:55:21 -08:00
Morten Torkildsen f33a0cdb32 Remove StatusPoller factory and support custom status readers 2021-12-16 19:38:10 +01:00
Morten Torkildsen 9caaf2a225 Validate the value of the output flag 2021-12-09 19:35:19 +01:00
Karl Isenberg 9607cb5cf1 feat: Add apply/destroy --status-events flag
- Status events disabled by default
- Status events always enabled for table output
2021-11-04 13:14:46 -07:00
Karl Isenberg a24aaea775 feat: send WaitEvent for every resource
- WaitEvent can be Pending, Reconciled, Skipped, or Timeout.
  Skipped, Pending, and Reconciled events are sent at task start.
  Reconciled events are sent later as status updates are recieved.
  Timeout events are sent for remaining events on timeout.
- Rewrite WaitTask.Start to use context.WithTimeout and a goroutine to
  handle task completion (replacing setTimer and the token hack).
- Replaced Task.ClearTimeout with Task.Cancel.
- Replaced WaitTask.complete & checkCondition with Task.StatusUpdate.
- Replaced WaitTask.startAndComplete with a check in WaitTask.Start.
- Replaced WaitTask.amendTimeoutError with WaitTask.sendTimeoutEvents
  to send multiple timeout events, instead of one event with a list of
  TimedOutResources.
- Updated all printers to handle WaitEvent.
  Event printer now includes reconcile events.
  JSON printer now includes resourceReconciled eventType.
  Table printer not includes reconcile column.
- Added JSON printer tests for error handling.
- Updated Formatter.FormatActionGroupEvent to collect WaitStats.
- Enable status events by default for kapply with table output

BREAKING CHANGE: WaitEvents now sent for each object
2021-11-04 10:57:35 -07:00
Sean Sullivan 944b7a7d63 Exports Applier StatusPoller field 2021-11-02 11:53:52 -07:00
Sean Sullivan 1034bbe898 Removed unused command PreProcess function 2021-11-01 18:21:11 -07:00
Kubernetes Prow Robot b66eaeee95
Merge pull request #457 from seans3/inv-info-wrapper
Removes inventory from manifestloader
2021-10-30 04:25:17 -07:00
Sean Sullivan 0419797013 Moves printers from cmd to pkg 2021-10-29 12:22:49 -07:00
Sean Sullivan 0ac281cdd4 Removes inventory from manifestloader 2021-10-29 08:55:31 -07:00
Karl Isenberg ee6c5a7fe4 Return error & send error event on cancel/timeout 2021-10-19 11:07:14 -07:00
Karl Isenberg 066fd77de9 Add timeout flag to apply, destroy, & status cmds 2021-10-15 17:42:05 -07:00
Karl Isenberg 31679a650f Add global destroyer timeout
- Destroyer context added, with cancel test.
- Fix Applier cancel test not using specified timeouts.
- Added a few logs to help with debugging test failures
2021-10-12 17:41:57 -07:00
Karl Isenberg d83ce93efd Add ObjMetadataSet to encapsulate set functions
- Refactor usages of []ObjMetadata to use ObjMetadataSet
- Move Union, Diff, Contains, Hash, Remove, and Equal into
  ObjMetadataSet
- Add ToStringMap and FromStringMap for inventory serialization
2021-10-06 14:25:12 -07:00
Haiyan Meng cb132d9e84 Add a new flag value `force-adopt` to the `--inventory-policy` flag
`force-adopt` allows the current inventory take ownership of any objects.
2021-09-23 11:31:47 -07:00
Mikhail Mazurskiy 4b8dd62c53
Remove strings.TrimSpace()
Names and labels cannot have any whitespace. If they do, it's an error that should be reported and fixed.
2021-08-08 11:29:43 +10:00
Kubernetes Prow Robot 8ccd6e63e1
Merge pull request #387 from mortent/RemoveDryRunState
Avoid dryRun as state in inventory client
2021-07-14 18:22:47 -07:00
Kubernetes Prow Robot 8282940571
Merge pull request #384 from mortent/StatusPrinterReturnsError
Printers for status returns error
2021-07-14 17:58:47 -07:00
Morten Torkildsen dacbf97143 Avoid dryRun as state in inventory client 2021-07-14 17:34:18 -07:00
Mikhail Mazurskiy 6a39e5abec
Drop gotest.tools dependency 2021-07-10 12:21:40 +10:00
Morten Torkildsen 357575cc76 Printers for status returns error 2021-07-06 11:05:04 -07:00
Kubernetes Prow Robot d0a5567588
Merge pull request #379 from seans3/apply-prune-sort
Adds object sorting for apply, prune, and delete
2021-07-02 10:04:13 -07:00
Mikhail Mazurskiy 275f2c27e0
Drop github.com/go-errors/errors dependency 2021-07-02 10:53:03 +10:00