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

feat: add other policies in CEL expressions - Part 6 #970

Merged
merged 50 commits into from
Jun 6, 2024

Conversation

Chandan-DK
Copy link
Contributor

@Chandan-DK Chandan-DK commented Apr 17, 2024

Related Issue(s)

Partially addresses #891

Description

This PR includes the conversion of policies in the other folder to Kyverno CEL policies. Conversion of the policies is done in multiple PRs

Policies converted in this PR:

  • restrict-loadbalancer
  • restrict-networkpolicy-empty-podselector
  • restrict-node-affinity
  • restrict-sa-automount-sa-token
  • restrict-secret-role-verbs
  • restrict-secrets-by-name
  • restrict-service-port-range
  • restrict-storageclass
  • restrict-usergroup-fsgroup-id
  • restrict-wildcard-resources
  • restrict-wildcard-verbs

Checklist

  • [] I have read the policy contribution guidelines.
  • [] I have added test manifests and resources covering both positive and negative tests that prove this policy works as intended.
  • [] I have added the artifacthub-pkg.yml file and have verified it is complete and correct.

Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
@Chandan-DK Chandan-DK marked this pull request as ready for review April 21, 2024 15:24
@MariamFahmy98 MariamFahmy98 self-assigned this Apr 23, 2024
@MariamFahmy98 MariamFahmy98 self-requested a review April 23, 2024 15:14
Copy link
Contributor

@MariamFahmy98 MariamFahmy98 left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me. I have just added a minor comment.

@MariamFahmy98
Copy link
Contributor

@Chandan-DK - Could you please resolve the conflicts?

Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
Signed-off-by: Chandan-DK <chandandk468@gmail.com>
@Chandan-DK
Copy link
Contributor Author

While resolving the merge conflict caused due to PR #1025, I realized that a Role and ClusterRole can be created by either omitting or keeping rules empty (https://github.com/kyverno/policies/pull/1025/files#diff-d8ebec1f6fac7038fbd1ecdea4d1797a84639e2fc96377af0537e5bc074fa200R1-R24). When it is created in this manner in the cluster, it will be set to rules: null by default. I've modified the policies to account for this behaviour and I've added for tests it.

@MariamFahmy98
Copy link
Contributor

While resolving the merge conflict caused due to PR #1025, I realized that a Role and ClusterRole can be created by either omitting or keeping rules empty (https://github.com/kyverno/policies/pull/1025/files#diff-d8ebec1f6fac7038fbd1ecdea4d1797a84639e2fc96377af0537e5bc074fa200R1-R24). When it is created in this manner in the cluster, it will be set to rules: null by default. I've modified the policies to account for this behaviour and I've added for tests it.

Good catch.

@MariamFahmy98 MariamFahmy98 merged commit 35b992d into kyverno:main Jun 6, 2024
185 checks passed
@Chandan-DK Chandan-DK deleted the other-policies-cel-part-6 branch June 6, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants