Merge pull request #104160 from pacoxu/AllowLongNodeID-true

set AllowLongNodeID to true by default since 1.23
This commit is contained in:
Kubernetes Prow Robot 2021-08-30 08:17:05 -07:00 committed by GitHub
commit d5cf549376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,11 +47,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.22, on create, set AllowLongNodeID=false
// in 1.23, on create, set AllowLongNodeID=true
validateOptions := validation.CSINodeValidationOptions{
AllowLongNodeID: false,
AllowLongNodeID: true,
}
errs := validation.ValidateCSINode(csiNode, validateOptions)
@ -77,16 +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.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) {
allowLongNodeID = true
}
}
validateOptions := validation.CSINodeValidationOptions{
AllowLongNodeID: allowLongNodeID,
AllowLongNodeID: true,
}
errorList := validation.ValidateCSINode(newCSINodeObj, validateOptions)