Skip to content

Commit 1dc0f24

Browse files
committed
Compare consoleLink before updating
1 parent b0f18f2 commit 1dc0f24

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

internal/controller/argo.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ func createOrUpdateArgoCD(client dynamic.Interface, fullClient kubernetes.Interf
561561
return fmt.Errorf("getArgoCD returned nil ArgoCD object for %s/%s", namespace, name)
562562
}
563563

564+
// ArgoCD is up to date, skipping update
564565
if compareArgoCD(argo, oldArgo) {
565-
log.Printf("ArgoCD %s/%s is up to date, skipping update", namespace, name)
566566
return nil
567567
}
568568

@@ -626,7 +626,14 @@ func createOrUpdateConsoleLink(client dynamic.Interface, argoName, argoNamespace
626626
_, err = client.Resource(gvr).Create(context.TODO(), consoleLinkObj, metav1.CreateOptions{})
627627
return err
628628
}
629-
// Update: carry over resourceVersion
629+
630+
existingSpec, _, _ := unstructured.NestedMap(existing.Object, "spec")
631+
desiredSpec, _, _ := unstructured.NestedMap(consoleLinkObj.Object, "spec")
632+
if apiequality.Semantic.DeepEqual(existingSpec, desiredSpec) {
633+
return nil
634+
}
635+
636+
log.Printf("ConsoleLink %s spec has changed, updating", linkName)
630637
consoleLinkObj.SetResourceVersion(existing.GetResourceVersion())
631638
_, err = client.Resource(gvr).Update(context.TODO(), consoleLinkObj, metav1.UpdateOptions{})
632639
return err

0 commit comments

Comments
 (0)