diff --git a/pkg/apis/storage/validation/validation.go b/pkg/apis/storage/validation/validation.go index 6f4e34e6414..841e53b56b2 100644 --- a/pkg/apis/storage/validation/validation.go +++ b/pkg/apis/storage/validation/validation.go @@ -44,8 +44,8 @@ const ( maxAttachedVolumeMetadataSize = 256 * (1 << 10) // 256 kB maxVolumeErrorMessageSize = 1024 - csiNodeIDMaxLength = 128 - csiNodeIDLongerMaxLength = 192 + csiNodeIDMaxLength = 192 + csiNodeIDLongerMaxLength = 256 ) // CSINodeValidationOptions contains the validation options for validating CSINode diff --git a/pkg/apis/storage/validation/validation_test.go b/pkg/apis/storage/validation/validation_test.go index d5b5de66783..a429b2d8221 100644 --- a/pkg/apis/storage/validation/validation_test.go +++ b/pkg/apis/storage/validation/validation_test.go @@ -1034,7 +1034,7 @@ func TestCSINodeValidation(t *testing.T) { driverName2 := "1io.kubernetes-storage-2-csi-driver3" longName := "my-a-b-c-d-c-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-ABCDEFGHIJKLMNOPQRSTUVWXYZ-driver" // 88 chars nodeID := "nodeA" - longID := longName + longName // 176 chars + longID := longName + longName + "abcdefghijklmnopqrstuvwxyz" // 202 chars successCases := []storage.CSINode{ { // driver name: dot only diff --git a/pkg/registry/storage/csinode/strategy.go b/pkg/registry/storage/csinode/strategy.go index 6581b1ded07..3f68e0ab396 100644 --- a/pkg/registry/storage/csinode/strategy.go +++ b/pkg/registry/storage/csinode/strategy.go @@ -48,8 +48,8 @@ func (csiNodeStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) func (csiNodeStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { csiNode := obj.(*storage.CSINode) - // in 1.21, on create, set AllowLongNodeID=false - // in 1.22, on create, set AllowLongNodeID=true + // in 1.22, on create, set AllowLongNodeID=false + // in 1.23, on create, set AllowLongNodeID=true validateOptions := validation.CSINodeValidationOptions{ AllowLongNodeID: false, } @@ -74,8 +74,8 @@ func (csiNodeStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Ob func (csiNodeStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { newCSINodeObj := obj.(*storage.CSINode) oldCSINodeObj := old.(*storage.CSINode) - // in 1.21 on update, set AllowLongNodeID to true only if the old object already has a long node ID - // in 1.22 on update, set AllowLongNodeID=true + // in 1.22 on update, set AllowLongNodeID to true only if the old object already has a long node ID + // in 1.23 on update, set AllowLongNodeID=true allowLongNodeID := false for _, nodeDriver := range oldCSINodeObj.Spec.Drivers { if validation.CSINodeLongerID(nodeDriver.NodeID) {