Repository navigation
feat(controller): declare environments, groups and pools as kubernetes custom resources - #49
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pools, environments and groups could only be declared through the REST API or the CLI. On Kubernetes
that means the platform team cannot keep them in Git next to everything else and let FLUX apply them.
Approach
Three namespaced custom resources (
Environment,Group,Pool,grus.onelitefeather.net/v1alpha1) mirrorthe domain specs one to one. With
GRUS_CRDS=true(chart:crds.watch) the controller watches its ownnamespace, applies every resource with source
kubernetesand removes stored objects whose resource isgone, so the cluster stays the source of truth. Deleting a pool resource drains the pool like the API does.
The outcome comes back to the user on the resource: invalid specs show
Ready=Falsewith reasonInvalidand the field messages, pools report replicas, ready and allocated replicas and whether they reached their
minimum. Objects owned by Kubernetes stay read-only in the REST API; the 409 now says which resource to edit
with kubectl.
The chart does not install the CRDs (FLUX ships
deploy/crds); withcrds.watchit only adds namespacedread rights and status write rights to the existing Role. No ClusterRole.
Testing
API-owned ones), invalid and mistyped specs, status counts, debounce and condition times with an injected
clock, add/delete events, retry of failed applies. No sleeps.
the example resources are decoded strictly and validated.
helm lintandhelm templatewith and withoutcrds.watch.