Skip to content

fix: Fix cluster-autoscaler missing resource.k8s.io RBAC permissions#214

Merged
magenx merged 2 commits intomainfrom
copilot/fix-autoscaler-permission-error
May 6, 2026
Merged

fix: Fix cluster-autoscaler missing resource.k8s.io RBAC permissions#214
magenx merged 2 commits intomainfrom
copilot/fix-autoscaler-permission-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

cluster-autoscaler (client-go v0.35.0 / Kubernetes 1.32+) watches Dynamic Resource Allocation (DRA) resources — resourceclaims, resourceslices, deviceclasses — in the resource.k8s.io API group. The patchClusterRole function only patched storage.k8s.io, leaving these verbs unauthorized and flooding logs with reflector errors.

Changes

  • patchClusterRole refactor — rewrites the single-group loop into a multi-group scan that tracks storage.k8s.io and resource.k8s.io separately, then appends any missing rules after the scan
  • resource.k8s.io rule injection — adds get/list/watch on resourceclaims, resourceslices, deviceclasses when the rule is absent
  • storage.k8s.io fallback — also inserts a storage.k8s.io/volumeattachments rule when no storage rule exists at all (previously silently skipped)
  • TestPatchClusterRole — three sub-tests: missing rule is added, existing rule is not duplicated, volumeattachments is patched into an existing storage rule
# Rule appended to the ClusterRole when missing
- apiGroups: ["resource.k8s.io"]
  resources: ["resourceclaims", "resourceslices", "deviceclasses"]
  verbs: ["get", "list", "watch"]

@magenx magenx changed the title Fix cluster-autoscaler missing resource.k8s.io RBAC permissions fix: Fix cluster-autoscaler missing resource.k8s.io RBAC permissions May 6, 2026
@magenx magenx marked this pull request as ready for review May 6, 2026 11:34
@magenx magenx merged commit 60bfb19 into main May 6, 2026
2 of 3 checks passed
@magenx magenx deleted the copilot/fix-autoscaler-permission-error branch May 6, 2026 11:34
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.

2 participants