Update RBAC to ensure Update verb for Wasm objects#5186
Merged
Conversation
Signed-off-by: Jeremy Fleitz <jeremy@cosmonic.com>
ricochet
reviewed
May 21, 2026
ricochet
left a comment
Contributor
There was a problem hiding this comment.
missing services/finalizers update
Contributor
Author
Thanks for catching! I added the services/finalizers update verb and then retested by making a k8s service first before creating the WorkloadDeployment manifest, so that the operator would need update permissions for updating the service. |
Contributor
|
need to push? No new commits |
Signed-off-by: Bailey Hayes <bailey@cosmonic.com>
Contributor
|
Pushed the fix and tested via automation in #5187 |
ricochet
approved these changes
May 21, 2026
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.
Summary
This PR does two related things:
updateverb on the*/finalizerssubresources for every CRD in theruntime.wasmcloud.devapiGroup. Without this, the GC admission plugin rejects any child object the operator tries to create withblockOwnerDeletion: truein itsownerReferences.runtime-operator/config/rbac/role.yaml(generated bycontroller-genviamake manifests) into sync with what the operator actually needs at runtime. Several markers were either missing or silently dropped, leaving the generated role incomplete and drifted from the Helm chart.Why
Deploying the operator into a namespace surfaced this error during reconciliation:
The Kubernetes garbage-collection admission plugin enforces that a caller setting
blockOwnerDeletion: trueon a child object must have theupdateverb on<owner-kind>/finalizers. The operator builds child resources (e.g. aWorkloadReplicaSetowned by aWorkload) withblockOwnerDeletionset, so it needsworkloads/finalizers(and the same for the other CRDs in the apiGroup).Changes
Helm chart (
charts/runtime-operator/templates/operator/clusterrole.yaml)Adds a new rule granting
updateon the fourruntime.wasmcloud.dev/*/finalizerssubresources (artifacts,workloads,workloadreplicasets,workloaddeployments).hosts/finalizersis intentionally not added here — Hosts live in the operator's own namespace and are already granted finalizer permissions via the namespacedRoleinrole.yaml.This rule is the manual sync from
config/rbac/role.yaml, which now produces the same shape viamake manifests.Annotations (source of truth)
workload_controller.go— Added markers forconfigmaps,secrets, andevents. These resources are consumed by the workload reconciler (utils.go::ResolveConfigFrom,ResolveSecretFrom,MaterializeImagePullSecretand theRecorder.Eventfcall site) but had no+kubebuilder:rbacmarker, so they never appeared in the generated role.workload_route_controller.goandhost_pod_controller.go— Moved existing markers forpods,services, andendpointslicesfrom declaration-attached comments (above theReconcile/SetupWithManagerfuncs) to package-level comments at the top of the file.controller-gen v0.16.4was silently dropping the declaration-attached markers on these two files even though they were syntactically identical to working markers on other controllers (the package-level placement is processed reliably). A short pointer comment was left near the original location so future maintainers can find them.Generated manifests (
runtime-operator/config/rbac/role.yaml)Regenerated via
make manifests. New rules in the file reflect the annotation changes above — no hand edits.Result
After this PR,
make manifestsproduces aconfig/rbac/role.yamlcontaining the full set of permissions the operator actually needs:The Helm chart maps this generated role into its structural layout (namespaced
Rolefor Hosts and leader election,ClusterRolefor everything else, with the existingwatchNamespacesconditional for per-namespace bindings). The chart is now consistent with the generated source of truth and no longer drifts in the resources it grants.Test plan
make manifestsruns cleanly and produces no diff beyond what is committedgo build ./...passeshelm installof the chart succeeds; operator pod reachesReadyWorkloadand confirm theWorkloadReplicaSetis created without thecannot set blockOwnerDeletionerrorWorkloadand confirm the ownedWorkloadReplicaSetis garbage-collected (verifies theblockOwnerDeletionchain is actually working, not just permitted)operator.watchNamespacesset, to confirm the per-namespace RBAC path still worksFor the last step on "Repeat the Workload with watchNamespaces", I used the following settings in
values.local.yaml:And then deployed the wasmCloud test app to that namespace:
There were no errors that occurred and the wasmCloud curl test returned successfully.
Signed-off-by: Jeremy Fleitz jeremy@cosmonic.com