Skip to content

chore: remove PSP and migrate to PSA#2174

Merged
sozercan merged 14 commits into
open-policy-agent:masterfrom
sozercan:remove-psp
Aug 1, 2022
Merged

chore: remove PSP and migrate to PSA#2174
sozercan merged 14 commits into
open-policy-agent:masterfrom
sozercan:remove-psp

Conversation

@sozercan
Copy link
Copy Markdown
Member

@sozercan sozercan commented Jul 15, 2022

Signed-off-by: Sertac Ozercan sozercan@gmail.com
What this PR does / why we need it:

  • remove PSP since it's going to be removed in v1.25 in static yaml deployment.
  • for Helm, If policy/v1beta1 API exists (k8s < 1.25), PSP will still be deployed using psp.enabled value (enabled by default).
  • update PDB to policy/v1 by default
  • update to use seccompProfile instead of seccomp annotations. This can be turned off with Helm since it might cause issues with OpenShift
  • add restricted pod security standards for audit/warn/enforce in gatekeeper-system.

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

Special notes for your reviewer:
Since Helm creates the namespace, we can't add PSA annotations. Should that be part of docs or maybe we can do this with a helm hook?

Added a post-install helm hook. However, pre-install helm hook will be triggered too early (before namespace creation) and post-install will be too late (after deployment), but we'll have labels in the GK namespace after post-install.

sozercan added 2 commits July 15, 2022 22:42
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
@sozercan sozercan requested review from maxsmythe and ritazh July 15, 2022 23:33
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
@sozercan sozercan marked this pull request as draft July 16, 2022 00:03
@ritazh
Copy link
Copy Markdown
Member

ritazh commented Jul 16, 2022

remove PSP since it's going to be removed in v1.25

For k8s versions < v1.25, users might still need PSP. Maybe conditionally delete it based on k8s version?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 16, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.49%. Comparing base (4ca9d10) to head (6d7c748).
Report is 861 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2174      +/-   ##
==========================================
+ Coverage   54.44%   54.49%   +0.05%     
==========================================
  Files         111      111              
  Lines        9529     9529              
==========================================
+ Hits         5188     5193       +5     
+ Misses       3945     3941       -4     
+ Partials      396      395       -1     
Flag Coverage Δ
unittests 54.49% <ø> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sozercan
Copy link
Copy Markdown
Member Author

sozercan commented Jul 16, 2022

Maybe conditionally delete it based on k8s version?

@ritazh updated the PR description to clarify we are deploying PSP if psp.enabled value is enabled (which is true by default) and policy/v1beta1 API is present (true for k8s < 1.25). However, we can't do this for static yaml.

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
@sozercan sozercan marked this pull request as ready for review July 16, 2022 02:45
Comment thread cmd/build/helmify/static/templates/namespace-post-install.yaml Outdated
sozercan and others added 2 commits July 25, 2022 20:28
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copy link
Copy Markdown
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

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
"pod-security.kubernetes.io/warn=restricted",
"pod-security.kubernetes.io/warn-version=latest",
"pod-security.kubernetes.io/enforce=restricted",
"pod-security.kubernetes.io/enforce-version=v1.24"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we get it via Capabilities.KubeVersion.Version

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we know we are compatible with 1.24, but we won't know it for future versions. That's why enforce is pinned while audit and warn is latest

Copy link
Copy Markdown
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

@sozercan sozercan merged commit 52db6a7 into open-policy-agent:master Aug 1, 2022
@sozercan sozercan deleted the remove-psp branch August 1, 2022 23:01
@sathieu
Copy link
Copy Markdown
Contributor

sathieu commented Oct 21, 2022

Some parts are missing, see #2351

@srmars
Copy link
Copy Markdown

srmars commented Aug 1, 2023

@sozercan @ritazh
We are trying upgrade gatekeeper from 3.11.0 to 3.11.1 but we are getting below error in kubernets version 1.25. previously gatekeeper version 3.11.0 running in kubernets version 1.24 and recently we upgraded our cluster to 1.25.

Before running helm upgrade, updated psp to false in values.yaml

https://github.com/open-policy-agent/gatekeeper/blob/v3.11.1/charts/gatekeeper/values.yaml#L237

Error: UPGRADE FAILED: current release manifest contains removed kubernetes api(s)
for this kubernetes version and it is therefore unable to build the kubernetes
objects for performing the diff. error from
kubernetes: unable to recognize "":
no matches for kind "PodSecurityPolicy”

Kindly let me know, am I missing anything.

@fopni01
Copy link
Copy Markdown

fopni01 commented Sep 6, 2023

I have the same issue @srmars . Want to redeploy gate-keeper with helm chart on a v1.25 k8s cluster.

@KevinHuang40856
Copy link
Copy Markdown

@srmars
Copy link
Copy Markdown

srmars commented Sep 4, 2024 via email

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.

API version policy/v1beta1 is deprecated and will be unavailable from v1.25+ -- PodSecurityPolicy

8 participants