Remove kolla entrypoint pattern, harden SecurityContext - #768
Conversation
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 30m 38s |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 39m 42s |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 53m 11s |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 00m 50s |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 03m 37s |
|
/retest |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 04m 52s |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 00m 42s |
|
/retest |
|
/test precommit-check |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 47m 50s |
|
recheck |
|
Build failed (check pipeline). Post ❌ openstack-k8s-operators-content-provider FAILURE in 5m 45s |
|
recheck |
|
/test ironic-operator-build-deploy-kuttl |
1 similar comment
|
/test ironic-operator-build-deploy-kuttl |
|
recheck |
| // container's own explicit fields override the pod-level | ||
| // default, exempting dnsmasq specifically. | ||
| SecurityContext: &corev1.SecurityContext{ | ||
| RunAsUser: ptr.To(int64(0)), |
There was a problem hiding this comment.
We need to merge #779 first and backport it to stable-18, so you'll likely need to rebase this when it is merged
|
This looks good to me. After #779 is merged I'm happy for this to land. |
Replaces the kolla_start/kolla_set_configs/config.json staging pattern with direct volume mounts to final config paths and direct service commands, across ironic-api, ironic-conductor, ironic-inspector, ironic-neutron-agent, and both db-sync jobs. RBAC: IronicAPI/Conductor/Inspector/NeutronAgent share one ServiceAccount/Role when owned by the parent Ironic CR, so they cannot get independently different SCC grants. The shared Role grants anyuid;privileged;nonroot-v2 -- conductor/inspector genuinely need anyuid+privileged for PXE chroot (SYS_CHROOT/SETFCAP) and DHCP/TFTP sub-1024-port binding (NET_ADMIN/NET_RAW), while nonroot-v2 is included to match every other operator in the effort. Mixed-privilege pods (conductor, inspector) carry a pod-level RestrictivePodSecurityContext for their non-root siblings, with dnsmasq and pxe-init explicitly overriding RunAsUser/RunAsNonRoot back to root on their own container SecurityContext. Both dnsmasq and pxe-init Drop ALL capabilities first, then add back only the specific caps they need (NET_ADMIN/NET_RAW for dnsmasq, SYS_CHROOT/SETFCAP for pxe-init). AutomountServiceAccountToken set to false on all workloads including conductor -- get_net_ip reads network status from the DownwardAPI volume (/etc/podinfo/network-status), not from the k8s API. Writable paths: - run-httpd emptyDir added to conductor (was missing entirely) and mount added to both conductor's and inspector's httpboot containers -- httpd cannot write its PID file without writable /run/httpd - Adopts lib-common volume.WritableDirVolume/WritableDirVolumeMount helpers with constants for run-httpd, string literals for ironic-specific volumes (var-lib-ironic, logs, etc.) Config secret DefaultMode tightened from 0640 to 0440. Also fixes: the standard TLS cert/key staging-path bug on ironic-api's and ironic-inspector's httpd; httpd.conf User/Group changed from apache to ironic on ironic-api specifically, matching its pre-existing WSGIDaemonProcess user=ironic evidence, while ironic-inspector's proxy httpd and both httpboot instances keep apache (no such evidence). Config delivery uses three variants of the EmptyDir-seed pattern: plain final-path Secret SubPath mounts, a single merged file written by the init container's crudini-merge step (03-init-container-conductor.conf), and a dynamically pxe-init-generated dnsmasq.conf -- all safe because the writer runs in an earlier container through a whole-directory mount. dbsync.sh had only its one kolla-specific line (sudo -E kolla_set_configs) removed. Jira: OSPRH-33504 Jira: OSPRH-33503 Depends-On: openstack-k8s-operators/lib-common#728 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
thanks, I rebased it |
|
|
||
| args := []string{"-c", DBSyncCommand} | ||
|
|
||
| envVars := map[string]env.Setter{} |
There was a problem hiding this comment.
Could probably drop this since it's not used anymore, but I'm fine with leaving it and having someone clean it up later if they want.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abays, stuggi The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5247e6e
into
openstack-k8s-operators:main
Replaces the kolla_start/kolla_set_configs/config.json staging pattern with direct volume mounts to final config paths and direct service commands, across ironic-api, ironic-conductor, ironic-inspector, ironic-neutron-agent, and both db-sync jobs.
RBAC: IronicAPI/Conductor/Inspector/NeutronAgent share one ServiceAccount/Role when owned by the parent Ironic CR, so they cannot get independently different SCC grants. The shared Role grants anyuid;privileged;nonroot-v2 -- conductor/inspector genuinely need anyuid+privileged for PXE chroot (SYS_CHROOT/SETFCAP) and DHCP/TFTP sub-1024-port binding (NET_ADMIN/NET_RAW), while nonroot-v2 is included to match every other operator in the effort.
Mixed-privilege pods (conductor, inspector) carry a pod-level RestrictivePodSecurityContext for their non-root siblings, with dnsmasq and pxe-init explicitly overriding RunAsUser/RunAsNonRoot back to root on their own container SecurityContext. Both dnsmasq and pxe-init Drop ALL capabilities first, then add back only the specific caps they need (NET_ADMIN/NET_RAW for dnsmasq, SYS_CHROOT/SETFCAP for pxe-init).
AutomountServiceAccountToken set to false on all workloads including conductor -- get_net_ip reads network status from the DownwardAPI volume (/etc/podinfo/network-status), not from the k8s API.
Writable paths:
Config secret DefaultMode tightened from 0640 to 0440.
Also fixes: the standard TLS cert/key staging-path bug on ironic-api's and ironic-inspector's httpd; httpd.conf User/Group changed from apache to ironic on ironic-api specifically, matching its pre-existing WSGIDaemonProcess user=ironic evidence, while ironic-inspector's proxy httpd and both httpboot instances keep apache (no such evidence).
Config delivery uses three variants of the EmptyDir-seed pattern: plain final-path Secret SubPath mounts, a single merged file written by the init container's crudini-merge step
(03-init-container-conductor.conf), and a dynamically pxe-init-generated dnsmasq.conf -- all safe because the writer runs in an earlier container through a whole-directory mount.
dbsync.sh had only its one kolla-specific line
(sudo -E kolla_set_configs) removed.
Jira: OSPRH-33504
Jira: OSPRH-33503
Depends-On: openstack-k8s-operators/lib-common#728
Describe your changes
Jira Ticket Link
Jira:
Checklist before requesting a review
pre-commit run --all