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

v1: Reimplement reconciliation with server-side apply #17

Merged
merged 40 commits into from
Sep 7, 2021
Merged

Conversation

stefanprodan
Copy link
Owner

@stefanprodan stefanprodan commented Aug 30, 2021

Changes:

  • implement reconciling and garbage collection with server-side apply
  • implement health checking with kstatus
  • drop kustomize and kubectl execs (kustomizer requires no other binary to be installed, only a valid kubeconfig)
  • add build command (compatible with Kustomize v4.3.0)
  • add diff command (masks Kubernetes Secrets values)
  • refactor apply command
  • refactor delete command
  • add tests using controller runtime envtest
  • refactor CI

The apply command performs the following actions:

  • decodes raw manifests and Kustomize overlays into Kubernetes objects
  • creates an inventory of objects to be applied (persisted on the cluster as a ConfigMap)
  • validates the objects with server-side dry-run apply
  • determines if the in-cluster objects are in drift based on the dry-run result
  • reconciles the objects on the cluster with server-side apply
  • waits for the objects to be fully reconciled by looking up their readiness status
  • prunes the objects that were previously applied but are missing from the current inventory
  • waits for the deleted objects to be terminated

Benchmark:

Operation Time Objects
kubectl dry-run 16.024s 110
kustomizer dry-run 15.258s 110
kubectl dry-run + apply 35.770s 110
kustomizer dry-run + apply 25.575s 110
kubectl delete 28.486s 110
kustomizer delete 21.507s 110

Benchmark conclusion:

Using kustomizer instead of kubectl for applying and deleting Kubernetes resources comes with no speed penalty.

The Resource Manager performs the following actions:
- decodes raw manifests (YAML & JSON) into Kubernetes objects
- validates the objects with server-side dry-run apply
- determines if the in-cluster objects are in drift based on the dry-run result
- reconciles the objects on the cluster with server-side apply
- waits for the objects to be fully reconciled by looking up their readiness status

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
The InventoryManager contains utilities for keeping a record of Kubernetes objects applied on a cluster.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan changed the title v1: Implement server-side apply v1: Reimplement manifests reconciliation with server-side apply Aug 31, 2021
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan force-pushed the v1-dev branch 3 times, most recently from ba753eb to 8b035d4 Compare September 1, 2021 15:24
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan force-pushed the v1-dev branch 2 times, most recently from e632795 to 672c469 Compare September 2, 2021 08:46
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan changed the title v1: Reimplement manifests reconciliation with server-side apply v1: Reimplement reconciliation with server-side apply Sep 3, 2021
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan force-pushed the v1-dev branch 2 times, most recently from a424501 to fdf1544 Compare September 6, 2021 08:20
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan force-pushed the v1-dev branch 3 times, most recently from 08c76ba to ff7db62 Compare September 6, 2021 17:20
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant