mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #101256 from Jiawei0227/length2
Relax csiNodeIDMaxLength length limit to 256
This commit is contained in:
commit
7b24c7e4a7
@ -43,8 +43,8 @@ const (
|
|||||||
maxAttachedVolumeMetadataSize = 256 * (1 << 10) // 256 kB
|
maxAttachedVolumeMetadataSize = 256 * (1 << 10) // 256 kB
|
||||||
maxVolumeErrorMessageSize = 1024
|
maxVolumeErrorMessageSize = 1024
|
||||||
|
|
||||||
csiNodeIDMaxLength = 128
|
csiNodeIDMaxLength = 192
|
||||||
csiNodeIDLongerMaxLength = 192
|
csiNodeIDLongerMaxLength = 256
|
||||||
)
|
)
|
||||||
|
|
||||||
// CSINodeValidationOptions contains the validation options for validating CSINode
|
// CSINodeValidationOptions contains the validation options for validating CSINode
|
||||||
|
@ -1034,7 +1034,7 @@ func TestCSINodeValidation(t *testing.T) {
|
|||||||
driverName2 := "1io.kubernetes-storage-2-csi-driver3"
|
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
|
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"
|
nodeID := "nodeA"
|
||||||
longID := longName + longName // 176 chars
|
longID := longName + longName + "abcdefghijklmnopqrstuvwxyz" // 202 chars
|
||||||
successCases := []storage.CSINode{
|
successCases := []storage.CSINode{
|
||||||
{
|
{
|
||||||
// driver name: dot only
|
// driver name: dot only
|
||||||
|
@ -48,8 +48,8 @@ func (csiNodeStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object)
|
|||||||
func (csiNodeStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
|
func (csiNodeStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
|
||||||
csiNode := obj.(*storage.CSINode)
|
csiNode := obj.(*storage.CSINode)
|
||||||
|
|
||||||
// in 1.21, on create, set AllowLongNodeID=false
|
// in 1.22, on create, set AllowLongNodeID=false
|
||||||
// in 1.22, on create, set AllowLongNodeID=true
|
// in 1.23, on create, set AllowLongNodeID=true
|
||||||
validateOptions := validation.CSINodeValidationOptions{
|
validateOptions := validation.CSINodeValidationOptions{
|
||||||
AllowLongNodeID: false,
|
AllowLongNodeID: false,
|
||||||
}
|
}
|
||||||
@ -77,8 +77,8 @@ func (csiNodeStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Ob
|
|||||||
func (csiNodeStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
|
func (csiNodeStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
|
||||||
newCSINodeObj := obj.(*storage.CSINode)
|
newCSINodeObj := obj.(*storage.CSINode)
|
||||||
oldCSINodeObj := old.(*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 to true only if the old object already has a long node ID
|
||||||
// in 1.22 on update, set AllowLongNodeID=true
|
// in 1.23 on update, set AllowLongNodeID=true
|
||||||
allowLongNodeID := false
|
allowLongNodeID := false
|
||||||
for _, nodeDriver := range oldCSINodeObj.Spec.Drivers {
|
for _, nodeDriver := range oldCSINodeObj.Spec.Drivers {
|
||||||
if validation.CSINodeLongerID(nodeDriver.NodeID) {
|
if validation.CSINodeLongerID(nodeDriver.NodeID) {
|
||||||
|
Loading…
Reference in New Issue
Block a user