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

Fix podsecuritypolicy checking for clusters below 1.25 #246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gargrag
Copy link

@gargrag gargrag commented Feb 15, 2023

Fixes #245

PSPs never graduated, and it's being deprecated and replaced by the admissioncontroller, for clusters below 1.25 this should be checked against v1beta1

Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@gargrag Thank you Gaston! I think this is not quite right. I've made a cp/paste mistake in the last drop as policy/v1/podsecuritypolicies does not (and will never!) exist. (

internal.PspGVR: "policy/v1/podsecuritypolicies",
). So I think 2 things need to happen for this fix:

  1. Revert that line to v1beta1
  2. Disable the sanitizer if k8s rev >= 1.25

Does this make sense?

@gargrag
Copy link
Author

gargrag commented Feb 16, 2023

hi @derailed , indeed, it does make a lot of sense. Thanks for the comment.
I added some changes, please lmk if you think the approach for disabling the sanitizer is the appropriate one, as I know it may be hacky.

Cheers.

if rev.Minor <= 21 {
mm[internal.PspGVR] = "policy/v1beta1/podsecuritypolicies"
if rev.Minor >= 25 {
delete(mm, internal.PspGVR)
Copy link
Author

Choose a reason for hiding this comment

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

@derailed check here, do you think this approach for disabling the sanitizer is appropriate?

Copy link
Owner

Choose a reason for hiding this comment

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

@gargrag Thank you for the update Gaston! I think this is a dup of #239. It would be better to reverse the logic here and check the server version vs having to delete after the fact imho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants