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

ci: testing with cel policies #519

Merged
merged 27 commits into from
May 22, 2024

Conversation

JaydipGabani
Copy link
Contributor

What this PR does / why we need it:

  • Modifies the testing workflow to run gator verify with cel and rego engines
  • Tests cel and rego policies with gatekeeper
  • Adds cel source for requiredLables and allow-priviledge-escalation

Which issue(s) does this PR fix (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #

Special notes for your reviewer:

Signed-off-by: Jaydip Gabani <[email protected]>
@JaydipGabani JaydipGabani requested a review from a team as a code owner May 2, 2024 19:05
@JaydipGabani
Copy link
Contributor Author

@maxsmythe I added CEL source from your draft PR #503 here as well, that leaves you with 3 other policies to write CEL source for.

@@ -65,7 +65,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gatekeeper: [ "release-3.13", "release-3.14" ]
gatekeeper: [ "3.14.2", "3.15.1" ]
Copy link
Member

Choose a reason for hiding this comment

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

why do we prefer to use specific patch versions instead of the latest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, we have always tested with past two release versions. I am fine with testing it with latest, unless others have any objections.

Copy link
Member

Choose a reason for hiding this comment

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

using the branch instead of the tag ensures we are always testing against the latest patch version without having to push a PR to update it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK helm can only install specifi version, I am not sure if it can take a branch and install the latest patch on that branch. If we do not use helm, then we would need to use sed or something similar to modify the file and set the flag manually.

Copy link
Member

Choose a reason for hiding this comment

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

+1 to @JaydipGabani i think this is a better approach now since we previously installed from yaml directly

Copy link
Member

Choose a reason for hiding this comment

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

ah I see. I'm ok with merging this as is. but it would be better to not having to bump the tag all the time. @JaydipGabani you can create an issue to do it as a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

Copy link
Member

@sozercan sozercan May 3, 2024

Choose a reason for hiding this comment

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

I don't think we need to bump the patch version. We'll need to bump the minor version, which is same as today. I am not sure if there's a way we can automate that, but this can be a part of post GK release checklist

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@JaydipGabani JaydipGabani requested a review from ritazh May 2, 2024 20:33
Signed-off-by: Jaydip Gabani <[email protected]>
@JaydipGabani JaydipGabani requested a review from ritazh May 2, 2024 22:23
Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
@JaydipGabani JaydipGabani requested review from ritazh and sozercan May 3, 2024 20:55
Copy link
Member

@ritazh ritazh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

Couple comments on the CEL code. Changes to testing flow LGTM!

src/general/requiredlabels/src.cel Outdated Show resolved Hide resolved
src/general/requiredlabels/src.cel Outdated Show resolved Hide resolved
src/pod-security-policy/allow-privilege-escalation/src.cel Outdated Show resolved Hide resolved
@JaydipGabani JaydipGabani requested a review from ritazh May 9, 2024 19:58
@@ -4,7 +4,7 @@ metadata:
name: k8srequiredlabels
annotations:
metadata.gatekeeper.sh/title: "Required Labels"
metadata.gatekeeper.sh/version: 1.0.1
metadata.gatekeeper.sh/version: 1.0.2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
metadata.gatekeeper.sh/version: 1.0.2
metadata.gatekeeper.sh/version: 1.1.0

do we want to at least bump the minor version? @maxsmythe @sozercan

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense.

@ritazh ritazh mentioned this pull request May 10, 2024
Makefile Outdated Show resolved Hide resolved
Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
@maxsmythe
Copy link
Contributor

Can you drop the CEL from my draft PR? I'd rather only have one SOT for that, and just rebase/merge once the build system is ready, otherwise feedback will get clobbered.

Signed-off-by: Jaydip Gabani <[email protected]>
@ritazh
Copy link
Member

ritazh commented May 10, 2024

Can you drop the CEL from my draft PR? I'd rather only have one SOT for that, and just rebase/merge once the build system is ready, otherwise feedback will get clobbered.

Per this #519 (comment) all updates for "Allow Privilege Escalation" policy have been removed

library/general/requiredlabels/template.yaml Outdated Show resolved Hide resolved
library/general/requiredlabels/template.yaml Outdated Show resolved Hide resolved
@@ -4,7 +4,7 @@ metadata:
name: k8srequiredlabels
annotations:
metadata.gatekeeper.sh/title: "Required Labels"
metadata.gatekeeper.sh/version: 1.0.1
metadata.gatekeeper.sh/version: 1.0.2
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense.

Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
@JaydipGabani JaydipGabani requested review from maxsmythe and ritazh May 11, 2024 00:53
@ritazh
Copy link
Member

ritazh commented May 13, 2024

@JaydipGabani ptal conflicts

Signed-off-by: Jaydip Gabani <[email protected]>
Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

1 minor comment, otherwise lgtm

Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM

Was able to get some time to look!

@sozercan sozercan merged commit 192d220 into open-policy-agent:master May 22, 2024
20 checks passed
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.

4 participants