-
Notifications
You must be signed in to change notification settings - Fork 39.7k
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
generic ephemeral volume GA #105609
generic ephemeral volume GA #105609
Conversation
The name concatenation and ownership check were originally considered small enough to not warrant dedicated functions, but the intent of the code is more readable with them.
The name concatenation and ownership check were originally considered small enough to not warrant dedicated functions, but the intent of the code is more readable with them.
1dc06f8
to
23f29fe
Compare
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/assign @xing-yang |
@pohly in the PR description, I think the hyperlink to the KEP is incorrect. |
@sftim: What is the correct link? The template only says |
The repo was wrong (pohly vs, kubernetes). Fixed. |
pvcSource.ClaimName, | ||
) | ||
if isEphemeral { | ||
if err := ephemeral.VolumeIsForPod(pod, pvc); err != nil { |
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.
The condition to throw an error was changed from:
ephemeral && !metav1.IsControlledBy(pvc, pod)
to
ephemeral && (pvc.Namespace != pod.Namespace || !metav1.IsControlledBy(pvc, pod))
I guess this is ok because the caller shouldn't pass a PVC that isn't from the same namespace as the pod as you pointed out
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.
Correct. ephemeral.VolumeIsForPod
is more thorough because it's a general-purpose function that doesn't know whether the namespaces match. The semantic is the same.
AllowEphemeralVolumeType: utilfeature.DefaultFeatureGate.Enabled(features.GenericEphemeralVolume) || | ||
volumeInUse(old.(*policy.PodSecurityPolicy), policy.Ephemeral), | ||
} | ||
opts := validation.PodSecurityPolicyValidationOptions{} |
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.
This became:
AllowEphemeralVolumeType: true || volumeInUse(old.(*policy.PodSecurityPolicy), policy.Ephemeral)
So it makes sense that AllowEphemeralVolumeType
is removed
@@ -94,9 +94,6 @@ var ValidatePodSecurityPolicyName = apimachineryvalidation.NameIsDNSSubdomain | |||
|
|||
// PodSecurityPolicyValidationOptions contains additional parameters for ValidatePodSecurityPolicy. | |||
type PodSecurityPolicyValidationOptions struct { | |||
// AllowEphemeralVolumeType determines whether Ephemeral is a valid entry | |||
// in PodSecurityPolicySpec.Volumes. | |||
AllowEphemeralVolumeType bool | |||
} |
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.
If PodSecurityPolicyValidationOptions is always empty, is this still needed?
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.
Not now, but it may be needed again in the future. Therefore I kept it. Not removing it also avoids additional churn due to function prototype changes.
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.
I've pushed a commit which removes the struct. It's intentionally a separate commit to support reverting.
/milestone v1.23 |
Since the only member of that struct is gone, the struct itself can also be removed. If for whatever reason the struct is needed again, then this commit can be reverted to bring it back.
/lgtm |
/assign @thockin |
I updated those tests. They now run as "Volume Metrics Ephemeral" in https://testgrid.kubernetes.io/sig-storage-kubernetes#gce-serial. The recent test failures in that job are unrelated (#105965). |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pohly, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Generic ephemeral volume has met the GA criteria and is meant to graduate to GA in 1.23.
Special notes for your reviewer:
This contains two other minor PRs that were still pending when creating this PR:
Some other locations where the helper functions could be used were found when removing the feature gate.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: