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
Kubernetes CSI - Persistent Volume Source Type #55204
Kubernetes CSI - Persistent Volume Source Type #55204
Conversation
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.
@vladimirvivien I didn't see MountInterface
was implemented for csi
in this PR.
pkg/api/types.go
Outdated
|
||
// VolumeHandle is the unique volume name returned by the CSI volume | ||
// plugin’s CreateVolume to refer to the volume on all subsequent calls. | ||
VolumeHandle string |
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.
Add // Required
for VolumeHandle
.
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.
@dixudx will add // Required
pkg/api/validation/validation.go
Outdated
if len(csi.VolumeHandle) == 0 { | ||
allErrs = append(allErrs, field.Required(fldPath.Child("volumeHandle"), "")) | ||
} | ||
|
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.
Also need to validate MountSecretRef
and AttachSecretRef
if they are not nil.
Like,
if csi.MountSecretRef != nil {
if len(csi.MountSecretRef.Name) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("MountSecretRef", "name"), ""))
}
...
}
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.
@dixudx ok good catch. Will look into this as well. Thanks.
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.
@dixudx I dbl checked, MountSecretRef
is no longer part of the API type.
/ok-to-test |
@@ -105,6 +107,7 @@ func ProbeExpandableVolumePlugins(config componentconfig.VolumeConfiguration) [] | |||
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...) | |||
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...) | |||
allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...) | |||
allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...) |
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.
fc -> csi
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.
fixed.
errfield: "driver", | ||
}, | ||
{ | ||
name: "missing volume handle", |
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.
some successful test would be nice here, both of the current ones are error cases.
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.
added couple of successful tests.
@@ -1073,6 +1073,14 @@ func printFlockerVolumeSource(flocker *api.FlockerVolumeSource, w PrefixWriter) | |||
flocker.DatasetName, flocker.DatasetUUID) | |||
} | |||
|
|||
func printCSIPersistentVolumeSource(csi *api.CSIPersistentVolumeSource, w PrefixWriter) { | |||
w.Write(LEVEL_2, "Type:\tCSIVolume (a generic volume resource that represents a volume managed by an external CSI plugin)\n"+ |
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.
CSI -> Container Storage Interface? At least for now, before it gets well-known.
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.
Added full CSI name
pkg/api/types.go
Outdated
@@ -391,6 +391,9 @@ type PersistentVolumeSource struct { | |||
// More info: https://releases.k8s.io/HEAD/examples/volumes/storageos/README.md | |||
// +optional | |||
StorageOS *StorageOSPersistentVolumeSource | |||
// CSI represents storage that handled by an external CSI driver |
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.
CSI -> Container Storage Interface?
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.
Agreed. Added full name.
pkg/api/types.go
Outdated
// This may be empty if no secret is required. If the secret object contains | ||
// more than one secret, all secrets are passed. | ||
// +optional | ||
MountSecretRef *SecretReference |
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.
did we remove secret refs in the proposal?
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.
Yes. Master branch does not have it : https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/container-storage-interface.md#proposed-api
/test pull-kubernetes-verify |
/test pull-kubernetes-unit |
1 similar comment
/test pull-kubernetes-unit |
pkg/apis/core/types.go
Outdated
// This may be empty if no secret is required. If the secret object contains | ||
// more than one secret, all secrets are passed. | ||
// +optional | ||
MountSecretRef *SecretReference |
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.
Secrets were postponed to future release, please remove them.
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.
Hmm, github still shows that MountSecretRef is present in the first commit and at the same time it shows this review remark has been resolved / relevant code has been modified.
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.
Oh, I see, you put it into the commit with generated code. Sorry for the noise.
Still, IMO it should be squashed into the first commit for further review. Nobody looks at the generated stuff.
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.
@jsafrane ah ok, that commit slipped in to the generated stuff. I will fix that. Thanks.
/lgtm @thockin for API review. |
/lgtm |
@thockin, can you please approve? It's blocking subsequent PRs. |
@@ -1318,6 +1318,19 @@ func validateStorageOSPersistentVolumeSource(storageos *core.StorageOSPersistent | |||
return allErrs | |||
} | |||
|
|||
func validateCSIPersistentVolumeSource(csi *core.CSIPersistentVolumeSource, fldPath *field.Path) field.ErrorList { | |||
allErrs := field.ErrorList{} |
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.
Please add a feature gate check:
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIPersistentVolume) {
allErrs = append(allErrs, field.Forbidden(fldPath, "field is disabled by feature-gate CSIPersistentVolume"))
}
This commit tracks source code update to support the CSI volume source type additionn.
This commit tracks all auto-generated sources.
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: saad-ali, thockin, vladimirvivien Associated issue: 178 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
[MILESTONENOTIFIER] Milestone Pull Request Needs Approval @erictune @liggitt @saad-ali @thockin @vladimirvivien @yujuhong @kubernetes/sig-storage-misc Action required: This pull request must have the Pull Request Labels
|
/test pull-kubernetes-node-e2e |
1 similar comment
/test pull-kubernetes-node-e2e |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
Automatic merge from submit-queue (batch tested with PRs 54529, 53765). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Kubernetes CSI - in-tree Plugin Implementation **What this PR does / why we need it**: This PR is part of the internal Kubernetes CSI Volume plugin. It implements the Attach/Detach/Mount/Unmount API. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: kubernetes/enhancements#178 **Special notes for your reviewer**: - Implements feature kubernetes/enhancements#178 - Designed kubernetes/community#1258 Other CSI Volume plugin PRs - CSI Persistent Volume Source - #55204 **Release note**: ```release-note NONE ```
What this PR does / why we need it:
This PR is to track the addition of new API type
CSIPersistentVolumeSource
that will be used as PersistentVolume for storage sources managed by CSI drivers.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):xref kubernetes/enhancements#178
Special notes for your reviewer:
PersistentVolume
typeCSIPersistentVolumeSource
Other CSI Volume Plugin PRs:
Release note: