Address Tim's comments

This commit is contained in:
Xing Yang 2018-08-24 12:46:32 -07:00
parent 2a9cff2b03
commit 5a6c5b07a2
14 changed files with 27 additions and 21 deletions

View File

@ -82490,7 +82490,7 @@
} }
}, },
"dataSource": { "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" "$ref": "#/definitions/io.k8s.api.core.v1.TypedLocalObjectReference"
}, },
"resources": { "resources": {

View File

@ -9516,7 +9516,7 @@
}, },
"dataSource": { "dataSource": {
"$ref": "v1.TypedLocalObjectReference", "$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."
} }
} }
}, },

View File

@ -6798,7 +6798,7 @@
}, },
"dataSource": { "dataSource": {
"$ref": "v1.TypedLocalObjectReference", "$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."
} }
} }
}, },

View File

@ -9520,7 +9520,7 @@
}, },
"dataSource": { "dataSource": {
"$ref": "v1.TypedLocalObjectReference", "$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."
} }
} }
}, },

View File

@ -19311,7 +19311,7 @@
}, },
"dataSource": { "dataSource": {
"$ref": "v1.TypedLocalObjectReference", "$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."
} }
} }
}, },

View File

@ -1019,7 +1019,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr> </tr>
<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">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">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"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>

View File

@ -1047,7 +1047,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr> </tr>
<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">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">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"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>

View File

@ -994,7 +994,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr> </tr>
<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">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">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"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>

View File

@ -696,7 +696,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tr> </tr>
<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">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">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"><p class="tableblock"><a href="#_v1_typedlocalobjectreference">v1.TypedLocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>

View File

@ -413,7 +413,9 @@ type PersistentVolumeClaimSpec struct {
// This is an alpha feature and may change in the future. // This is an alpha feature and may change in the future.
// +optional // +optional
VolumeMode *PersistentVolumeMode 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 // +optional
DataSource *TypedLocalObjectReference DataSource *TypedLocalObjectReference
} }

View File

@ -1501,6 +1501,9 @@ var supportedReclaimPolicy = sets.NewString(string(core.PersistentVolumeReclaimD
var supportedVolumeModes = sets.NewString(string(core.PersistentVolumeBlock), string(core.PersistentVolumeFilesystem)) 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 { func ValidatePersistentVolume(pv *core.PersistentVolume) field.ErrorList {
metaPath := field.NewPath("metadata") metaPath := field.NewPath("metadata")
allErrs := ValidateObjectMeta(&pv.ObjectMeta, false, ValidatePersistentVolumeName, metaPath) 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) { if spec.DataSource != nil && !utilfeature.DefaultFeatureGate.Enabled(features.VolumeSnapshotDataSource) {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("dataSource"), "VolumeSnapshotDataSource is disabled by feature-gate")) allErrs = append(allErrs, field.Forbidden(fldPath.Child("dataSource"), "VolumeSnapshotDataSource is disabled by feature-gate"))
spec.DataSource = nil
} else if spec.DataSource != nil { } else if spec.DataSource != nil {
if len(spec.DataSource.Name) == 0 { if len(spec.DataSource.Name) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("dataSource").Key(string("Name")), "VolumeSnapshotDataSource Name cannot be empty")) allErrs = append(allErrs, field.Required(fldPath.Child("dataSource", "name"), ""))
} } else if !supportedDataSourceKinds.Has(string(spec.DataSource.Kind)) {
if spec.DataSource.Kind != "VolumeSnapshot" { allErrs = append(allErrs, field.NotSupported(fldPath.Child("dataSource"), spec.DataSource.Kind, supportedDataSourceKinds.List()))
allErrs = append(allErrs, field.Invalid(fldPath.Child("dataSource"), spec.DataSource.Kind, "expected DataSource Kind is VolumeSnapshot")) } else if !supportedDataSourceAPIGroups.Has(string(spec.DataSource.APIGroup)) {
} allErrs = append(allErrs, field.NotSupported(fldPath.Child("dataSource"), spec.DataSource.APIGroup, supportedDataSourceAPIGroups.List()))
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"))
} }
} }

View File

@ -2293,7 +2293,9 @@ message PersistentVolumeClaimSpec {
// +optional // +optional
optional string volumeMode = 6; 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
optional TypedLocalObjectReference dataSource = 7; optional TypedLocalObjectReference dataSource = 7;
} }

View File

@ -458,7 +458,9 @@ type PersistentVolumeClaimSpec struct {
// This is an alpha feature and may change in the future. // This is an alpha feature and may change in the future.
// +optional // +optional
VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"` 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 // +optional
DataSource *TypedLocalObjectReference `json:"dataSource" protobuf:"bytes,7,opt,name=dataSource"` DataSource *TypedLocalObjectReference `json:"dataSource" protobuf:"bytes,7,opt,name=dataSource"`
} }

View File

@ -1210,7 +1210,7 @@ var map_PersistentVolumeClaimSpec = map[string]string{
"volumeName": "VolumeName is the binding reference to the PersistentVolume backing this claim.", "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", "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.", "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 { func (PersistentVolumeClaimSpec) SwaggerDoc() map[string]string {