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

Add disallow interactive tty constraint #305

Conversation

tspearconquest
Copy link
Contributor

What this PR does / why we need it:
Adds a constraint to disallow deployment of pods with containers where the fields related to interactive sessions, such as stdin, and tty, are set to true

Special notes for your reviewer:

@tspearconquest
Copy link
Contributor Author

I've tested this in my cluster. Gitlab runners use tty: true, and with a constraint applied against this template, the gitlab runner job pods are rejected by Gatekeeper. :)

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, thanks for the contribution!

Not sure if the artifact hub generation stuff is supposed to happen later.

@maxsmythe
Copy link
Contributor

It looks like this command needs to be run: Please run 'make generate generate-website-docs generate-artifacthub-artifacts' to generate the templates and docs

@tspearconquest
Copy link
Contributor Author

Thanks, yes I am doing this now.

@tspearconquest
Copy link
Contributor Author

Done, and pushed.

@tspearconquest
Copy link
Contributor Author

Checking on the new failures...

@@ -4,7 +4,7 @@ metadata:
name: k8shorizontalpodautoscaler
annotations:
metadata.gatekeeper.sh/title: "Horizontal Pod Autoscaler"
metadata.gatekeeper.sh/version: 1.0.0
Copy link
Member

Choose a reason for hiding this comment

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

did you mean to make these changes for this policy?

@tspearconquest
Copy link
Contributor Author

tspearconquest commented Apr 7, 2023 via email

@ritazh
Copy link
Member

ritazh commented Apr 7, 2023

@tspearconquest the change bumps the patch version. might be good to revert it for now since the horizontalpodautoscaler policy is not in the right place. xref #314

Thomas Spear and others added 11 commits April 6, 2023 21:19
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
* remove skip for storage class

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

* revert timestamp

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

---------

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
* fix: disallowed repos sample test name

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

* fix tests

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

---------

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
* feat: add HorizontalPodAutoscaler policy

Signed-off-by: Craig Trought <k8s@trought.ca>

* chore: add metadata for artifacts

Signed-off-by: Craig Trought <k8s@trought.ca>

* chore: generate artifacts

Signed-off-by: Craig Trought <k8s@trought.ca>

* fix: remove sample constraint

Signed-off-by: Craig Trought <k8s@trought.ca>

* core: add requiresSyncData metadata

Signed-off-by: Craig Trought <k8s@trought.ca>

* add hpa policy to kustomize

Signed-off-by: Craig Trought <k8s@trought.ca>

---------

Signed-off-by: Craig Trought <k8s@trought.ca>
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
Co-authored-by: Max Smythe <smythe@google.com>
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
)

Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
…ts' again

Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
…-artifacts' again"

This reverts commit 673a63a.

Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
…-artifacts'"

This reverts commit 54b069c.

Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
@tspearconquest tspearconquest force-pushed the add_disallow_interactive_tty_constraint branch from 5cb4eae to 0547a50 Compare April 7, 2023 02:19
Thomas Spear and others added 2 commits April 7, 2023 01:47
@ritazh
Copy link
Member

ritazh commented Apr 13, 2023

@nilekhc can you pls help take a look at all the CI failures to make sure they are failing correctly? e.g. panic: looks like template.yaml is updated but the version is not. Please update the 'metadata.gatekeeper.sh/version' annotation in the template.yaml source and if so, what needs to be fixed?

@JaydipGabani
Copy link
Contributor

@tspearconquest can you try deleting artifact-hub/library/general/disallowinteractive dir from your local and then run make generate generate-website-docs generate-artifacthub-artifacts? it should solve ci error.

Thomas Spear and others added 4 commits April 27, 2023 16:41
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
…tspearconquest/gatekeeper-library into add_disallow_interactive_tty_constraint
@nilekhc
Copy link
Contributor

nilekhc commented May 4, 2023

@nilekhc can you pls help take a look at all the CI failures to make sure they are failing correctly? e.g. panic: looks like template.yaml is updated but the version is not. Please update the 'metadata.gatekeeper.sh/version' annotation in the template.yaml source and if so, what needs to be fixed?

Thanks for reporting this @ritazh! I have opened #339 to fix it.

@apeabody
Copy link
Contributor

Hi @tspearconquest - #339 has been merged, can you please try a fresh 'make generate generate-website-docs generate-artifacthub-artifacts' to generate the templates and docs. Cheers!

@tspearconquest
Copy link
Contributor Author

Hello, apologies for my delay, as I was on leave for the last 2 weeks. I am doing it now.

Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
@tspearconquest
Copy link
Contributor Author

Ok, it's pushed and it looks like tests have passed. Please take a look. Thanks again!

@maxsmythe
Copy link
Contributor

@ritazh LGTY?

@stale
Copy link

stale bot commented Sep 19, 2023

This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 19, 2023
@tspearconquest
Copy link
Contributor Author

Any update on this?

@stale stale bot removed the stale label Sep 19, 2023
Copy link

stale bot commented Nov 25, 2023

This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 25, 2023
@tspearconquest
Copy link
Contributor Author

Not stale...

/help

@stale stale bot removed the stale label Nov 27, 2023
@apeabody apeabody requested a review from a team as a code owner November 27, 2023 16:40
@nilekhc nilekhc merged commit 2d99845 into open-policy-agent:master Dec 6, 2023
15 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.

8 participants