-
Notifications
You must be signed in to change notification settings - Fork 62
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
Auto-adjust the API version of the PodSecurityConfiguration resource based on the cluster k8s version #172
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jiaqiluo
commented
Jan 9, 2023
@@ -270,15 +259,3 @@ func (v *Validator) validatePSP(request *admission.Request) (*admissionv1.Admiss | |||
|
|||
return admission.ResponseAllowed(), nil | |||
} | |||
|
|||
func getClusterVersion(version string) (semver.Version, error) { |
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.
Note to reviewer:
Code refactor, this function is moved to pkg/podsecurityadmission/podsecurityadmission.go
jiaqiluo
force-pushed
the
fix-psa-api-version
branch
from
January 9, 2023 01:05
cd69b03
to
f3a3043
Compare
HarrisonWAffel
previously approved these changes
Jan 9, 2023
KevinJoiner
suggested changes
Jan 9, 2023
jiaqiluo
force-pushed
the
fix-psa-api-version
branch
2 times, most recently
from
January 9, 2023 21:54
e71d097
to
81c3e2b
Compare
…based on the cluster k8s version
jiaqiluo
force-pushed
the
fix-psa-api-version
branch
from
January 9, 2023 22:08
81c3e2b
to
a71f0ab
Compare
KevinJoiner
approved these changes
Jan 9, 2023
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.
LGTM
HarrisonWAffel
approved these changes
Jan 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue rancher/rancher#39992
Problem:
Different API versions for
PodSecurityConfiguration
is used in different k8s versions: the API versionv1beta1
is used in k8s 1.23 and 1.24;v1
is used in k8s 1.25 and above.Previously, the mutator used version
v1
when mutating RKE1 1.23 and 1.24 clusters, which failed to provision clusters due to the error ofAPI version is unknown
.Fix:
This PR allows the mutator to auto-adjust the API version of the PodSecurityConfiguration resource based on the cluster k8s version.
Tests:
The test is done by running the webhook locally and pointing it to a Rancher setup. The provision of the RKE1 cluster with k8s version 1.23, 1,24, and 1,25 all succeed.