Skip to content

[occm] Reduce ClusterRole scope - #3165

Merged
kubernetes-prow[bot] merged 4 commits into
kubernetes:masterfrom
shiftstack:reduce-clusterrole-scope
Aug 27, 2026
Merged

kubernetes-prow[bot] merged 4 commits into
kubernetes:masterfrom
shiftstack:reduce-clusterrole-scope

Conversation

@stephenfin

Copy link
Copy Markdown
Member

What this PR does / why we need it:

A collection of 3 changes, all intended to reduce the cluster-wide access granted by the system:cloud-controller-manager ClusterRole.

  • [occm] Limit verbs for node access: OCCM does not need to create or delete nodes
  • [occm] Prevent access to PVs: OCCM does not need access to PVs
  • [occm] Add new Role for secrets: OCCM does not need cluster-wide secret access. It only needs access to the configuration secret (kube-system / cloud-config if using the standard manifests).

Which issue this PR fixes(if applicable):

(none)

Special notes for reviewers:

Release note:

[openstack-cloud-controller-manager] Reduce scope of `system:cloud-controller-manager` cluster role

@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 26, 2026
@winiciusallan

Copy link
Copy Markdown
Contributor

/lgtm

looks like this needs a bump to a new chart version

@kubernetes-prow

Copy link
Copy Markdown
Contributor

@winiciusallan: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

looks like this needs a bump to a new chart version

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

OCCM does not need to create or delete nodes

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
OCCM does not need this access.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
OCCM does not query Kubernetes secrets via the Kubernetes API in any of
its controllers. The only secret is needs access to is the
'cloud-config' secret mounted as a volume into the container. This
exists in the 'kube-system' namespace for standard manifests and the
release namespace when deployed via Helm. Therefore it's unnecessary to
grand cluster-wide get, list and watch access to all secrets via the
system:cloud-controller-manager ClusterRole.

Fix this by introducing a new
'system:cloud-controller-manager:secret-reader' Role in the standard
manifests and a '{{ .Values.clusterRoleName }}:secret-reader' Role in
the Helm charts.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
@stephenfin
stephenfin force-pushed the reduce-clusterrole-scope branch from 3fcab16 to d8e9a5d Compare August 27, 2026 15:15
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
@kubernetes-prow kubernetes-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 27, 2026

@mandre mandre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 27, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mandre

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 27, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit cc53644 into kubernetes:master Aug 27, 2026
5 checks passed
@mandre
mandre deleted the reduce-clusterrole-scope branch August 27, 2026 15:38
@mandre

mandre commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

/cherry-pick release-1.36 release-1.35 release-1.34

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@mandre: #3165 failed to apply on top of branch "release-1.36":

Applying: Limit verbs for node access
Applying: Prevent access to PVs
Applying: Add new Role for secrets
Applying: occm: Bump openstack-cloud-controller-manager chart to 2.36.2
Using index info to reconstruct a base tree...
M	charts/openstack-cloud-controller-manager/Chart.yaml
Falling back to patching base and 3-way merge...
Auto-merging charts/openstack-cloud-controller-manager/Chart.yaml
CONFLICT (content): Merge conflict in charts/openstack-cloud-controller-manager/Chart.yaml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0004 occm: Bump openstack-cloud-controller-manager chart to 2.36.2

Details

In response to this:

/cherry-pick release-1.36 release-1.35 release-1.34

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubernetes-prow Bot pushed a commit that referenced this pull request Sep 9, 2026
* [occm] Include cloudConfigContents in DaemonSet checksum annotation (#3080)

* occm: include cloudConfigContents in DaemonSet checksum annotation

When cloud config is supplied via cloudConfigContents rather than the
structured cloudConfig values, changes to it do not alter the checksum
annotation on the DaemonSet pod template. Pods are not restarted after
credential rotation or endpoint changes.

* Bump openstack-cloud-controller-manager chart to 2.36.1

---------

Co-authored-by: 234u34k <234u34k@users.noreply.github.com>
(cherry picked from commit 231a42c)

* [manila-csi-plugin, cinder-csi-plugin]: Allow cluster-id to be populated from configmap / secret (#3152)

* feat(manila-csi): allow cluster-id to be pulled from env variables

Signed-off-by: Jack Charlie Munday <1602077@users.noreply.github.com>

* feat(cinder-csi): allow cluster-id to be pulled from env variables

Signed-off-by: Jack Charlie Munday <1602077@users.noreply.github.com>

* chore: bump chart versions for manila & cinder

Signed-off-by: Jack Charlie Munday <1602077@users.noreply.github.com>

---------

Signed-off-by: Jack Charlie Munday <1602077@users.noreply.github.com>
Co-authored-by: 1602077 <1602077@users.noreply.github.com>
(cherry picked from commit 78fca23)

* Fix config drive mount and add flag to control the search order in which the driver retrieves instance metadata (#3141)

* add mount for config drive and add search order flag

* rebase and fix conflict

* remove duplicate searchorder flag

* remove trail newline

* Apply suggestion from @kayrus

* mount /dev/disk instead of /dev

* bump chart version

* mount /dev to get access to the config-drive

---------

Co-authored-by: pýrus <kayrus@users.noreply.github.com>
(cherry picked from commit 32a5622)

* cinder-csi: make csi-snapshotter sidecar optional (#3078)

Co-authored-by: 234u34k <234u34k@users.noreply.github.com>
(cherry picked from commit ff04631)

* [occm] Reduce ClusterRole scope (#3165)

* [occm] Limit verbs for node access

OCCM does not need to create or delete nodes

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* [occm] Prevent access to PVs

OCCM does not need this access.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* [occm] Add new Role for secrets

OCCM does not query Kubernetes secrets via the Kubernetes API in any of
its controllers. The only secret is needs access to is the
'cloud-config' secret mounted as a volume into the container. This
exists in the 'kube-system' namespace for standard manifests and the
release namespace when deployed via Helm. Therefore it's unnecessary to
grand cluster-wide get, list and watch access to all secrets via the
system:cloud-controller-manager ClusterRole.

Fix this by introducing a new
'system:cloud-controller-manager:secret-reader' Role in the standard
manifests and a '{{ .Values.clusterRoleName }}:secret-reader' Role in
the Helm charts.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* occm: Bump openstack-cloud-controller-manager chart to 2.36.2

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

---------

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
(cherry picked from commit cc53644)

* [occm] Fix serviceMonitor labelSelector and remove deprecated bearerTokenFile auth (#3039)

* servicemonitor changes

* add always allow path "/metrics"

* chart version bump

* chart version bump

* Fix indentation for labels in servicemonitor.yaml

* Move flag placement to inside serviceMonitor.enabled block

Co-authored-by: Jihyun Hur <huhji.elha@gmail.com>

* Fix indentation and duplication

* Chart version bump and rebase

* Chart version bump

---------

Co-authored-by: Matt Anson <matta@stackhpc.com>
Co-authored-by: Jihyun Hur <huhji.elha@gmail.com>
(cherry picked from commit e061006)

* cinder-csi: configure topology with --with-topology (#3155)

Co-authored-by: 234u34k <234u34k@users.noreply.github.com>
(cherry picked from commit 16c3b98)

* [occm] Make hostNetwork configurable in the Helm chart (#3097)

* [occm] Make hostNetwork configurable in the Helm chart

* Bump version to 2.36.1 in Chart.yaml

* Update Chart.yaml

* [occm] Drop dnsPolicy override logic, change default in values.yaml

Per review, the template no longer derives dnsPolicy from hostNetwork.
The default dnsPolicy is now ClusterFirstWithHostNet in values.yaml,
matching the default hostNetwork: true. Users disabling hostNetwork
should set dnsPolicy: ClusterFirst.

Bump chart to 2.36.4 since master already moved to 2.36.3.

(cherry picked from commit e87f547)

* [cinder-csi-plugin] Reduce caps of manifests, charts (#3181)

* cinder-csi-plugin: Add note on why hostNetwork is required

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* cinder-csi-plugin: Drop redundant capabilities add

`privileged: true` already implies this capability.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* cinder-csi-plugin: Add securityContext for node plugin sidecars

Neither sidecar requires root privileges nor a writable filesystem. They
only talk to the CSI socket. securityContext was already present in the
charts but was unset. It was missing from the manifests. We now set it
in both places.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* cinder-csi-plugin: Add securityContext for all controller plugin containers

Unlike the node plugin, which requires the ability to e.g. mount things,
the controller plugin only talks to the k8s and OpenStack APIs. Thus, it
is possible to add a strict policy check for all the containers here.
Like the node plugin though, securityContext was already present in the
charts but was unset, while the configuration was missing from the
manifests. We set it in both places.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* cinder-csi-plugin: Set dnsPolicy

This was already set in the charts but was missing in the static
manifests. We want to use the cluster DNS, not the hosts (which would
otherwise happen due to hostNetwork being true).

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* cinder-csi-plugin: Set priorityClassName

These pods handle mounts. If they get evicted, nodes cannot unmount
volumes which in turn prevents node drain. Other providers already set
this [1][2].

Note that we currently have a priorityClassName variable in the charts,
but this is a single global value meaning the you couldn't set it to
anything but system-node-critical, which is the default, since
system-cluster-critical would under-privilege the node DaemonSet. We
simply ignore this old, unusable value if set.

[1] https://github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/36d7fd880c3c4ff3b29212e2c5df8aca6628eda6/charts/aws-ebs-csi-driver/templates/_node.tpl#L48
[2] https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/6bc2e5c4608b9874f093620eaf1865ac80b93e1c/charts/v1.28.7/azuredisk-csi-driver/templates/csi-azuredisk-node.yaml#L56

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* cinder-csi-plugin: Bump cinder-csi-plugin chart to 2.36.4

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* tests: Report kernel features on hosts

So we can determine whether things like seccomp are supported.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

---------

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
(cherry picked from commit f16c52a)

* [manila-csi-plugin] Reduce caps of manifests, charts (#3182)

* manila-csi-plugin: Add note on why hostNetwork is required

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* manila-csi-plugin: Drop redundant capabilities add

`privileged: true` already implies this capability.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* manila-csi-plugin: Add securityContext for node plugin sidecars

The registrar sidecar requires neither root privileges nor a writable
filesystem: it only talks to the CSI socket. Add a relevant
securityContext.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* manila-csi-plugin: Add securityContext for all controller plugin containers

Unlike the node plugin, which requires the ability to e.g. mount things,
the controller plugin only talks to the k8s and OpenStack APIs. Thus, it
is possible to add a strict policy check for all the containers here.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* manila-csi-plugin: Set priorityClassName

These pods handle mounts. If they get evicted, nodes cannot unmount
volumes which in turn prevents node drain. Other providers already set
this [1][2].

[1] https://github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/36d7fd880c3c4ff3b29212e2c5df8aca6628eda6/charts/aws-ebs-csi-driver/templates/_node.tpl#L48
[2] https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/6bc2e5c4608b9874f093620eaf1865ac80b93e1c/charts/v1.28.7/azuredisk-csi-driver/templates/csi-azuredisk-node.yaml#L56

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* manila-csi-plugin: Bump manila-csi-plugin chart to 2.36.3

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

---------

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
(cherry picked from commit 3db62bf)

* [cinder-csi-plugin] Allow setting parameters on chart-managed StorageClasses (#3173)

Add optional storageClass.delete.parameters and
storageClass.retain.parameters values to the Helm chart, rendered into
the respective StorageClass. Defaults to {}, rendered output is
unchanged when unset.

Signed-off-by: Dean Chen <862469039@qq.com>
(cherry picked from commit c36c84d)

* [occm] Reduce caps of manifests, charts (#3191)

* openstack-cloud-controller-manager: Add note on why hostNetwork is required

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* openstack-cloud-controller-manager: Add securityContext for controller containers

The OCCM only talks to the Kubernetes and OpenStack APIs and does not
need write access to the root filesystem. Unlike the CSI sidecar
containers, the pod already runs as a non-root user (runAsUser: 1001),
so we can additionally set allowPrivilegeEscalation and runAsNonRoot.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* openstack-cloud-controller-manager: Set dnsPolicy

We want to use the cluster DNS, not the host's, which would otherwise
happen due to hostNetwork being true.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* openstack-cloud-controller-manager: Set priorityClassName

If the OCCM is evicted, new nodes cannot be initialized and will remain
in the NotReady state. Other providers already set this.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* openstack-cloud-controller-manager: Drop Bitnami common chart dependency

The dependency was used solely for the common.labels.standard helper,
which generates standard Kubernetes recommended labels. This is
trivially replicated inline in _helpers.tpl, and the other CSI charts in
this repo already manage without it.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* openstack-cloud-controller-manager: Bump openstack-cloud-controller-manager chart to 2.36.5

We also change the maintainer since Frank has not been active in CPO for
many years now.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* openstack-cloud-controller-manager: Drop all capabilities

The OCCM only makes API calls to Kubernetes and OpenStack and requires
no Linux capabilities.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* openstack-cloud-controller-manager: Use stable labels

Do not match on 'helm.sh/chart' and 'app.kubernetes.io/version' in the
ServiceMonitor selector since they change on chart bump or app bumps
respectively and would cause Prometheus to lose its scrape target after
an upgrade. Instead use 'app.kubernetes.io/name' and
'app.kubernetes.io/instance', which are stable across upgrades and
sufficient to uniquely identify the Service. These are extracted into a
new 'occm.labels.matchLabels' helper for reuse.

Note that we only change things for ServiceMonitor. While both the
Service and DaemonSet use old-style app/release/component labels, we
can't update the DaemonSet without a major version change since this
would be a breaking change and we can't update the Service without
updating the DaemonSet since doing so would stop traffic getting routed
correctly. We'll need to address these in a follow-up that is only
included in the new release.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

---------

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
(cherry picked from commit f3ef836)

---------

Signed-off-by: Jack Charlie Munday <1602077@users.noreply.github.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Dean Chen <862469039@qq.com>
Co-authored-by: 234u34k <ashburn.tech+github@gmail.com>
Co-authored-by: 234u34k <234u34k@users.noreply.github.com>
Co-authored-by: jack munday <62025739+1602077@users.noreply.github.com>
Co-authored-by: 1602077 <1602077@users.noreply.github.com>
Co-authored-by: Diana Gaponcic <37191907+dgaponcic@users.noreply.github.com>
Co-authored-by: pýrus <kayrus@users.noreply.github.com>
Co-authored-by: Claudia Watson <claudia.lola.watson@gmail.com>
Co-authored-by: Matt Anson <matta@stackhpc.com>
Co-authored-by: Jihyun Hur <huhji.elha@gmail.com>
Co-authored-by: Denis GERMAIN <dt.germain@gmail.com>
Co-authored-by: Dean Chen <51218137+locker95@users.noreply.github.com>
kubernetes-prow Bot pushed a commit that referenced this pull request Sep 22, 2026
#3165 dropped create/delete on nodes. the node lifecycle controller
still needs delete so OCCM can remove nodes whose OpenStack VMs are
already gone. without it, those nodes stay NotReady forever.

create stays omitted.

Signed-off-by: Dean Chen <862469039@qq.com>
shiftstack-merge-bot-cloner Bot pushed a commit to shiftstack/cloud-provider-openstack that referenced this pull request Oct 15, 2026
* [occm] Limit verbs for node access

OCCM does not need to create or delete nodes

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* [occm] Prevent access to PVs

OCCM does not need this access.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* [occm] Add new Role for secrets

OCCM does not query Kubernetes secrets via the Kubernetes API in any of
its controllers. The only secret is needs access to is the
'cloud-config' secret mounted as a volume into the container. This
exists in the 'kube-system' namespace for standard manifests and the
release namespace when deployed via Helm. Therefore it's unnecessary to
grand cluster-wide get, list and watch access to all secrets via the
system:cloud-controller-manager ClusterRole.

Fix this by introducing a new
'system:cloud-controller-manager:secret-reader' Role in the standard
manifests and a '{{ .Values.clusterRoleName }}:secret-reader' Role in
the Helm charts.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* occm: Bump openstack-cloud-controller-manager chart to 2.36.2

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

---------

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
shiftstack-merge-bot-cloner Bot pushed a commit to shiftstack/cloud-provider-openstack that referenced this pull request Oct 15, 2026
kubernetes#3165 dropped create/delete on nodes. the node lifecycle controller
still needs delete so OCCM can remove nodes whose OpenStack VMs are
already gone. without it, those nodes stay NotReady forever.

create stays omitted.

Signed-off-by: Dean Chen <862469039@qq.com>
kubernetes-prow Bot pushed a commit that referenced this pull request Oct 15, 2026
#3165 dropped create/delete on nodes. the node lifecycle controller
still needs delete so OCCM can remove nodes whose OpenStack VMs are
already gone. without it, those nodes stay NotReady forever.

create stays omitted.

Signed-off-by: Dean Chen <862469039@qq.com>
Co-authored-by: Dean Chen <862469039@qq.com>
shiftstack-merge-bot-cloner Bot pushed a commit to shiftstack/cloud-provider-openstack that referenced this pull request Oct 26, 2026
* [occm] Limit verbs for node access

OCCM does not need to create or delete nodes

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* [occm] Prevent access to PVs

OCCM does not need this access.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* [occm] Add new Role for secrets

OCCM does not query Kubernetes secrets via the Kubernetes API in any of
its controllers. The only secret is needs access to is the
'cloud-config' secret mounted as a volume into the container. This
exists in the 'kube-system' namespace for standard manifests and the
release namespace when deployed via Helm. Therefore it's unnecessary to
grand cluster-wide get, list and watch access to all secrets via the
system:cloud-controller-manager ClusterRole.

Fix this by introducing a new
'system:cloud-controller-manager:secret-reader' Role in the standard
manifests and a '{{ .Values.clusterRoleName }}:secret-reader' Role in
the Helm charts.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

* occm: Bump openstack-cloud-controller-manager chart to 2.36.2

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

---------

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
shiftstack-merge-bot-cloner Bot pushed a commit to shiftstack/cloud-provider-openstack that referenced this pull request Oct 26, 2026
kubernetes#3165 dropped create/delete on nodes. the node lifecycle controller
still needs delete so OCCM can remove nodes whose OpenStack VMs are
already gone. without it, those nodes stay NotReady forever.

create stays omitted.

Signed-off-by: Dean Chen <862469039@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants