fix(rbac): grant kubevirt-operator pods/resize update for inplace resize#2529
Open
fl64 wants to merge 1 commit into
Open
fix(rbac): grant kubevirt-operator pods/resize update for inplace resize#2529fl64 wants to merge 1 commit into
fl64 wants to merge 1 commit into
Conversation
virt-operator (SA kubevirt-operator) generates the ClusterRole kubevirt-internal-virtualization-controller with a pods/resize:update rule (upstream kubevirt 1.6.2 inplace resize feature, PR #103 in 3p-kubevirt). On apply, Kubernetes RBAC escalation protection blocks it because the operator's own ClusterRole d8:virtualization:kubevirt-operator does not hold that right, so the kubevirt install-strategy never rolls out and virt-handler/virt-controller stay on the old image. Add pods/resize:update to d8:virtualization:kubevirt-operator next to the existing pods/finalizers:update rule. Safe on all k8s versions: RBAC does not validate subresource existence; on clusters where the InPlacePodVerticalScaling subresource is absent, the rule is inert. Signed-off-by: Pavel Tishkov <pavel.tishkov@flant.com>
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.
Description
Adds
pods/resize: updateto the ClusterRoled8:virtualization:kubevirt-operatorintemplates/kubevirt/virt-operator/rbac-for-us.yaml, next to the existingpods/finalizers: updaterule.virt-operator (SA
kubevirt-operator) generates the ClusterRolekubevirt-internal-virtualization-controllerand applies it. With the inplace-resize feature landed in 3p-kubevirt (PR #103,feat: impl inplace resize), that generated ClusterRole now includes apods/resize: updaterule (pkg/virt-operator/resource/generate/rbac/controller.go). The inplace-resize controller itself is feature-gated, but the RBAC is applied unconditionally.Why do we need it, and what problem does it solve?
On any cluster running a 3p-kubevirt build that contains the inplace-resize commit, virt-operator fails to roll out the kubevirt install-strategy:
Kubernetes RBAC escalation protection refuses to let
kubevirt-operatorgrant a right it does not itself hold. virt-operator goes into a reenqueue loop;virt-handler/virt-controllerstay on the old image; VMs cannot migrate to a new virt-launcher; the kubevirt update is effectively blocked.This was observed in the
virtlab cluster while testing a 3p-kubevirt dev build that included PR #103 — the RBAC gap prevented any rollout until this rule was added.What is the expected result?
kubevirt-internal-virtualization-controllerClusterRole (includingpods/resize: update) without an RBAC escalation error.virt-handlerDaemonSet andvirt-controllerDeployment roll out to the new image.firmware-update-*vmops (Evict) and migrate onto nodes with the new virt-launcher.InPlacePodVerticalScalingsubresource is absent, the rule is inert (RBAC does not validate subresource existence).Cross-version safety
pods/resizesubresource: alpha in Kubernetes 1.27, beta in 1.29, GA in 1.33. RBAC does not validate subresource existence, so adding this rule is safe on all supported Kubernetes versions — on older clusters where the subresource does not exist the rule simply never matches, and the kubevirt InPlaceResize feature is feature-gated anyway. VerifiedInPlacePodVerticalScalingis BETA=enabled on the test cluster (v1.33.12).Checklist
Changelog entries