Commit Graph

69 Commits

Author SHA1 Message Date
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
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 4e94795493 chore: refactor inventory pkg to avoid stuttering 2022-02-15 14:48:39 -08:00
Karl Isenberg 26b16473c7 chore: reduce stuttering in cmd pkg 2022-02-15 14:30:10 -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
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
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
Sean Sullivan d2f83f464a Changes Print interface to add PrintStatus boolean 2021-07-01 17:36:25 -07:00
Mikhail Mazurskiy c1c7c9ef9c
Remove Provider interface 2021-06-30 15:21:03 +10:00
Mikhail Mazurskiy 8dc334f344
Remove Applier.Initialize() 2021-06-16 08:53:30 +10:00
Sean Sullivan af417c6fab Refactor destroyer to use tasks 2021-06-09 15:40:32 -07:00
Phani Teja Marupaka 6c0f7261e8 Decouple manifest reader from cli 2021-04-05 14:06:04 -07:00
Jingfang Liu 4efc889f59 move inventory-policy flags and values to package level constants 2021-01-27 11:08:48 -08:00
Jingfang Liu 4e1ecc74ba Add preprocess function for apply/preview/destroy commands 2021-01-21 13:36:55 -08:00
Jingfang Liu 048e8867d6 add apply/preview/destroy flag: inventory-policy 2021-01-20 15:03:35 -08:00
Kubernetes Prow Robot b9ff655ee7
Merge pull request #296 from phanimarupaka/RemoveRequiredCheckersCheck
Remove required setters check
2020-12-14 10:23:28 -08:00
Phani Teja Marupaka 10b77d7451 Remove required setters check 2020-12-14 17:56:37 +05:30
Jingfang Liu 5184286403 enable InventoryPolicy in applier 2020-12-08 13:22:08 -08:00
jregan ea8ac6b0f3 Pin to kyaml v0.10.3 2020-12-07 15:50:39 -08:00
Jingfang Liu 3224d5f259 splti the provider interface 2020-11-16 08:30:49 -08:00
Jingfang Liu cb0443cccc add InventoryInfo() function to the provider interface 2020-11-11 15:07:49 -08:00
Jingfang Liu 7915dc5de7 change the apply API to InventoryInfo 2020-11-11 15:07:46 -08:00
Jingfang Liu 4983152e59 split inventory and resources in the apply interface 2020-11-04 15:00:52 -08:00
Morten Torkildsen 3ac57786f6 Update the ManifestReader interface and implementations to use Unstructured 2020-10-26 12:13:44 -07:00
Sean Sullivan 99285377ba Implements server-side apply 2020-10-23 22:55:06 -07:00
Morten Torkildsen 507d11f31e Use Unstructured instead of Info 2020-10-20 15:38:13 -07:00
Sean Sullivan 42c7f06068 Simplifies NewProvider removing an unnecessary param 2020-10-16 02:40:08 -07:00
Morten Torkildsen c0031a934a Remove IOStreams from the Applier 2020-10-15 17:07:11 -07:00
Morten Torkildsen a6c5f50abc Move ApplyOptions into ApplyTask 2020-10-14 17:33:49 -07:00
Sean Sullivan d805e95bf6 Provider can now return error for ManifestReader creation 2020-09-25 10:49:42 -07:00
Sean Sullivan 62bb7972ad Move ManifestReader creation into Provider 2020-09-22 10:36:53 -07:00
Morten Torkildsen e43565ef80 Handle the --namespace flag 2020-09-03 19:39:15 -07:00
Sean Sullivan 06594c1bca New factory wraps kubectl factory and inventory client 2020-08-31 11:49:18 -07:00
Morten Torkildsen 9135af4218 Improve error handling 2020-08-16 20:10:17 -07:00
Phani Teja Marupaka 73e5d60407 Server side preview 2020-08-04 18:01:46 -07:00
Phani Teja Marupaka d4dbb597c0 Fail Apply/Preview for Required Setters 2020-07-06 17:04:24 -07:00
Kubernetes Prow Robot f18d7c260f
Merge pull request #181 from mortent/ManifestReader
Separate reading manifests into Info objects from the apply logic
2020-06-09 01:17:19 -07:00
Morten Torkildsen 2381432e70 Separate reading manifests into Info objects from the apply logic 2020-06-08 16:59:03 -07:00
Sean R. Sullivan 322135f7e9 Expors cobra command 2020-06-08 15:00:32 -07:00
Sean R. Sullivan 86d4dd3efc Export Applier within the ApplyRunner 2020-06-05 13:41:54 -07:00
Morten Torkildsen 0058932245 Reduce the number of flags for apply and improve the naming 2020-05-20 09:27:29 -07:00