add deprecated warning for node beta labels in pv/sc/rc/csi storage capacity

- (pv) deprecated label using warning for node affinity
- (storageclass)  deprecated node labels: allowedTopologies.matchLabelExpressions.key
- (CSIStorageCapacity) deprecated node labels
- (RuntimeClass) deprecated node labels
This commit is contained in:
Paco Xu
2022-03-07 15:40:02 +08:00
parent 6605e526b0
commit 3fbfd7eb1b
9 changed files with 173 additions and 39 deletions

View File

@@ -23,6 +23,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apiserver/pkg/storage/names"
"k8s.io/kubernetes/pkg/api/legacyscheme"
storageutil "k8s.io/kubernetes/pkg/api/storage"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/apis/storage/validation"
)
@@ -56,7 +57,7 @@ func (csiStorageCapacityStrategy) Validate(ctx context.Context, obj runtime.Obje
// WarningsOnCreate returns warnings for the creation of the given object.
func (csiStorageCapacityStrategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string {
return nil
return storageutil.GetWarningsForCSIStorageCapacity(ctx, obj.(*storage.CSIStorageCapacity))
}
// Canonicalize normalizes the object after validation.
@@ -80,7 +81,7 @@ func (csiStorageCapacityStrategy) ValidateUpdate(ctx context.Context, obj, old r
// WarningsOnUpdate returns warnings for the given update.
func (csiStorageCapacityStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
return nil
return storageutil.GetWarningsForCSIStorageCapacity(ctx, obj.(*storage.CSIStorageCapacity))
}
func (csiStorageCapacityStrategy) AllowUnconditionalUpdate() bool {

View File

@@ -23,6 +23,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apiserver/pkg/storage/names"
"k8s.io/kubernetes/pkg/api/legacyscheme"
storageutil2 "k8s.io/kubernetes/pkg/api/storage"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/apis/storage/validation"
)
@@ -52,7 +53,7 @@ func (storageClassStrategy) Validate(ctx context.Context, obj runtime.Object) fi
// WarningsOnCreate returns warnings for the creation of the given object.
func (storageClassStrategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string {
return nil
return storageutil2.GetWarningsForStorageClass(ctx, obj.(*storage.StorageClass))
}
// Canonicalize normalizes the object after validation.
@@ -74,7 +75,7 @@ func (storageClassStrategy) ValidateUpdate(ctx context.Context, obj, old runtime
// WarningsOnUpdate returns warnings for the given update.
func (storageClassStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
return nil
return storageutil2.GetWarningsForStorageClass(ctx, obj.(*storage.StorageClass))
}
func (storageClassStrategy) AllowUnconditionalUpdate() bool {