fix(operator): cut the ClusterRole to the verbs the loop issues (#297 part 2) - #300
Merged
Conversation
The role granted watch, events and full CRUD on everything; the loop holds no watches and never emits an event.
… read Only a missing Secret means first run; any other error read as empty regenerates every value and the apply overwrites the stored ones.
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.
Part 2 of #297 (scoped RBAC). Part 1 is #298; part 3 (dedicated DB credentials) follows.
Every rule in the ClusterRole is now a verb the reconcile loop actually issues. Full inventory of Kubernetes calls in
lnvps_operator/src(there are 16, all listed):list:1629,delete:1637, apply:1000get("generated"):1036, apply:1315,:1341:1344,:1338,:1334delete("quota"):296list:1517list:1507, apply:1345get/create/replace/deletenostr_domains.rs:262-448, apply:1381:1310Line numbers are
lnvps_operator/src/app_deployments.rsunless noted.What comes out:
events— dead. Nothing inlnvps_operator/srcconstructs anEventor a recorder.watcheverywhere — the loop is a polling reconcile; there is nowatcher()and noControllerin the tree.updateexcept on ingresses — everything else is server-side apply, which ispatch.createstays besidepatchbecause the first pass creates the object.get/listwhere nothing reads back — services, configmaps, PVCs, networkpolicies are written and never read.deleteon the per-namespace objects — teardown deletes the namespace, and Kubernetes garbage-collects what is inside it.Secret access stays cluster-wide, and the README now says so plainly rather than leaving it implied. Scoping it to
app-Ncannot be done by moving the rule to a Role: RBAC refuses to let a subject grant permissions it does not hold, so the operator would still need the cluster-wide verbs in order to create the binding. The route that works — a second ClusterRole plusbindbyresourceNames, and a RoleBinding written per namespace at reconcile time — is code and a two-step rollout, filed as #299.No test: this is the example manifest.
cargo test --workspaceunchanged and green (lnvps_e2easide, which needs live services).This one has a live failure mode #298 does not. Applying it takes permissions away. If the running operator is doing something this inventory missed, it starts 403-ing on the next pass. It also must not be applied as a whole file while #295 is open — the ClusterRoleBinding subject in this manifest names a namespace the operator may not run in. Applying the ClusterRole alone is the safe half, and that is Kieran's call.
Channel: lnvps (f5894ea9-44c7-56fb-bd9b-6e3e671e4bc1)