diff --git a/common/flagdproxy/flagdproxy.go b/common/flagdproxy/flagdproxy.go index 6850bb60c..8f6935e5c 100644 --- a/common/flagdproxy/flagdproxy.go +++ b/common/flagdproxy/flagdproxy.go @@ -110,16 +110,14 @@ func (f *FlagdProxyHandler) ensureFlagdProxyResource(ctx context.Context, obj cl return err } - // If the object exists but is not managed by OFO, return an error - if !notFound && !common.IsManagedByOFO(old) { - return fmt.Errorf("%s not managed by OFO", obj.GetName()) - } - // If the object is not found, we will create it if notFound { return f.Client.Create(ctx, obj) } - + // If the object exists but is not managed by OFO, return an error + if !common.IsManagedByOFO(old) { + return fmt.Errorf("%s not managed by OFO", obj.GetName()) + } // If the object is found, update if necessary needsUpdate, err := specDiffers(obj, old) if err != nil {