Commit Graph

1133 Commits

Author SHA1 Message Date
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
Karl Isenberg 4831b66130
Merge pull request #572 from karlkfi/karl-status-watcher
feat: replace StatusPoller w/ StatusWatcher
2022-05-12 15:47:05 -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
Kubernetes Prow Robot 02d2092d8c
Merge pull request #581 from karlkfi/karl-event-order
fix: Sort reconcile events to fix flakey test
2022-05-03 14:53:11 -07:00
Kubernetes Prow Robot 59160ba204
Merge pull request #584 from karlkfi/karl-throttle-check
feat: Use server-side throttling, if enabled
2022-04-27 10:18:11 -07:00
Karl Isenberg 534438cb62 feat: Use server-side throttling, if enabled 2022-04-27 09:58:48 -07:00
Karl Isenberg 59a8300851 fix: Sort reconcile events to fix flakey test 2022-04-25 13:57:35 -07:00
Kubernetes Prow Robot 2ae0f05b40
Merge pull request #582 from karlkfi/karl-fix-flaky-applier-test
fix: Avoid race condition in applier test
2022-04-22 14:39:36 -07:00
Kubernetes Prow Robot 1fead05e8c
Merge pull request #583 from karlkfi/karl-ginkgo-v2
chore: Upgrade to Ginkgo v2
2022-04-22 10:56:12 -07:00
Karl Isenberg db1ae2bbd1 fix: Avoid race condition in applier test 2022-04-22 10:14:48 -07:00
Karl Isenberg f9563d9e37 chore: Upgrade to Ginkgo v2 2022-04-21 18:50:30 -07:00
Kubernetes Prow Robot 1d43cea19f
Merge pull request #576 from karlkfi/karl-throttling
chore: Disable client-side throttling for tests
2022-04-21 13:58:12 -07:00
Kubernetes Prow Robot 3657f0c72d
Merge pull request #580 from karlkfi/karl-phony
chore: Add PHONY to Makefile targets
2022-04-21 13:38:12 -07:00
Karl Isenberg 4a1dce44bc chore: Add PHONY to Makefile targets
- Update dependency binaries to latest versions
2022-04-20 17:55:24 -07:00
Kubernetes Prow Robot 2bfa520569
Merge pull request #579 from karlkfi/karl-error-status
fix: Send Failed status when erroring
2022-04-20 09:37:42 -07:00
Kubernetes Prow Robot bd37c6facc
Merge pull request #578 from karlkfi/karl-coe-error
chore: Test for more specific errors
2022-04-20 09:13:42 -07:00
Karl Isenberg 119b51aabf fix: Send Failed status when erroring
- Caller should switch on Type == Failed, not Error != nil
- Error should always be non-nil for Failed and Skipped events
2022-04-19 18:22:52 -07:00
Karl Isenberg 4c53ada4bc chore: Test for more specific errors 2022-04-19 18:08:24 -07:00
Kubernetes Prow Robot 825458e8db
Merge pull request #575 from karlkfi/karl-event-logs
chore: Log events at -v=3 for e2e tests
2022-04-15 17:09:10 -07:00
Karl Isenberg 5fb2a68abb chore: Disable client-side throttling for tests 2022-04-15 16:36:22 -07:00
Kubernetes Prow Robot d6e0b72676
Merge pull request #574 from karlkfi/karl-event-sorting
chore: Fix event sorting for testing
2022-04-15 16:29:10 -07:00
Karl Isenberg 0cb52c61ce chore: Log events at -v=3 for e2e tests
- Events are critical to understanding progress and debugging issues
  in e2e tests.
- Change events to log at level 3 instead of just level 5.
- Change the events string format to reduce verbosity.
- Hide the "Error" in the event string when there's no error.
  This reduces unnecessary highlighting of lines in Prow test logs.
2022-04-15 16:03:18 -07:00
Karl Isenberg f124e7bb7f chore: Fix event sorting for testing
Previous sorting method was not stable, and only worked coincidentally
for the two use cases that were using it. This new method works on
more event types and only sorts contiguous events. This should make
the sort usable when we add parallel apply and watch instead of poll.
2022-04-15 15:52:11 -07:00
Kubernetes Prow Robot 5d06234969
Merge pull request #570 from karlkfi/karl-operations
feat: improve event status consistency
2022-04-14 09:28:47 -07:00
Kubernetes Prow Robot 3fa1e9e7e9
Merge pull request #573 from karlkfi/karl-e2e-names
chore: Add make target for e2e test focus
2022-04-14 09:06:47 -07:00
Karl Isenberg 393ecfe7a5 feat: improve event status consistency
Event Changes:
- Renamed ActionGroupEvent.Type -> Status
- Renamed Event.Operation -> Status
- Renamed Status fields to use consistent prefixes and suffixes
- Combined Applied, Changed, Unchanged, and ServersideApplied into
  ApplySuccessful
- Added Failed status for apply, prune, and delete events
- Replaced Unspecified with Pending
- Made enum String output more consistent

Printer Changes:
- Added FormatSummary to print summary stats at the end of the
  apply/destroy, instead of after the last of each type of action
  group.
- Modified printer output to match new more consistent events.
- Updated JSON printer docs with latest schema details.

BREAKING CHANGE: Event "operations" and "type" are now "status"
BREAKING CHANGE: JSON printer schema changed to match events
BREAKING CHANGE: Event status enums renamed/refactored
2022-04-14 01:14:10 -07:00
Karl Isenberg 80e2c16dde chore: Add make target for e2e test focus
- Ex: make test-e2e-focus FOCUS=ApplyDestroy
- Rename e2e tests to be easier to copy/paste/focus without spaces.
- Reduce stress test verbosity to reduce log spam.
- Wait for kind controllers to be ready before running tests.
2022-04-14 01:07:28 -07:00
Kubernetes Prow Robot 8aaf73964a
Merge pull request #553 from karlkfi/karl-example-summary
chore: Add example test summary
2022-04-07 11:29:58 -07:00
Karl Isenberg 2a111beb8f chore: Add example test summary
- Install column when running example tests in prow
2022-04-05 16:24:02 -07:00
Kubernetes Prow Robot 89be53da95
Merge pull request #571 from karlkfi/karl-cross-namespace-deps
chore: add test for cross namespace depends-on
2022-03-31 13:51:05 -07:00
Karl Isenberg aeff41d692 chore: add test for cross namespace depends-on 2022-03-31 11:03:19 -07:00
Kubernetes Prow Robot 42d34da893
Merge pull request #562 from karlkfi/karl-filter-errors
feat: expose skip reason as error
2022-03-28 17:15:11 -07:00
Kubernetes Prow Robot a5fa28845d
Merge pull request #567 from karlkfi/karl-list-limit
feat: pagninate status poller lists
2022-03-21 17:30:14 -07:00
Karl Isenberg 95d4274c2d feat: pagninate status poller lists
- Use the client-go ListPager to paginate requests made by the
  CachingClusterReader used by the StatusPoller.
- Limit requests to 500 items per response (ListPager default)
- Benefits:
  - Reduce the length of blocking etcd operations, allowing for more
    responsiveness and higher throughput
  - Reduce risk of request timeout
  - Reduce size of response for extra large objects
2022-03-17 13:14:21 -07:00
Karl Isenberg 7aee3cc6b4 feat: error on skip
- Rewrite actuation filters to return an error with the reason for
  skipping.
- Add explicit error types for most skip errors, to make it easier to catch
  and handle them.
- Add Is method to explicit error types to allow use of errors.Is for
  recursive unwrapped matching.
- Rename InventoryPolicyFilter to InventoryPolicyPruneFilter for
  consistency with InventoryPolicyApplyFilter
- Update deletion prevention inventory-id removal to use errors.As instead
  of matching the filter name.
- Convert error structs to use pointers to allow nil errors and avoid
  copying contents.
- Update printers to handle skip errors

BREAKING CHANGE: Skipped actuation events now include an error.
BREAKING CHANGE: DeleteEvent.Reason replaced with an error.
BREAKING CHANGE: Unused InventoryNamespaceInSet error removed.
BREAKING CHANGE: InventoryOverlapError replaced with PolicyPreventedActuationError.
BREAKING CHANGE: NeedAdoptionError replaced with PolicyPreventedActuationError.
BREAKING CHANGE: NoInventoryObjError & MultipleInventoryObjError now use pointers.
2022-03-16 17:40:28 -07:00
Kubernetes Prow Robot a9d2ca7961
Merge pull request #565 from karlkfi/karl-stress-test
chore: add stress test
2022-03-10 17:53:07 -08:00
Karl Isenberg 34a8a7b334 chore: add stress test
- Stress test tests 1,000 Namespaces, CofnigMaps, & CronTabs (CR)
- Stress test is a new test suite with its own make entrypoint
- Refactor shared test code so the e2e and stress tests can both use it
- Update test client QPS to 20 (from 5)
2022-03-10 17:21:26 -08:00
Kubernetes Prow Robot d84328fc3c
Merge pull request #566 from Liujingfang1/master
Use empty object status list when the StatusPolicyNone is used
2022-03-07 17:28:33 -08: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
Kubernetes Prow Robot 010f57af33
Merge pull request #564 from karlkfi/karl-dep-uid
fix: Avoid logging UID error for skipped apply
2022-03-05 17:58:52 -08:00
Karl Isenberg 98d3504e3d fix: Avoid logging UID error for skipped apply 2022-03-05 16:12:20 -08:00
Kubernetes Prow Robot 9caf88253a
Merge pull request #563 from karlkfi/karl-disable-status
feat: Add inventory.StatusPolicy
2022-03-04 21:04:52 -08:00
Karl Isenberg be7d6e2ab4 chore: Add e2e tests for inventory status 2022-03-04 19:09:28 -08:00
Karl Isenberg 2bdc05945d feat: Add inventory.StatusPolicy
- StatusPolicyNone disables inventory status updates.
- StatusPolicyAll fully enables inventory status updates.
- This allows an opt-out feature for working around the problem
  that adding status can make the inventory larger than the max
  etcd object size, causing the applier to exit without applying
  or pruning anything. With StatusPolicyNone, the user can still
  safely prune objects to make their inventory smaller, and then
  re-enable the status with StatusPolicyAll.
- Note: the default ConfigMap does not currently support status,
  so this only affects custom inventory impls.
2022-03-04 19:09:28 -08:00
Kubernetes Prow Robot 16847b444b
Merge pull request #560 from karlkfi/karl-fix-empty-set
fix: Allow empty set of apply objects
2022-03-02 11:05:15 -08:00
Karl Isenberg c103784000 fix: Allow empty set of apply objects
- Add e2e test to ensure the inventory is still correctly created
  and destroyed when the apply object set is empty.
2022-03-02 10:36:59 -08:00
Kubernetes Prow Robot 326b8a2c92
Merge pull request #558 from karlkfi/karl-fix-dep-filter
fix: Make DependencyFilter handle DryRun
2022-03-01 16:11:55 -08:00
Karl Isenberg 0f7f95b24a fix: Make DependencyFilter handle DryRun
DryRun skips WaitEvents. So the DependencyFilter needs to skip
checking for reconciliation if DryRun is enabled.
2022-03-01 15:48:02 -08:00
Kubernetes Prow Robot 5c6134aeac
Merge pull request #555 from karlkfi/karl-dep-filter2
feat: Add dependency filter
2022-02-28 19:27:47 -08:00