add ResourceVersion check to Preconditions#Check

Kubernetes-commit: 3135cea2cce02bc8c6796e97f4579d538f357f74
This commit is contained in:
ajatprabha 2019-02-15 12:30:34 +05:30 committed by Kubernetes Publisher
parent e6793285a2
commit ad205f8388
1 changed files with 7 additions and 1 deletions

View File

@ -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