Repository navigation
EPMDEDP-17422: fix: Grant the RBAC that controller references need - #325
Open
geekhubuser wants to merge 1 commit into
Open
geekhubuser wants to merge 1 commit into
geekhubuser wants to merge 1 commit into
Conversation
- Grant update on stages/finalizers: the CDStageDeploy created for a Stage carries a controller reference to it with blockOwnerDeletion - Declare delete on secrets at the GitServer controller, which changes the owner references of its credential Secret - Mirror stages/finalizers into the chart Role - Add an envtest guard with OwnerReferencesPermissionEnforcement over config/rbac and the chart Role, with a negative row - Document the grants a new ownerReference write needs in CLAUDE.md
Collaborator
Pipeline
|
| Status | Task | Duration |
|---|---|---|
| ✓ Passed | github-set-pending-status | 5s |
| ✓ Passed | fetch-repository | 17s |
| ✓ Passed | init-values | 7s |
| ✓ Passed | get-cache | 2m9s |
| ✓ Passed | commit-validate | 6s |
| ✓ Passed | dockerfile-lint | 8s |
| ✓ Passed | helm-lint | 5s |
| ✓ Passed | helm-docs | 15s |
| ✓ Passed | build | 52s |
| ✓ Passed | sonar | 27s |
| ✓ Passed | save-cache | 2m17s |
| ✗ Failed | buildkit-build | 12s |
| ✓ Passed | github-report-pipeline-status | 7s |
Pushing new commits re-runs this pipeline automatically.
To re-run it without new commits, comment/recheck.
✗ buildkit-build / build-and-push — exit code 1, last 100 log lines
2026/10/22 10:59:24 warning: unsuccessful cred copy: ".docker" from "/tekton/creds" to "/root": unable to open destination: open /root/.docker/config.json: read-only file system
time="2026-10-22T10:59:28Z" level=info msg="auto snapshotter: using overlayfs"
time="2026-10-22T10:59:28Z" level=info msg="found worker \"e38dche9ci84c1hrr8tn4kvrb\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:review-codebase-operator-master-cn8f5-buildkit-build-pod org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/amd64/v4 linux/386]"
time="2026-10-22T10:59:28Z" level=warning msg="skipping containerd worker, as \"/run/containerd/containerd.sock\" does not exist"
time="2026-10-22T10:59:28Z" level=info msg="found 1 workers, default=\"e38dche9ci84c1hrr8tn4kvrb\""
time="2026-10-22T10:59:28Z" level=warning msg="currently, only the default worker can be used."
time="2026-10-22T10:59:28Z" level=info msg="running server on /run/buildkit/buildkitd.sock"
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 964B done
#1 DONE 0.0s
#2 [linux/amd64 internal] load metadata for docker.io/library/alpine:3.18.12
#2 ...
#3 [auth] library/alpine:pull token for registry-1.docker.io
#3 DONE 0.0s
#4 [linux/arm64 internal] load metadata for docker.io/library/alpine:3.18.12
#4 DONE 1.1s
#2 [linux/amd64 internal] load metadata for docker.io/library/alpine:3.18.12
#2 DONE 1.1s
#5 [internal] load .dockerignore
#5 transferring context: 2B done
#5 DONE 0.0s
#6 [internal] load build context
#6 ...
#7 [linux/arm64 1/8] FROM docker.io/library/alpine:3.18.12@sha256:de0eb0b3f2a47ba1eb89389859a9bd88b28e82f5826b6969ad604979713c2d4f
#7 resolve docker.io/library/alpine:3.18.12@sha256:de0eb0b3f2a47ba1eb89389859a9bd88b28e82f5826b6969ad604979713c2d4f 0.0s done
#7 sha256:95459497489f07b9d71d294c852a09f9bbf1af51bb35db752a31f6f48935e293 3.34MB / 3.34MB 0.1s done
#7 DONE 0.2s
#6 [internal] load build context
#6 ...
#8 [linux/amd64 1/8] FROM docker.io/library/alpine:3.18.12@sha256:de0eb0b3f2a47ba1eb89389859a9bd88b28e82f5826b6969ad604979713c2d4f
#8 resolve docker.io/library/alpine:3.18.12@sha256:de0eb0b3f2a47ba1eb89389859a9bd88b28e82f5826b6969ad604979713c2d4f 0.0s done
#8 sha256:44cf07d57ee4424189f012074a59110ee2065adfdde9c7d9826bebdffce0a885 3.42MB / 3.42MB 0.1s done
#8 extracting sha256:44cf07d57ee4424189f012074a59110ee2065adfdde9c7d9826bebdffce0a885 0.1s done
#8 DONE 0.3s
#7 [linux/arm64 1/8] FROM docker.io/library/alpine:3.18.12@sha256:de0eb0b3f2a47ba1eb89389859a9bd88b28e82f5826b6969ad604979713c2d4f
#7 extracting sha256:95459497489f07b9d71d294c852a09f9bbf1af51bb35db752a31f6f48935e293 0.1s done
#7 DONE 0.3s
#6 [internal] load build context
#6 transferring context: 113.88MB 0.9s done
#6 ...
#9 [internal] load build context
#9 transferring context: 107.23MB 0.9s done
#9 DONE 1.3s
#6 [internal] load build context
#6 DONE 1.3s
#10 [linux/amd64 2/8] RUN apk add --no-cache ca-certificates=20241121-r1 openssh-client==9.3_p2-r3 git==2.40.4-r0
#10 0.197 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
#10 0.276 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
#10 0.388 ERROR: unable to select packages:
#10 0.389 ca-certificates-20261020-r0:
#10 0.389 breaks: world[ca-certificates=20241121-r1]
#10 0.389 satisfies: libcurl-8.12.1-r0[ca-certificates]
#10 ERROR: process "/bin/sh -c apk add --no-cache ca-certificates=20241121-r1 openssh-client==9.3_p2-r3 git==2.40.4-r0" did not complete successfully: exit code: 3
#11 [linux/arm64 2/8] RUN apk add --no-cache ca-certificates=20241121-r1 openssh-client==9.3_p2-r3 git==2.40.4-r0
#11 0.247 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/aarch64/APKINDEX.tar.gz
#11 0.661 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/aarch64/APKINDEX.tar.gz
#11 1.193 (1/16) Installing ca-certificates (20241121-r1)
#11 1.215 (2/16) Installing brotli-libs (1.0.9-r14)
#11 1.248 (3/16) Installing libunistring (1.1-r1)
#11 1.291 (4/16) Installing libidn2 (2.3.4-r1)
#11 1.321 (5/16) Installing nghttp2-libs (1.57.0-r0)
#11 1.327 (6/16) Installing libpsl (0.21.5-r0)
#11 1.332 (7/16) Installing libcurl (8.12.1-r0)
#11 1.352 (8/16) Installing libexpat (2.7.0-r0)
#11 CANCELED
time="2026-10-22T10:59:32Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = process \"/bin/sh -c apk add --no-cache ca-certificates=20241121-r1 openssh-client==9.3_p2-r3 git==2.40.4-r0\" did not complete successfully: exit code: 3" spanID=602f8d221d652ad5 traceID=66593dd805d894539b788de5ff3db1a6
------
> [linux/amd64 2/8] RUN apk add --no-cache ca-certificates=20241121-r1 openssh-client==9.3_p2-r3 git==2.40.4-r0:
0.197 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
0.276 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
0.388 ERROR: unable to select packages:
0.389 ca-certificates-20261020-r0:
0.389 breaks: world[ca-certificates=20241121-r1]
0.389 satisfies: libcurl-8.12.1-r0[ca-certificates]
------
Dockerfile:12
--------------------
11 |
12 | >>> RUN apk add --no-cache ca-certificates=20241121-r1 \
13 | >>> openssh-client==9.3_p2-r3 \
14 | >>> git==2.40.4-r0
15 |
--------------------
error: failed to solve: process "/bin/sh -c apk add --no-cache ca-certificates=20241121-r1 openssh-client==9.3_p2-r3 git==2.40.4-r0" did not complete successfully: exit code: 3
8 of 11 tasks
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
With the kube-apiserver admission plugin
OwnerReferencesPermissionEnforcement(on by default on OpenShift), 2.36.0 cannot create the CDStageDeploy of an Auto Environment:The CDStageDeploy carries a controller reference to its Stage (
put_cd_stage_deploy.go:242), and the plugin then requiresupdateonstages/finalizers. EPMDEDP-17305 rebuilt the Role from the markers, and no marker declared this permission, because no API call needs it. 2.35.0 had it through the hand-written Role.This change adds the marker at the CodebaseImageStream controller, regenerates
config/rbac/role.yaml, and mirrors the rule into the chart Role. The GitServer controller now also declares thedeleteon secrets it needs when it changes the owner references of its credential Secret. Today that grant comes only from the Codebase controller's marker.Because the call-site rule cannot see grants that only the admission plugin consumes, a guard test checks them.
controllers/rbac_test.gostarts envtest with the plugin and bindsconfig/rbac/role.yamland the chart Role, each in a namespace of its own, to a non-admin user. It then writes every owner reference the controllers set, and includes a negative row.CLAUDE.mdgets the matching convention line.Fixes EPMDEDP-17422 (codebase-operator part; the cd-pipeline-operator part is a separate PR)
Type of change
How Has This Been Tested?
kind (Kubernetes 1.36.4) with
OwnerReferencesPermissionEnforcementon, both operators from their EPMDEDP-17422 branches. For the codebase-operator image, the branch binary was put on the 2.36.0 image, because the Dockerfile's pinned Alpine packages no longer install. The fix itself is the Role.cdstagedeployments ... is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on, no CDStageDeployStage/app-dev,blockOwnerDeletion: trueUnit checks in
golang:1.26(Go 1.26.9):Stage controls a new CDStageDeployfails, in both Roles, with the production errorstages/finalizersremoved from one Role onlyStage controls a new CDStageDeployfailsmake testmake lintmake manifestsstages/finalizersline inconfig/rbac/role.yaml; no driftChecklist: