diff --git a/condition/condition.go b/condition/condition.go index 7f5d22a6e..45926714e 100644 --- a/condition/condition.go +++ b/condition/condition.go @@ -87,7 +87,19 @@ func (c Cond) Once(obj runtime.Object, f func() (runtime.Object, error)) (runtim return obj, nil } +func (c Cond) DoUntilTrue(obj runtime.Object, f func() (runtime.Object, error)) (runtime.Object, error) { + if c.IsTrue(obj) { + return obj, nil + } + + return c.do(obj, f) +} + func (c Cond) Do(obj runtime.Object, f func() (runtime.Object, error)) (runtime.Object, error) { + return c.do(obj, f) +} + +func (c Cond) do(obj runtime.Object, f func() (runtime.Object, error)) (runtime.Object, error) { c.Unknown(obj) newObj, err := f() if newObj != nil {