mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #88686 from j-griffith/upgrade_cloning_to_ga
Mark PVCDataSource featuregate as GA
This commit is contained in:
commit
e865c0b219
2
api/openapi-spec/swagger.json
generated
2
api/openapi-spec/swagger.json
generated
@ -7832,7 +7832,7 @@
|
||||
},
|
||||
"dataSource": {
|
||||
"$ref": "#/definitions/io.k8s.api.core.v1.TypedLocalObjectReference",
|
||||
"description": "This field requires the VolumeSnapshotDataSource alpha feature gate to be enabled and currently VolumeSnapshot is the only supported data source. If the provisioner can support VolumeSnapshot data source, it will create a new volume and data will be restored to the volume at the same time. If the provisioner does not support VolumeSnapshot data source, volume will not be created and the failure will be reported as an event. In the future, we plan to support more data source types and the behavior of the provisioner may change."
|
||||
"description": "This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot - Beta) * An existing PVC (PersistentVolumeClaim) In order to use VolumeSnapshot object types, the appropriate feature gate must be enabled (VolumeSnapshotDataSource) If the provisioner can support the specified data source, it will create a new volume based on the contents of the specified PVC or Snapshot. If the provisioner does not support the specified data source, the volume will not be created and the failure will be reported as an event. In the future, we plan to support more data source types and the behavior of the provisioner may change."
|
||||
},
|
||||
"resources": {
|
||||
"$ref": "#/definitions/io.k8s.api.core.v1.ResourceRequirements",
|
||||
|
@ -51,8 +51,7 @@ func dataSourceIsEnabled(pvcSpec *core.PersistentVolumeClaimSpec) bool {
|
||||
if pvcSpec.DataSource.APIGroup != nil {
|
||||
apiGroup = *pvcSpec.DataSource.APIGroup
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.VolumePVCDataSource) &&
|
||||
pvcSpec.DataSource.Kind == pvc &&
|
||||
if pvcSpec.DataSource.Kind == pvc &&
|
||||
apiGroup == "" {
|
||||
return true
|
||||
|
||||
|
@ -149,57 +149,31 @@ func TestPVCDataSourceSpecFilter(t *testing.T) {
|
||||
|
||||
var tests = map[string]struct {
|
||||
spec core.PersistentVolumeClaimSpec
|
||||
gateEnabled bool
|
||||
want *core.TypedLocalObjectReference
|
||||
}{
|
||||
"enabled with empty ds": {
|
||||
spec: core.PersistentVolumeClaimSpec{},
|
||||
gateEnabled: true,
|
||||
want: nil,
|
||||
},
|
||||
"enabled with invalid spec": {
|
||||
spec: invalidSpec,
|
||||
gateEnabled: true,
|
||||
want: nil,
|
||||
},
|
||||
"enabled with valid spec": {
|
||||
spec: validSpec,
|
||||
gateEnabled: true,
|
||||
want: validSpec.DataSource,
|
||||
},
|
||||
"disabled with invalid spec": {
|
||||
spec: invalidSpec,
|
||||
gateEnabled: false,
|
||||
want: nil,
|
||||
},
|
||||
"disabled with valid spec": {
|
||||
spec: validSpec,
|
||||
gateEnabled: false,
|
||||
want: nil,
|
||||
},
|
||||
"diabled with empty ds": {
|
||||
spec: core.PersistentVolumeClaimSpec{},
|
||||
gateEnabled: false,
|
||||
want: nil,
|
||||
},
|
||||
"enabled with valid spec but nil APIGroup": {
|
||||
spec: validSpecNilAPIGroup,
|
||||
gateEnabled: true,
|
||||
want: validSpecNilAPIGroup.DataSource,
|
||||
},
|
||||
"disabled with valid spec but nil APIGroup": {
|
||||
spec: validSpecNilAPIGroup,
|
||||
gateEnabled: false,
|
||||
want: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for testName, test := range tests {
|
||||
t.Run(testName, func(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumePVCDataSource, test.gateEnabled)()
|
||||
DropDisabledFields(&test.spec, nil)
|
||||
if test.spec.DataSource != test.want {
|
||||
t.Errorf("expected drop datasource condition was not met, test: %s, gateEnabled: %v, spec: %v, expected: %v", testName, test.gateEnabled, test.spec, test.want)
|
||||
t.Errorf("expected drop datasource condition was not met, test: %s, spec: %v, expected: %v", testName, test.spec, test.want)
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -418,10 +418,10 @@ type PersistentVolumeClaimSpec struct {
|
||||
// +optional
|
||||
VolumeMode *PersistentVolumeMode
|
||||
// This field can be used to specify either:
|
||||
// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
|
||||
// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot - Beta)
|
||||
// * An existing PVC (PersistentVolumeClaim)
|
||||
// In order to use either of these DataSource types, the appropriate feature gate
|
||||
// must be enabled (VolumeSnapshotDataSource, VolumePVCDataSource)
|
||||
// In order to use VolumeSnapshot object types, the appropriate feature gate
|
||||
// must be enabled (VolumeSnapshotDataSource)
|
||||
// If the provisioner can support the specified data source, it will create
|
||||
// a new volume based on the contents of the specified PVC or Snapshot.
|
||||
// If the provisioner does not support the specified data source, the volume will
|
||||
|
@ -477,6 +477,7 @@ const (
|
||||
// owner: @j-griffith
|
||||
// alpha: v1.15
|
||||
// beta: v1.16
|
||||
// GA: v1.18
|
||||
//
|
||||
// Enable support for specifying an existing PVC as a DataSource
|
||||
VolumePVCDataSource featuregate.Feature = "VolumePVCDataSource"
|
||||
@ -637,7 +638,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
||||
ServiceLoadBalancerFinalizer: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
LocalStorageCapacityIsolationFSQuotaMonitoring: {Default: false, PreRelease: featuregate.Alpha},
|
||||
NonPreemptingPriority: {Default: false, PreRelease: featuregate.Alpha},
|
||||
VolumePVCDataSource: {Default: true, PreRelease: featuregate.Beta},
|
||||
VolumePVCDataSource: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.20
|
||||
PodOverhead: {Default: true, PreRelease: featuregate.Beta},
|
||||
IPv6DualStack: {Default: false, PreRelease: featuregate.Alpha},
|
||||
EndpointSlice: {Default: true, PreRelease: featuregate.Beta},
|
||||
|
@ -2637,11 +2637,14 @@ message PersistentVolumeClaimSpec {
|
||||
// +optional
|
||||
optional string volumeMode = 6;
|
||||
|
||||
// This field requires the VolumeSnapshotDataSource alpha feature gate to be
|
||||
// enabled and currently VolumeSnapshot is the only supported data source.
|
||||
// If the provisioner can support VolumeSnapshot data source, it will create
|
||||
// a new volume and data will be restored to the volume at the same time.
|
||||
// If the provisioner does not support VolumeSnapshot data source, volume will
|
||||
// This field can be used to specify either:
|
||||
// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot - Beta)
|
||||
// * An existing PVC (PersistentVolumeClaim)
|
||||
// In order to use VolumeSnapshot object types, the appropriate feature gate
|
||||
// must be enabled (VolumeSnapshotDataSource)
|
||||
// If the provisioner can support the specified data source, it will create
|
||||
// a new volume based on the contents of the specified PVC or Snapshot.
|
||||
// If the provisioner does not support the specified data source, the volume will
|
||||
// not be created and the failure will be reported as an event.
|
||||
// In the future, we plan to support more data source types and the behavior
|
||||
// of the provisioner may change.
|
||||
|
@ -461,11 +461,14 @@ type PersistentVolumeClaimSpec struct {
|
||||
// Value of Filesystem is implied when not included in claim spec.
|
||||
// +optional
|
||||
VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"`
|
||||
// This field requires the VolumeSnapshotDataSource alpha feature gate to be
|
||||
// enabled and currently VolumeSnapshot is the only supported data source.
|
||||
// If the provisioner can support VolumeSnapshot data source, it will create
|
||||
// a new volume and data will be restored to the volume at the same time.
|
||||
// If the provisioner does not support VolumeSnapshot data source, volume will
|
||||
// This field can be used to specify either:
|
||||
// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot - Beta)
|
||||
// * An existing PVC (PersistentVolumeClaim)
|
||||
// In order to use VolumeSnapshot object types, the appropriate feature gate
|
||||
// must be enabled (VolumeSnapshotDataSource)
|
||||
// If the provisioner can support the specified data source, it will create
|
||||
// a new volume based on the contents of the specified PVC or Snapshot.
|
||||
// If the provisioner does not support the specified data source, the volume will
|
||||
// not be created and the failure will be reported as an event.
|
||||
// In the future, we plan to support more data source types and the behavior
|
||||
// of the provisioner may change.
|
||||
|
@ -1301,7 +1301,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.",
|
||||
"dataSource": "This field requires the VolumeSnapshotDataSource alpha feature gate to be enabled and currently VolumeSnapshot is the only supported data source. If the provisioner can support VolumeSnapshot data source, it will create a new volume and data will be restored to the volume at the same time. If the provisioner does not support VolumeSnapshot data source, volume will not be created and the failure will be reported as an event. In the future, we plan to support more data source types and the behavior of the provisioner may change.",
|
||||
"dataSource": "This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot - Beta) * An existing PVC (PersistentVolumeClaim) In order to use VolumeSnapshot object types, the appropriate feature gate must be enabled (VolumeSnapshotDataSource) If the provisioner can support the specified data source, it will create a new volume based on the contents of the specified PVC or Snapshot. If the provisioner does not support the specified data source, the volume will not be created and the failure will be reported as an event. In the future, we plan to support more data source types and the behavior of the provisioner may change.",
|
||||
}
|
||||
|
||||
func (PersistentVolumeClaimSpec) SwaggerDoc() map[string]string {
|
||||
|
Loading…
Reference in New Issue
Block a user