mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 08:55:55 -04:00
add ResourceVersion check to Preconditions#Check
This commit is contained in:
parent
64ecf9de7f
commit
3135cea2cc
1 changed files with 7 additions and 1 deletions
|
|
@ -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 a new issue