-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KEP-3962: Mutating admission policy documentation #48646
Conversation
👷 Deploy Preview for kubernetes-io-vnext-staging processing.
|
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
/retitle [WIP] KEP-3962: Mutating admission policy documentation Sounds like this is not yet ready for review, so I'll mark it as a draft. @Jefftree if you can get it ready, that's helpful. |
8eda9d5
to
4b59719
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
For technical content for alpha
LGTM label has been added. Git tree hash: fa93e23869f2228fea584e83482f736326d923c0
|
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments addressed @tengqm
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It's good to have this doc ready for review on schedule.
We try to avoid putting tutorials and conceptual explanations into the docs reference section, so I'd love to see changes to this PR.
Please consider rewording https://kubernetes.io/docs/concepts/policy/#apply-policies-using-validatingadmissionpolicy to mention mutating admission policies too. This change is important.
For beta (and ideally even for alpha), we should (as in could, not must) turn this guide-style explanation into:
- a tutorial that helps people try out VAP and MAP in their toy cluster
- yes, I mean one combined tutorial that teaches both kinds of admission policies
- yes, I know that ValidatingAdmissionPolicy is GA and MutatingAdmissionPolicy is alpha; that's OK
- a shorter reference explanation of MutatingAdmissionPolicy, to live within the reference pages
Please consider doing or supporting that work eventually, @Jefftree. "Supporting" need not mean you do the work; it could be more around putting out a call for help.
As an opinion, but also the opinion of a former tech lead, that refactoring to a tutorial would really help people learn about K8s admission.
I've added some inline feedback too. See what you think.
Here's the part of the page I'd keep for the reference section (perhaps slightly expanded):
CEL expressions have access to the types needed to create JSON patches and objects:
JSONPatch
- CEL type of JSON Patch operations. JSONPatch has the fieldsop
,from
,path
andvalue
.
See JSON patch for more details. Thevalue
field may be set to any of: string,
integer, array, map or object. If set, thepath
andfrom
fields must be set to a
JSON pointer string, where thejsonpatch.escapeKey()
CEL
function may be used to escape path keys containing/
and~
.Object
- CEL type of the resource object.Object.<fieldName>
- CEL type of object field (such asObject.spec
)Object.<fieldName1>.<fieldName2>...<fieldNameN>
- CEL type of nested field (such asObject.spec.containers
)CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:
object
- The object from the incoming request. The value is null for DELETE requests.oldObject
- The existing object. The value is null for CREATE requests.request
- Attributes of the API request.params
- Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind.namespaceObject
- The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources.variables
- Map of composited variables, from its name to its lazily evaluated value.
For example, a variable namedfoo
can be accessed asvariables.foo
.authorizer
- A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authzauthorizer.requestResource
- A CEL ResourceCheck constructed from theauthorizer
and configured with the
request resource.
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
Overall: I'm wary to approve this as-is, but @Jefftree once you have read the feedback, please feel free to make the minimum set of changes you feel are right for alpha stage. Then request a new review (you could consider the auto-assigned reviewers, @natalisucks and @reylejano). |
Hi @jpbetz 👋 ! |
@sftim comments addressed. Tried to put together a minimal set of references with a single example for applyconfiguration and json patch without too many examples making this into a tutorial. As a follow up (after docs freeze), will create a new page as a tutorial for VAP and MAP. |
9f4c382
to
413a1eb
Compare
413a1eb
to
dc3dd74
Compare
dc3dd74
to
d644849
Compare
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
request resource. | ||
|
||
The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the | ||
object. No other metadata properties are accessible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it able to check the labels of an object?
I don't mean I want to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks for catching!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, also: annotations?
a9548e2
to
54e4279
Compare
54e4279
to
d411e50
Compare
/label tide/merge-method-squash |
...nt/en/docs/reference/command-line-tools-reference/feature-gates/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
...nt/en/docs/reference/command-line-tools-reference/feature-gates/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
content/en/docs/reference/access-authn-authz/mutating-admission-policy.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Tim Bannister <tim@scalefactory.com>
b0abad3
to
d58a4e5
Compare
@sftim comments addressed, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
with a quibble
LGTM label has been added. Git tree hash: ff4ae603d81471439400e990fb183b4543a463ed
|
Docs and Tech LGTM provided above /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chanieljdan, jpbetz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* Introduce concept page for mutating admission policy * add example and documentation for MAP * fix MAP feature gate documentation * address comments * Apply suggestions from code review Co-authored-by: Tim Bannister <tim@scalefactory.com> --------- Co-authored-by: Joe Betz <jpbetz@google.com> Co-authored-by: Tim Bannister <tim@scalefactory.com>
Description
This documents KEP-3962 for the alpha release of the enhancement in 1.32
Supersedes #48467
Comments still outstanding from that PR are addressed.