Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Server-side reconciliation for the v1beta2 API #426

Merged
merged 21 commits into from
Oct 7, 2021
Merged

Commits on Sep 30, 2021

  1. Introduce v1beta2 API

    Changes from v1beta1:
    - `spec.validation` removed (server-side validation is implicit)
    - `spec.status.snapshot` replaced by `spec.status.inventory`
    - `spec.patchesStrategicMerge` deprecated in favour of `spec.patches`
    - `spec.patchesJson6902` deprecated in favour of `spec.patches`
    
    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    7ffe62b View commit details
    Browse the repository at this point in the history
  2. Add SSA resource manager

    Package ssa contains utilities for managing Kubernetes resources using sever-side apply.
    Package objectutil contains utilities for manipulating Kubernetes objects.
    
    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    3a03d23 View commit details
    Browse the repository at this point in the history
  3. Remove kubectl dependency

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    79dd865 View commit details
    Browse the repository at this point in the history
  4. Implement reconciliation using server-side apply

    Reconciler behaviour:
    - Creates an inventory of objects to be applied (persisted in-cluster under `.status.inventory`).
    - Applies first custom resource definitions (CRDs) and namespaces, waits for them to register and only then applies the custom resources.
    - Validates all resources with server-side dry-run apply (namespaced objects must contain `metadata.namespace`, defaulting to the `default` namespace is no longer supported).
    - Reconciles only the resources that drifted.
    - Prunes the objects that were previously applied but are missing from the current inventory.
    - Emits events for only the resources that where created, configured or deleted.
    
    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    1e01d80 View commit details
    Browse the repository at this point in the history
  5. Update the status when health checking starts

    Set the healthiness status to progressing and specify the health check timeout in the condition message.
    
    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    b33e3b3 View commit details
    Browse the repository at this point in the history
  6. Refactor reconciliation into actions

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    69069c3 View commit details
    Browse the repository at this point in the history
  7. Skip finalizer pruning when impersonation fails

    When impersonation fails, emit an event with the stale objects and continue with the finalization as this is not a retryable error.
    
    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    97bbc59 View commit details
    Browse the repository at this point in the history
  8. Add e2e test for CRDs+CRs reconciliation using cert-manager

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    8baead9 View commit details
    Browse the repository at this point in the history
  9. Implement health checking for all resources

    - Add `.spec.wait` optional boolean field to API
    - Wait for all applied resources to become ready when `.spec.wait` is set to `true`
    
    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    468f00e View commit details
    Browse the repository at this point in the history
  10. Add spec.wait usage to the API docs

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    9c8f284 View commit details
    Browse the repository at this point in the history
  11. Run SSA resource manager tests in CI

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    9c533e4 View commit details
    Browse the repository at this point in the history
  12. Add test for reconciling an empty source

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    64084ea View commit details
    Browse the repository at this point in the history
  13. Skip pruning for objects with a different owner

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Sep 30, 2021
    Configuration menu
    Copy the full SHA
    d022286 View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2021

  1. Use ssa package from fluxcd/pkg

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    6346591 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2021

  1. Update kustomize to v4.4.0

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    50c7135 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2021

  1. envtest: Add cancellable context to stop controllers

    In suite test, the context created by SetupSignalHandler() watches for
    shutdown signal to cancel the context. This makes it possible to stop
    the controllers by sending a kill signal that cancels the context.
    
    This change allows controller context cancellation by creating another
    context from SetupSignalHandler() context with a CancelFunc that's
    called at the end of the test, instead of sending a kill signal.
    
    Signed-off-by: Sunny <darkowlzz@protonmail.com>
    darkowlzz committed Oct 6, 2021
    Configuration menu
    Copy the full SHA
    b7abdf2 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #439 from darkowlzz/envtest-stop-controllers

    envtest: Add cancellable context to stop controllers
    stefanprodan committed Oct 6, 2021
    Configuration menu
    Copy the full SHA
    efd1cb4 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2021

  1. Add example for .spec.wait usage

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Oct 7, 2021
    Configuration menu
    Copy the full SHA
    dba56a5 View commit details
    Browse the repository at this point in the history
  2. Replace envtest with testenv

    testenv now supports provisioning users. Replace envtest with testenv.
    
    Also, reorder the cleanup to stop the test environment before stopping
    the file server to avoid anything in the cluster trying to connect to
    the file server after it's stopped.
    
    Signed-off-by: Sunny <darkowlzz@protonmail.com>
    darkowlzz committed Oct 7, 2021
    Configuration menu
    Copy the full SHA
    dd3935c View commit details
    Browse the repository at this point in the history
  3. Merge pull request #441 from darkowlzz/use-testenv

    Replace envtest with testenv
    stefanprodan committed Oct 7, 2021
    Configuration menu
    Copy the full SHA
    ad2fe66 View commit details
    Browse the repository at this point in the history
  4. Restore spec.validation and mark it as deprecated

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Oct 7, 2021
    Configuration menu
    Copy the full SHA
    51a7189 View commit details
    Browse the repository at this point in the history