Skip to content
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

ValidatingAdmissionPolicy: typed variables support. #121001

Conversation

jiahuif
Copy link
Member

@jiahuif jiahuif commented Oct 4, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds tracking of the type of each compiled composition variable for further compilation in following variables and validation expressions.

Which issue(s) this PR fixes:

Fixes #120239

Special notes for your reviewer:

Does this PR introduce a user-facing change?

ValidatingAdmissionPolicy now preserves types of composition variables, and raise type-related errors early.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 4, 2023
@k8s-ci-robot k8s-ci-robot added area/apiserver area/test sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 4, 2023
@jiahuif jiahuif force-pushed the feature/validating-admission-policy/typed-composition-variables branch from 3a4ace7 to 8b80ca6 Compare October 5, 2023 00:17
@cici37
Copy link
Contributor

cici37 commented Oct 5, 2023

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 5, 2023
@jiahuif jiahuif force-pushed the feature/validating-admission-policy/typed-composition-variables branch from 8b80ca6 to 49cfb3d Compare October 5, 2023 20:09
@jiahuif
Copy link
Member Author

jiahuif commented Oct 5, 2023

/test pull-kubernetes-e2e-kind-alpha-features

@cici37
Copy link
Contributor

cici37 commented Oct 5, 2023

/lgtm
This approach looks good to me. Please also cherry-pick the changes into 1.28 when it's merged. Thank you!
/approve

/assign @jpbetz
for approval. Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 5, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 129b1eb867fe8f68be59182ee8cd87017996bac3

@@ -196,3 +197,39 @@ func (a *variableAccessor) Callback(_ *lazy.MapValue) ref.Val {
}
return v
}

func convertCelTypeToDeclType(celType *cel.Type) *apiservercel.DeclType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to capture type params?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is! Added support for type params.

However, note that the object is still Dyn so any access to its field remains Dyn.

@jiahuif jiahuif force-pushed the feature/validating-admission-policy/typed-composition-variables branch from 49cfb3d to 826b44b Compare October 9, 2023 22:34
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 9, 2023
@jiahuif jiahuif force-pushed the feature/validating-admission-policy/typed-composition-variables branch from 826b44b to c03579b Compare October 9, 2023 22:37
@jpbetz
Copy link
Contributor

jpbetz commented Oct 13, 2023

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 13, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: fb4efbe54eb715c28baeac3ce410efd4412caf5d

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cici37, jiahuif, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 13, 2023
@k8s-ci-robot k8s-ci-robot merged commit b87cae9 into kubernetes:master Oct 13, 2023
15 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.29 milestone Oct 13, 2023
@jiahuif jiahuif deleted the feature/validating-admission-policy/typed-composition-variables branch October 16, 2023 16:40
@cici37
Copy link
Contributor

cici37 commented Oct 17, 2023

@jiahuif Would you open the cherry pick for this one as well? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
4 participants