Commit 5a6c5b07 authored by Xing Yang's avatar Xing Yang

Address Tim's comments

parent 2a9cff2b
......@@ -82490,7 +82490,7 @@
}
},
"dataSource": {
"description": "If specified, volume will be prepopulated with data from the DataSource.",
"description": "If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume.",
"$ref": "#/definitions/io.k8s.api.core.v1.TypedLocalObjectReference"
},
"resources": {
......@@ -9516,7 +9516,7 @@
},
"dataSource": {
"$ref": "v1.TypedLocalObjectReference",
"description": "If specified, volume will be prepopulated with data from the DataSource."
"description": "If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume."
}
}
},
......
......@@ -6798,7 +6798,7 @@
},
"dataSource": {
"$ref": "v1.TypedLocalObjectReference",
"description": "If specified, volume will be prepopulated with data from the DataSource."
"description": "If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume."
}
}
},
......
......@@ -9520,7 +9520,7 @@
},
"dataSource": {
"$ref": "v1.TypedLocalObjectReference",
"description": "If specified, volume will be prepopulated with data from the DataSource."
"description": "If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume."
}
}
},
......
......@@ -19311,7 +19311,7 @@
},
"dataSource": {
"$ref": "v1.TypedLocalObjectReference",
"description": "If specified, volume will be prepopulated with data from the DataSource."
"description": "If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume."
}
}
},
......
......@@ -1019,7 +1019,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">dataSource</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the DataSource.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
......
......@@ -1047,7 +1047,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">dataSource</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the DataSource.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
......
......@@ -994,7 +994,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">dataSource</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the DataSource.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
......
......@@ -696,7 +696,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">dataSource</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the DataSource.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
......
......@@ -413,7 +413,9 @@ type PersistentVolumeClaimSpec struct {
// This is an alpha feature and may change in the future.
// +optional
VolumeMode *PersistentVolumeMode
// If specified, volume will be prepopulated with data from the DataSource.
// If specified, volume will be prepopulated with data from the specified data source.
// This depends on the provisioner for this volume being able to use the specified source.
// If the provisioner does not support it, it will fail to provision the volume.
// +optional
DataSource *TypedLocalObjectReference
}
......
......@@ -1501,6 +1501,9 @@ var supportedReclaimPolicy = sets.NewString(string(core.PersistentVolumeReclaimD
var supportedVolumeModes = sets.NewString(string(core.PersistentVolumeBlock), string(core.PersistentVolumeFilesystem))
var supportedDataSourceKinds = sets.NewString(string("VolumeSnapshot"))
var supportedDataSourceAPIGroups = sets.NewString(string("snapshot.storage.k8s.io"))
func ValidatePersistentVolume(pv *core.PersistentVolume) field.ErrorList {
metaPath := field.NewPath("metadata")
allErrs := ValidateObjectMeta(&pv.ObjectMeta, false, ValidatePersistentVolumeName, metaPath)
......@@ -1827,16 +1830,13 @@ func ValidatePersistentVolumeClaimSpec(spec *core.PersistentVolumeClaimSpec, fld
if spec.DataSource != nil && !utilfeature.DefaultFeatureGate.Enabled(features.VolumeSnapshotDataSource) {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("dataSource"), "VolumeSnapshotDataSource is disabled by feature-gate"))
spec.DataSource = nil
} else if spec.DataSource != nil {
if len(spec.DataSource.Name) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("dataSource").Key(string("Name")), "VolumeSnapshotDataSource Name cannot be empty"))
}
if spec.DataSource.Kind != "VolumeSnapshot" {
allErrs = append(allErrs, field.Invalid(fldPath.Child("dataSource"), spec.DataSource.Kind, "expected DataSource Kind is VolumeSnapshot"))
}
if spec.DataSource.APIGroup != "snapshot.storage.k8s.io" {
allErrs = append(allErrs, field.Invalid(fldPath.Child("dataSource"), spec.DataSource.APIGroup, "expected DataSource APIGroup is snapshot.storage.k8s.io"))
allErrs = append(allErrs, field.Required(fldPath.Child("dataSource", "name"), ""))
} else if !supportedDataSourceKinds.Has(string(spec.DataSource.Kind)) {
allErrs = append(allErrs, field.NotSupported(fldPath.Child("dataSource"), spec.DataSource.Kind, supportedDataSourceKinds.List()))
} else if !supportedDataSourceAPIGroups.Has(string(spec.DataSource.APIGroup)) {
allErrs = append(allErrs, field.NotSupported(fldPath.Child("dataSource"), spec.DataSource.APIGroup, supportedDataSourceAPIGroups.List()))
}
}
......
......@@ -2293,7 +2293,9 @@ message PersistentVolumeClaimSpec {
// +optional
optional string volumeMode = 6;
// If specified, volume will be prepopulated with data from the DataSource.
// If specified, volume will be prepopulated with data from the specified data source.
// This depends on the provisioner for this volume being able to use the specified source.
// If the provisioner does not support it, it will fail to provision the volume.
// +optional
optional TypedLocalObjectReference dataSource = 7;
}
......
......@@ -458,7 +458,9 @@ type PersistentVolumeClaimSpec struct {
// This is an alpha feature and may change in the future.
// +optional
VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"`
// If specified, volume will be prepopulated with data from the DataSource.
// If specified, volume will be prepopulated with data from the specified data source.
// This depends on the provisioner for this volume being able to use the specified source.
// If the provisioner does not support it, it will fail to provision the volume.
// +optional
DataSource *TypedLocalObjectReference `json:"dataSource" protobuf:"bytes,7,opt,name=dataSource"`
}
......
......@@ -1210,7 +1210,7 @@ var map_PersistentVolumeClaimSpec = map[string]string{
"volumeName": "VolumeName is the binding reference to the PersistentVolume backing this claim.",
"storageClassName": "Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1",
"volumeMode": "volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is an alpha feature and may change in the future.",
"dataSource": "If specified, volume will be prepopulated with data from the DataSource.",
"dataSource": "If specified, volume will be prepopulated with data from the specified data source. This depends on the provisioner for this volume being able to use the specified source. If the provisioner does not support it, it will fail to provision the volume.",
}
func (PersistentVolumeClaimSpec) SwaggerDoc() map[string]string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment