Skip to content

Add rbac for ironic-operator creating namespaces - #696

Open
steveb wants to merge 2 commits into
openstack-k8s-operators:mainfrom
steveb:gc-rbac
Open

steveb wants to merge 2 commits into
openstack-k8s-operators:mainfrom
steveb:gc-rbac

Conversation

@steveb

@steveb steveb commented Mar 31, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes

The graphical consoles feature will create the namespace openstack-ironic-consoles which Ironic will use to create the graphical console pods.

To do this, ironic-operator needs rbac rules to create and manage (not delete) namespaces. This is proposed as a standalone change because it needs to be packaged in the openstack-operator bundle before ironic-operator can use it.

For precedence of this change, openstack-operator has the ability to manage every aspect of namespaces: https://github.com/openstack-k8s-operators/openstack-operator/blob/main/config/rbac/role.yaml#L27-L32

Also, the ironic-conductor controller creates namespace-scoped Roles that
grant pods management permissions (create, watch, update, patch,
delete) to the ironic service account. This is needed for graphical
console support, where the conductor manages console pods in a
separate namespace.

Kubernetes RBAC escalation prevention requires that the operator's
own ClusterRole holds all permissions it grants in any Role it
creates. The current ClusterRole only grants get and list on pods,
causing Role creation to be rejected with:

roles.rbac.authorization.k8s.io is forbidden: user is attempting
to grant RBAC permissions not currently held

Expand the pods verbs in the kubebuilder RBAC marker from get;list
to the full set needed by the created Roles.
Jira: OSPRH-20211

Checklist before requesting a review

  • I have performed a self-review of my code and confirmed it passes tests
  • Performed pre-commit run --all
  • Tested operator image in a test/dev environment. It can be CRC via install_yamls or a hotstack instance (optional)
  • Verified that no failures present in logs(optional):
    • ironic-operator-build-deploy-kuttl
    • podified-multinode-ironic-deployment

@openshift-ci
openshift-ci Bot requested review from abays and hjensas March 31, 2026 22:09
@openshift-ci

openshift-ci Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: steveb

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

@stuggi

stuggi commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

wondering what's the architecture/need is to use a dedicated namespace for the console deployment. iiuc from checking the related pr, its gonna be one per ctlplane deployment namespace. so far we kept all deployments for a ctlplane of an env in a single namespace.

@steveb

steveb commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator Author

/retest

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ba55262c-3d0c-4e8c-87bb-03f5ccb36c0c
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@steveb

steveb commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

wondering what's the architecture/need is to use a dedicated namespace for the console deployment. iiuc from checking the related pr, its gonna be one per ctlplane deployment namespace. so far we kept all deployments for a ctlplane of an env in a single namespace.

(apologies for delay in reply @stuggi this work was put on hold until 19 development started up)

The issue is that the ironic-conductor service will be managing the full lifecycle of the pods in this namespace, which requires rbac rules for full management of pods. If we did this in the openstack namespace that adds back the rbac vulnerability that has only just been removed as part of the glasswing work.

By running these pods in a separate namespace, a compromised ironic-conductor won't be able to modify pods running in the ctlplane openstack namespace.

@stuggi

stuggi commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

wondering what's the architecture/need is to use a dedicated namespace for the console deployment. iiuc from checking the related pr, its gonna be one per ctlplane deployment namespace. so far we kept all deployments for a ctlplane of an env in a single namespace.

(apologies for delay in reply @stuggi this work was put on hold until 19 development started up)

The issue is that the ironic-conductor service will be managing the full lifecycle of the pods in this namespace, which requires rbac rules for full management of pods. If we did this in the openstack namespace that adds back the rbac vulnerability that has only just been removed as part of the glasswing work.

By running these pods in a separate namespace, a compromised ironic-conductor won't be able to modify pods running in the ctlplane openstack namespace.

How would that work on an env where you run multiple controlplanes in a different namespace? Do those share this single openstack-ironic-consoles namespace?
Is there the need to backup this namespace for b/r?

@dprince

dprince commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@steveb hey, thanks for the pointer to the openstack-operator reference. I took a look and I think that is a remnant of an old 'initialization resource' requirement which I'm not sure we actually ever needed. I submitted a PR to try to clean that up: openstack-k8s-operators/openstack-operator#2163
I left in view, watch for openstackassistant (AI agent... goose) but I think we may restrict that even further too.

@dprince

dprince commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@steveb couldn't we just have a model where the administrator pre-creates the namespace like we do for openstack-operator proper? And then pass that to ironic-operator. We could even rely on a convention so it doesn't need to be specified if the user follows the defaults.

But with namespace isolation (when the administrator installs multiple openstack deployments on the same OCP cluster) we'd likely have to specify the alternate namespace for ironic.

@juliakreger

Copy link
Copy Markdown
Contributor

I think we could make it configurable, but we'll need to add an overriding template for the configuration to then be generated by the operator. On a plus side, everything is in theory disposable. Sharing a singular namespace which is configured then is a risk if not explicitly delineated then either, but the collision point would really be if someone did their own uuid management and shared UUIDs across deployments.

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build succeeded (check pipeline).
https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/6669816dddf341c4a63c06ca2909810c

✔️ openstack-k8s-operators-content-provider SUCCESS in 3h 57m 20s
✔️ podified-multinode-ironic-deployment SUCCESS in 52m 01s
✔️ ironic-s2i-content-provider SUCCESS in 4h 25m 04s (non-voting)
✔️ ironic-s2i-hotstack-sno-1-bm SUCCESS in 1h 41m 44s (non-voting)

@steveb

steveb commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

As currently proposed [1] the namespace is built by prefixing with the control plane namespace, so this will work fine in a multi openstack deployment OCP.

I'm proposing this because I'd prefer to avoid adding manual steps for a relatively esoteric feature, and an operator having the ability to create (but not delete) namespaces is not a risk for exploitation.

[1] 3bd5d8f#diff-d9cd0c71a3f8ece60bda3ad98ae72c6080850aabbbd4c0a0a21b2e3f03b9fe5bR206

steveb added 2 commits October 7, 2026 13:09
The graphical consoles feature will create the namespace
openstack-ironic-consoles which Ironic will use to create the graphical
console pods.

To do this, ironic-operator needs rbac rules to create (not delete)
namespaces. This is proposed as a standalone change because it needs to
be packaged in the openstack-operator bundle before ironic-operator can
use it.

Jira: OSPRH-20211
The ironic-conductor controller creates namespace-scoped Roles that
grant pods management permissions (create, watch, update, patch,
delete) to the ironic service account. This is needed for graphical
console support, where the conductor manages console pods in a
separate namespace.

Kubernetes RBAC escalation prevention requires that the operator's
own ClusterRole holds all permissions it grants in any Role it
creates. The current ClusterRole only grants get and list on pods,
causing Role creation to be rejected with:

  roles.rbac.authorization.k8s.io is forbidden: user is attempting
  to grant RBAC permissions not currently held

Expand the pods verbs in the kubebuilder RBAC marker from get;list
to the full set needed by the created Roles.
@steveb

steveb commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

I've added a commit to this PR which lets ironic-conductor manage pods in this namespace. Here is the commit message for context:

The ironic-conductor controller creates namespace-scoped Roles that
grant pods management permissions (create, watch, update, patch,
delete) to the ironic service account. This is needed for graphical
console support, where the conductor manages console pods in a
separate namespace.

Kubernetes RBAC escalation prevention requires that the operator's
own ClusterRole holds all permissions it grants in any Role it
creates. The current ClusterRole only grants get and list on pods,
causing Role creation to be rejected with:

roles.rbac.authorization.k8s.io is forbidden: user is attempting
to grant RBAC permissions not currently held

Expand the pods verbs in the kubebuilder RBAC marker from get;list
to the full set needed by the created Roles.

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build succeeded (check pipeline).
https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/8889f28758034ac481f7bc561f6599cf

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 55m 33s
✔️ podified-multinode-ironic-deployment SUCCESS in 53m 01s
✔️ ironic-s2i-content-provider SUCCESS in 17h 31m 20s (non-voting)
✔️ ironic-s2i-hotstack-sno-1-bm SUCCESS in 1h 39m 09s (non-voting)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants