Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Jan 16, 2024
1 parent 3c5d1ae commit 272fe75
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions common/flagdproxy/flagdproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ func (f *FlagdProxyHandler) HandleFlagdProxy(ctx context.Context) error {
}

func (f *FlagdProxyHandler) deployFlagdProxy(ctx context.Context) error {
ownerReferences, err := f.getOwnerReferences(ctx)
if err != nil {
f.Log.Error(err, "unable to create owner reference for open-feature-operator, not appending")
}
ownerReferences := f.getOwnerReferences(ctx)

f.Log.Info("deploying the flagd-proxy")
if err := f.Client.Create(ctx, f.newFlagdProxyManifest(ownerReferences)); err != nil && !errors.IsAlreadyExists(err) {
Expand Down Expand Up @@ -188,11 +185,7 @@ func (f *FlagdProxyHandler) doesFlagdProxyExist(ctx context.Context) (bool, erro
return false, err
}
// generate new Deployment struct
ownerReferences, err := f.getOwnerReferences(ctx)
if err != nil {
f.Log.Error(err, "unable to create owner reference for open-feature-operator, not appending")
}
newDeployment := f.newFlagdProxyManifest(ownerReferences)
newDeployment := f.newFlagdProxyManifest(f.getOwnerReferences(ctx))

if !f.isFlagdProxyUpToDate(d, newDeployment) {
f.Log.Info("flagd-proxy Deployment changed, updating")
Expand Down Expand Up @@ -229,13 +222,13 @@ func (f *FlagdProxyHandler) getOwnerReference(ctx context.Context) (metav1.Owner

}

func (f *FlagdProxyHandler) getOwnerReferences(ctx context.Context) ([]metav1.OwnerReference, error) {
func (f *FlagdProxyHandler) getOwnerReferences(ctx context.Context) []metav1.OwnerReference {
ownerReferences := []metav1.OwnerReference{}
ownerReference, err := f.getOwnerReference(ctx)
if err != nil {
f.Log.Error(err, "unable to create owner reference for open-feature-operator, not appending")
} else {
ownerReferences = append(ownerReferences, ownerReference)
}
return ownerReferences, nil
return ownerReferences
}

0 comments on commit 272fe75

Please sign in to comment.