mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #104160 from pacoxu/AllowLongNodeID-true
set AllowLongNodeID to true by default since 1.23
This commit is contained in:
commit
d5cf549376
@ -47,11 +47,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.22, on create, set AllowLongNodeID=false
|
|
||||||
// in 1.23, on create, set AllowLongNodeID=true
|
|
||||||
validateOptions := validation.CSINodeValidationOptions{
|
validateOptions := validation.CSINodeValidationOptions{
|
||||||
AllowLongNodeID: false,
|
AllowLongNodeID: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
errs := validation.ValidateCSINode(csiNode, validateOptions)
|
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 {
|
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.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{
|
validateOptions := validation.CSINodeValidationOptions{
|
||||||
AllowLongNodeID: allowLongNodeID,
|
AllowLongNodeID: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
errorList := validation.ValidateCSINode(newCSINodeObj, validateOptions)
|
errorList := validation.ValidateCSINode(newCSINodeObj, validateOptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user