Commit Graph

11 Commits

Author SHA1 Message Date
Karl Isenberg 9acdbce963 feat: Add ValidationPolicy & ValidationEvent
- Add ValidationPolicy:
  ExitEarly (default) - exit before apply/prune if any objects are invalid
  SkipInvalid - apply/prune valid objects & skip invalid ones
- Add ValidationEvent to be sent once for every invalid object or set of
  objects, when the SkipInvalid policy is selected. For ExitEarly,
  return an error for reverse compatibility.
- Add validation.Collector to simplify aggregating validation errors
  from multiple sources and extracting invalid object IDs.
- Add invalid objects to the TestContext so they can be retained in
  the inventory (only if already present). This primarily applies to
  invalid annotations and dependencies. Objects without name or kind
  should never be added to the inventory.
- Update Solver to use validation.Collector and filter invalid objects.
- Add e2e test for invalid objects.
- Update Printers to handle ValidationEvent
- Add ExternalDependencyError & InvalidAnnotationError to make it easier
  to handle and introspect validation errors.
2022-01-25 12:36:02 -08:00
Morten Torkildsen 66c63637b4 feat: Return a specific error type from the printers when resources fail to apply/delete/reconcile 2022-01-10 14:00:02 -08:00
Morten Torkildsen 6c2de94a5d Support ReconcileFailed status in printers 2021-12-07 15:12:52 +01: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 d2f83f464a Changes Print interface to add PrintStatus boolean 2021-07-01 17:36:25 -07:00
Mikhail Mazurskiy d3584991b4
More reusable BaseListPrinter
Make BaseListPrinter more reusable by hiding IO streams from it. Formatter owns the output, so it can fully encapsulate it. That way a formatter can print to e.g. a logger, not to a raw stream and that would not require ignoring the passed IO streams.
2021-05-20 09:41:23 +10:00
Morten Torkildsen ae80e561e2 Improve the event hierarchy 2021-05-18 14:58:41 -07:00
Morten Torkildsen 48cd555569 Fix printing with continue-on-error 2021-02-18 17:27:51 -08:00
Jingfang Liu 06cf56ef9e update printer for events 2020-12-08 11:50:41 -08:00
Morten Torkildsen b379899088 Clean up the event hierarchy 2020-10-15 16:10:48 -07:00
Morten Torkildsen b6a28607b7 Support json printer for apply 2020-09-08 14:45:00 -07:00