Repository navigation
feat(k8s): admission policy for the Service Jobs - #2730
Merged
Merged
Conversation
Owner
Author
|
Test results and review record.
Review findings fixed:
Review points not fixed:
|
dan-petty
marked this pull request as ready for review
October 30, 2026 01:22
dan-petty
pushed a commit
that referenced
this pull request
Oct 30, 2026
🤖 I have created a release *beep* *boop* --- ## [0.22.0](v0.21.4...v0.22.0) (2026-10-30) ### Features * **k8s:** admission policy for the Service Jobs ([#2730](#2730)) ([4be83c2](4be83c2)), closes [#2696](#2696) ### Bug Fixes * **security:** refuse the uv and npm keys that run a program ([#2749](#2749)) ([c5a4596](c5a4596)), closes [#2673](#2673) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.
The Role
roadmap-service-jobslets the roadmap Service create any Job in namespacedevops. Kubernetes RBAC cannot limitcreateto a name. Pod Securityrestrictedonly warns about a Job and refuses its pod later. So a Job of the Service could name any image, any ServiceAccount of the namespace, any other Secret or any volume thatrestrictedadmits.This change adds a ValidatingAdmissionPolicy and a binding (
k8s/devops/roadmap-service/admissionpolicy.yaml). The policy applies only to the usersystem:serviceaccount:devops:roadmap-service. It never evaluates a Job of another identity. It refuses a Job of the Service unless:command, and the image is the runner repository, alone or with a tag or a digest;devops-cliwith no token;envFromnames only Secretdevops-cli, and noenventry usesvalueFrom;tmp,homeandconfig;priorityClassName, nonodeNameand noimagePullSecrets;app.kubernetes.io/nameisdevops-cli-job, so a Job pod cannot take the label of the Service and the egress to the API server that a NetworkPolicy gives it;manualSelector, runs its pod once, never retries, and ends after 7200 seconds at most.failurePolicyisFail, and the actions areDenyandAudit. The policy runs in the API server, so no webhook can be down.A test renders
k8s/devopsand runs the CEL of the policy withcel-expr-python(a dev dependency) against the Job that CronJobdevops-cli-runnermakes. It also runs the policy against the same Job changed in one way for each rule. A change of the template that the policy refuses fails in CI.k8s/README.mdlists what the policy pins and what it leaves free.Closes #2696