-
Notifications
You must be signed in to change notification settings - Fork 104
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
Avoid PodSecurityPolicy cleanup if the resource is not supported by Kubernetes API #688
Conversation
pkg/kubernetes/platforminfo.go
Outdated
_, ok1 := platformInfo.apiOtherVersions["PodSecurityPolicy"] | ||
_, ok2 := platformInfo.apiPreferredVersions["PodSecurityPolicy"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we name these otherExists
and preferredExists
or something clearer than ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Codecov Report
@@ Coverage Diff @@
## main #688 +/- ##
==========================================
+ Coverage 58.53% 58.65% +0.11%
==========================================
Files 149 149
Lines 17639 17650 +11
==========================================
+ Hits 10325 10352 +27
+ Misses 6700 6682 -18
- Partials 614 616 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…ubernetes API (#688) * Avoid PodSecurityPolicy cleanup if the resource is not supported by Kubernetes API.
…ubernetes API (#688) * Avoid PodSecurityPolicy cleanup if the resource is not supported by Kubernetes API.
What does this PR do?
This change addresses the Kubernetes 1.25 compatibility issue caused by Operator attempting to handle
PodDisruptionPolicy
resource not available in aforementioned version.Operator 1.0.0 deployed on v1.25 would log following error on every reconcile
Motivation
Make Operator 1.0.0 run on v1.25.
Additional Notes
This change does not solve PSP usage across Operator.
PSP resource isn't utilized/implemented (see this) and only places attempting to handle PSP were resource cleanup routines. This PR changes the logic producing list of Kinds for the cleanup - it includes PSP only if it's supported by current Kubernetes version.
Once PSP resource implementation is done additional work will be need to control PSP creation.
Describe your test plan
Tested Kubernetes version 1.24, 1.25 using Kind cluster. Deployed agent locally, installed DDA v2 with DCA, CCR enabled - confirmed no errors are thrown.