add ResourceVersion check to Preconditions#Check
Kubernetes-commit: 3135cea2cce02bc8c6796e97f4579d538f357f74
This commit is contained in:
parent
e6793285a2
commit
ad205f8388
|
|
@ -128,8 +128,14 @@ func (p *Preconditions) Check(key string, obj runtime.Object) error {
|
|||
objMeta.GetUID())
|
||||
return NewInvalidObjError(key, err)
|
||||
}
|
||||
if p.ResourceVersion != nil && *p.ResourceVersion != objMeta.GetResourceVersion() {
|
||||
err := fmt.Sprintf(
|
||||
"Precondition failed: ResourceVersion in precondition: %v, ResourceVersion in object meta: %v",
|
||||
*p.ResourceVersion,
|
||||
objMeta.GetResourceVersion())
|
||||
return NewInvalidObjError(key, err)
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
// Interface offers a common interface for object marshaling/unmarshaling operations and
|
||||
|
|
|
|||
Loading…
Reference in New Issue