From 10a3cc815bea73f78f7126cab5df95233da96e1b Mon Sep 17 00:00:00 2001 From: Matthew Cary Date: Thu, 15 Jul 2021 17:14:19 -0700 Subject: [PATCH] Revert "statefulset PersistentVolumeClaimDeletePolicy api change" This reverts commit e4e735cd1cf6e9c06f98a6cc8785ae5f0ab5c099. Change-Id: I3e17aa585fd9ae4f9e74b97326ae6b9fadd2a94c --- pkg/apis/apps/fuzzer/fuzzer.go | 11 ----- pkg/apis/apps/types.go | 40 ------------------ pkg/apis/apps/v1/defaults.go | 14 ------- pkg/apis/apps/v1beta1/defaults.go | 15 ------- pkg/apis/apps/v1beta2/defaults.go | 14 ------- pkg/apis/apps/validation/validation.go | 27 +----------- pkg/registry/apps/statefulset/strategy.go | 7 ---- staging/src/k8s.io/api/apps/v1/types.go | 43 -------------------- staging/src/k8s.io/api/apps/v1beta1/types.go | 40 ------------------ staging/src/k8s.io/api/apps/v1beta2/types.go | 40 ------------------ 10 files changed, 2 insertions(+), 249 deletions(-) diff --git a/pkg/apis/apps/fuzzer/fuzzer.go b/pkg/apis/apps/fuzzer/fuzzer.go index c271223747a..5f7858560ba 100644 --- a/pkg/apis/apps/fuzzer/fuzzer.go +++ b/pkg/apis/apps/fuzzer/fuzzer.go @@ -40,17 +40,6 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { if len(s.Spec.UpdateStrategy.Type) == 0 { s.Spec.UpdateStrategy.Type = apps.RollingUpdateStatefulSetStrategyType } - if s.Spec.PersistentVolumeClaimRetentionPolicy == nil { - policies := []apps.PersistentVolumeClaimRetentionPolicyType{ - apps.RetainPersistentVolumeClaimRetentionPolicyType, - apps.DeletePersistentVolumeClaimRetentionPolicyType, - } - choice := int32(c.Rand.Int31()) - s.Spec.PersistentVolumeClaimRetentionPolicy = &apps.StatefulSetPersistentVolumeClaimRetentionPolicy{ - WhenDeleted: policies[choice&1], - WhenScaled: policies[(choice>>1)&1], - } - } if s.Spec.RevisionHistoryLimit == nil { s.Spec.RevisionHistoryLimit = new(int32) *s.Spec.RevisionHistoryLimit = 10 diff --git a/pkg/apis/apps/types.go b/pkg/apis/apps/types.go index ac528197678..2673bc7ed51 100644 --- a/pkg/apis/apps/types.go +++ b/pkg/apis/apps/types.go @@ -97,40 +97,6 @@ type RollingUpdateStatefulSetStrategy struct { Partition int32 } -// PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine -// when volumes from the VolumeClaimTemplates will be deleted when the controlling StatefulSet is -// deleted or scaled down. -type PersistentVolumeClaimRetentionPolicyType string - -const ( - // RetainPersistentVolumeClaimRetentionPolicyType is the default - // PersistentVolumeClaimRetentionPolicy and specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will not be deleted. - RetainPersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Retain" - // DeletePersistentVolumeClaimRetentionPolicyType specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will be deleted in the scenario specified in - // StatefulSetPersistentVolumeClaimPolicy. - DeletePersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Delete" -) - -// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs -// created from the StatefulSet VolumeClaimTemplates. -type StatefulSetPersistentVolumeClaimRetentionPolicy struct { - // WhenDeleted specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is deleted. The default policy - // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The - // `Delete` policy causes those PVCs to be deleted. - WhenDeleted PersistentVolumeClaimRetentionPolicyType - // WhenScaled specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is scaled down. The default - // policy of `Retain` causes PVCs to not be affected by a scaledown. The - // `Delete` policy causes the associated PVCs for any excess pods above - // the replica count to be deleted. - WhenScaled PersistentVolumeClaimRetentionPolicyType -} - // A StatefulSetSpec is the specification of a StatefulSet. type StatefulSetSpec struct { // Replicas is the desired number of replicas of the given Template. @@ -198,12 +164,6 @@ type StatefulSetSpec struct { // This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate. // +optional MinReadySeconds int32 - - // PersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from - // the StatefulSet VolumeClaimTemplates. This requires the - // StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha. - // +optional - PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy } // StatefulSetStatus represents the current state of a StatefulSet. diff --git a/pkg/apis/apps/v1/defaults.go b/pkg/apis/apps/v1/defaults.go index c6862ec7fc9..8b3a0e9882e 100644 --- a/pkg/apis/apps/v1/defaults.go +++ b/pkg/apis/apps/v1/defaults.go @@ -20,8 +20,6 @@ import ( appsv1 "k8s.io/api/apps/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" - utilfeature "k8s.io/apiserver/pkg/util/feature" - "k8s.io/kubernetes/pkg/features" ) func addDefaultingFuncs(scheme *runtime.Scheme) error { @@ -119,18 +117,6 @@ func SetDefaults_StatefulSet(obj *appsv1.StatefulSet) { *obj.Spec.UpdateStrategy.RollingUpdate.Partition = 0 } - if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetAutoDeletePVC) { - if obj.Spec.PersistentVolumeClaimRetentionPolicy == nil { - obj.Spec.PersistentVolumeClaimRetentionPolicy = &appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy{} - } - if len(obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenDeleted) == 0 { - obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenDeleted = appsv1.RetainPersistentVolumeClaimRetentionPolicyType - } - if len(obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenScaled) == 0 { - obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenScaled = appsv1.RetainPersistentVolumeClaimRetentionPolicyType - } - } - if obj.Spec.Replicas == nil { obj.Spec.Replicas = new(int32) *obj.Spec.Replicas = 1 diff --git a/pkg/apis/apps/v1beta1/defaults.go b/pkg/apis/apps/v1beta1/defaults.go index 799973e3fca..3670e67a7d6 100644 --- a/pkg/apis/apps/v1beta1/defaults.go +++ b/pkg/apis/apps/v1beta1/defaults.go @@ -21,8 +21,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" - utilfeature "k8s.io/apiserver/pkg/util/feature" - "k8s.io/kubernetes/pkg/features" ) func addDefaultingFuncs(scheme *runtime.Scheme) error { @@ -48,19 +46,6 @@ func SetDefaults_StatefulSet(obj *appsv1beta1.StatefulSet) { obj.Labels = labels } } - - if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetAutoDeletePVC) { - if obj.Spec.PersistentVolumeClaimRetentionPolicy == nil { - obj.Spec.PersistentVolumeClaimRetentionPolicy = &appsv1beta1.StatefulSetPersistentVolumeClaimRetentionPolicy{} - } - if len(obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenDeleted) == 0 { - obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenDeleted = appsv1beta1.RetainPersistentVolumeClaimRetentionPolicyType - } - if len(obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenScaled) == 0 { - obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenScaled = appsv1beta1.RetainPersistentVolumeClaimRetentionPolicyType - } - } - if obj.Spec.Replicas == nil { obj.Spec.Replicas = new(int32) *obj.Spec.Replicas = 1 diff --git a/pkg/apis/apps/v1beta2/defaults.go b/pkg/apis/apps/v1beta2/defaults.go index 78a415d6478..f42b021b04e 100644 --- a/pkg/apis/apps/v1beta2/defaults.go +++ b/pkg/apis/apps/v1beta2/defaults.go @@ -20,8 +20,6 @@ import ( appsv1beta2 "k8s.io/api/apps/v1beta2" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" - utilfeature "k8s.io/apiserver/pkg/util/feature" - "k8s.io/kubernetes/pkg/features" ) func addDefaultingFuncs(scheme *runtime.Scheme) error { @@ -74,18 +72,6 @@ func SetDefaults_StatefulSet(obj *appsv1beta2.StatefulSet) { *obj.Spec.UpdateStrategy.RollingUpdate.Partition = 0 } - if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetAutoDeletePVC) { - if obj.Spec.PersistentVolumeClaimRetentionPolicy == nil { - obj.Spec.PersistentVolumeClaimRetentionPolicy = &appsv1beta2.StatefulSetPersistentVolumeClaimRetentionPolicy{} - } - if len(obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenDeleted) == 0 { - obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenDeleted = appsv1beta2.RetainPersistentVolumeClaimRetentionPolicyType - } - if len(obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenScaled) == 0 { - obj.Spec.PersistentVolumeClaimRetentionPolicy.WhenScaled = appsv1beta2.RetainPersistentVolumeClaimRetentionPolicyType - } - } - if obj.Spec.Replicas == nil { obj.Spec.Replicas = new(int32) *obj.Spec.Replicas = 1 diff --git a/pkg/apis/apps/validation/validation.go b/pkg/apis/apps/validation/validation.go index 73c0d8d613b..90f6265dde0 100644 --- a/pkg/apis/apps/validation/validation.go +++ b/pkg/apis/apps/validation/validation.go @@ -69,26 +69,6 @@ func ValidatePodTemplateSpecForStatefulSet(template *api.PodTemplateSpec, select return allErrs } -func ValidatePersistentVolumeClaimRetentionPolicyType(policy apps.PersistentVolumeClaimRetentionPolicyType, fldPath *field.Path) field.ErrorList { - var allErrs field.ErrorList - switch policy { - case apps.RetainPersistentVolumeClaimRetentionPolicyType: - case apps.DeletePersistentVolumeClaimRetentionPolicyType: - default: - allErrs = append(allErrs, field.NotSupported(fldPath, policy, []string{string(apps.RetainPersistentVolumeClaimRetentionPolicyType), string(apps.DeletePersistentVolumeClaimRetentionPolicyType)})) - } - return allErrs -} - -func ValidatePersistentVolumeClaimRetentionPolicy(policy *apps.StatefulSetPersistentVolumeClaimRetentionPolicy, fldPath *field.Path) field.ErrorList { - var allErrs field.ErrorList - if policy != nil { - allErrs = append(allErrs, ValidatePersistentVolumeClaimRetentionPolicyType(policy.WhenDeleted, fldPath.Child("whenDeleted"))...) - allErrs = append(allErrs, ValidatePersistentVolumeClaimRetentionPolicyType(policy.WhenScaled, fldPath.Child("whenScaled"))...) - } - return allErrs -} - // ValidateStatefulSetSpec tests if required fields in the StatefulSet spec are set. func ValidateStatefulSetSpec(spec *apps.StatefulSetSpec, fldPath *field.Path, opts apivalidation.PodValidationOptions) field.ErrorList { allErrs := field.ErrorList{} @@ -128,8 +108,6 @@ func ValidateStatefulSetSpec(spec *apps.StatefulSetSpec, fldPath *field.Path, op apps.OnDeleteStatefulSetStrategyType))) } - allErrs = append(allErrs, ValidatePersistentVolumeClaimRetentionPolicy(spec.PersistentVolumeClaimRetentionPolicy, fldPath.Child("persistentVolumeClaimRetentionPolicy"))...) - allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas"))...) if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetMinReadySeconds) { allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(spec.MinReadySeconds), fldPath.Child("minReadySeconds"))...) @@ -180,12 +158,11 @@ func ValidateStatefulSetUpdate(statefulSet, oldStatefulSet *apps.StatefulSet) fi if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetMinReadySeconds) { newStatefulSetClone.Spec.MinReadySeconds = oldStatefulSet.Spec.MinReadySeconds // +k8s:verify-mutation:reason=clone } - newStatefulSetClone.Spec.PersistentVolumeClaimRetentionPolicy = oldStatefulSet.Spec.PersistentVolumeClaimRetentionPolicy // +k8s:verify-mutation:reason=clone if !apiequality.Semantic.DeepEqual(newStatefulSetClone.Spec, oldStatefulSet.Spec) { if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetMinReadySeconds) { - allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to statefulset spec for fields other than 'replicas', 'template', 'updateStrategy' and 'persistentVolumeClaimRetentionPolicy' are forbidden")) + allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to statefulset spec for fields other than 'replicas', 'template', 'minReadySeconds' and 'updateStrategy' are forbidden")) } else { - allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to statefulset spec for fields other than 'replicas', 'template', 'updateStrategy', 'minReadySeconds' and 'persistentVolumeClaimRetentionPolicy' are forbidden")) + allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to statefulset spec for fields other than 'replicas', 'template', 'updateStrategy' and 'minReadySeconds' are forbidden")) } } diff --git a/pkg/registry/apps/statefulset/strategy.go b/pkg/registry/apps/statefulset/strategy.go index c8d39bc670c..12e4f10b83e 100644 --- a/pkg/registry/apps/statefulset/strategy.go +++ b/pkg/registry/apps/statefulset/strategy.go @@ -84,7 +84,6 @@ func (statefulSetStrategy) PrepareForCreate(ctx context.Context, obj runtime.Obj statefulSet.Status = apps.StatefulSetStatus{} statefulSet.Generation = 1 - dropStatefulSetDisabledFields(statefulSet, nil) pod.DropDisabledTemplateFields(&statefulSet.Spec.Template, nil) } @@ -119,12 +118,6 @@ func dropStatefulSetDisabledFields(newSS *apps.StatefulSet, oldSS *apps.Stateful newSS.Spec.MinReadySeconds = int32(0) } } - - if !utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetAutoDeletePVC) { - if oldSS == nil || oldSS.Spec.PersistentVolumeClaimRetentionPolicy == nil { - newSS.Spec.PersistentVolumeClaimRetentionPolicy = nil - } - } } // minReadySecondsFieldsInUse returns true if fields related to StatefulSet minReadySeconds are set and diff --git a/staging/src/k8s.io/api/apps/v1/types.go b/staging/src/k8s.io/api/apps/v1/types.go index c60a959bc8f..51c9fa43d51 100644 --- a/staging/src/k8s.io/api/apps/v1/types.go +++ b/staging/src/k8s.io/api/apps/v1/types.go @@ -116,40 +116,6 @@ type RollingUpdateStatefulSetStrategy struct { Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"` } -// PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine -// when volumes from the VolumeClaimTemplates will be deleted when the controlling StatefulSet is -// deleted or scaled down. -type PersistentVolumeClaimRetentionPolicyType string - -const ( - // RetainPersistentVolumeClaimRetentionPolicyType is the default - // PersistentVolumeClaimRetentionPolicy and specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will not be deleted. - RetainPersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Retain" - // RetentionPersistentVolumeClaimRetentionPolicyType specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will be deleted in the scenario specified in - // StatefulSetPersistentVolumeClaimRetentionPolicy. - DeletePersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Delete" -) - -// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs -// created from the StatefulSet VolumeClaimTemplates. -type StatefulSetPersistentVolumeClaimRetentionPolicy struct { - // WhenDeleted specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is deleted. The default policy - // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The - // `Delete` policy causes those PVCs to be deleted. - WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty" protobuf:"bytes,1,opt,name=whenDeleted,casttype=PersistentVolumeClaimRetentionPolicyType"` - // WhenScaled specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is scaled down. The default - // policy of `Retain` causes PVCs to not be affected by a scaledown. The - // `Delete` policy causes the associated PVCs for any excess pods above - // the replica count to be deleted. - WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty" protobuf:"bytes,2,opt,name=whenScaled,casttype=PersistentVolumeClaimRetentionPolicyType"` -} - // A StatefulSetSpec is the specification of a StatefulSet. type StatefulSetSpec struct { // replicas is the desired number of replicas of the given Template. @@ -216,15 +182,6 @@ type StatefulSetSpec struct { // This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate. // +optional MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,9,opt,name=minReadySeconds"` - - // persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent - // volume claims created from volumeClaimTemplates. By default, all persistent - // volume claims are created as needed and retained until manually deleted. This - // policy allows the lifecycle to be altered, for example by deleting persistent - // volume claims when their stateful set is deleted, or when their pod is scaled - // down. This requires the StatefulSetAutoDeletePVC feature gate to be enabled, - // which is alpha. +optional - PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty" protobuf:"bytes,10,opt,name=persistentVolumeClaimRetentionPolicy"` } // StatefulSetStatus represents the current state of a StatefulSet. diff --git a/staging/src/k8s.io/api/apps/v1beta1/types.go b/staging/src/k8s.io/api/apps/v1beta1/types.go index 2c2db067d1f..be638bb0f93 100644 --- a/staging/src/k8s.io/api/apps/v1beta1/types.go +++ b/staging/src/k8s.io/api/apps/v1beta1/types.go @@ -158,40 +158,6 @@ type RollingUpdateStatefulSetStrategy struct { Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"` } -// PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine -// when volumes from the VolumeClaimTemplates will be deleted when the controlling StatefulSet is -// deleted or scaled down. -type PersistentVolumeClaimRetentionPolicyType string - -const ( - // RetainPersistentVolumeClaimRetentionPolicyType is the default - // PersistentVolumeClaimRetentionPolicy and specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will not be deleted. - RetainPersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Retain" - // RetentionPersistentVolumeClaimRetentionPolicyType specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will be deleted in the scenario specified in - // StatefulSetPersistentVolumeClaimRetentionPolicy. - RetentionPersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Delete" -) - -// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs -// created from the StatefulSet VolumeClaimTemplates. -type StatefulSetPersistentVolumeClaimRetentionPolicy struct { - // WhenDeleted specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is deleted. The default policy - // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The - // `Delete` policy causes those PVCs to be deleted. - WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty" protobuf:"bytes,1,opt,name=whenDeleted,casttype=PersistentVolumeClaimRetentionPolicyType"` - // WhenScaled specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is scaled down. The default - // policy of `Retain` causes PVCs to not be affected by a scaledown. The - // `Delete` policy causes the associated PVCs for any excess pods above - // the replica count to be deleted. - WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty" protobuf:"bytes,2,opt,name=whenScaled,casttype=PersistentVolumeClaimRetentionPolicyType"` -} - // A StatefulSetSpec is the specification of a StatefulSet. type StatefulSetSpec struct { // replicas is the desired number of replicas of the given Template. @@ -259,12 +225,6 @@ type StatefulSetSpec struct { // This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate. // +optional MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,9,opt,name=minReadySeconds"` - - // PersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from - // the StatefulSet VolumeClaimTemplates. This requires the - // StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha. - // +optional - PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty" protobuf:"bytes,10,opt,name=persistentVolumeClaimRetentionPolicy"` } // StatefulSetStatus represents the current state of a StatefulSet. diff --git a/staging/src/k8s.io/api/apps/v1beta2/types.go b/staging/src/k8s.io/api/apps/v1beta2/types.go index 873921c4e24..67e10b97143 100644 --- a/staging/src/k8s.io/api/apps/v1beta2/types.go +++ b/staging/src/k8s.io/api/apps/v1beta2/types.go @@ -169,40 +169,6 @@ type RollingUpdateStatefulSetStrategy struct { Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"` } -// PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine -// when volumes from the VolumeClaimTemplates will be deleted when the controlling StatefulSet is -// deleted or scaled down. -type PersistentVolumeClaimRetentionPolicyType string - -const ( - // RetainPersistentVolumeClaimRetentionPolicyType is the default - // PersistentVolumeClaimRetentionPolicy and specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will not be deleted. - RetainPersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Retain" - // RetentionPersistentVolumeClaimRetentionPolicyType specifies that - // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates - // will be deleted in the scenario specified in - // StatefulSetPersistentVolumeClaimRetentionPolicy. - RetentionPersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Delete" -) - -// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs -// created from the StatefulSet VolumeClaimTemplates. -type StatefulSetPersistentVolumeClaimRetentionPolicy struct { - // WhenDeleted specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is deleted. The default policy - // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The - // `Delete` policy causes those PVCs to be deleted. - WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty" protobuf:"bytes,1,opt,name=whenDeleted,casttype=PersistentVolumeClaimRetentionPolicyType"` - // WhenScaled specifies what happens to PVCs created from StatefulSet - // VolumeClaimTemplates when the StatefulSet is scaled down. The default - // policy of `Retain` causes PVCs to not be affected by a scaledown. The - // `Delete` policy causes the associated PVCs for any excess pods above - // the replica count to be deleted. - WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty" protobuf:"bytes,2,opt,name=whenScaled,casttype=PersistentVolumeClaimRetentionPolicyType"` -} - // A StatefulSetSpec is the specification of a StatefulSet. type StatefulSetSpec struct { // replicas is the desired number of replicas of the given Template. @@ -269,12 +235,6 @@ type StatefulSetSpec struct { // This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate. // +optional MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,9,opt,name=minReadySeconds"` - - // PersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from - // the StatefulSet VolumeClaimTemplates. This requires the - // StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha. - // +optional - PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty" protobuf:"bytes,10,opt,name=persistentVolumeClaimRetentionPolicy"` } // StatefulSetStatus represents the current state of a StatefulSet.