From f053fc9745b22c8fedae28ba07a72a25e31e0212 Mon Sep 17 00:00:00 2001 From: Raghavi Shirur Date: Mon, 4 Sep 2023 16:49:06 +0530 Subject: [PATCH] added label selector logs --- controllers/argocd/argocd_controller.go | 7 ++++--- main.go | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/controllers/argocd/argocd_controller.go b/controllers/argocd/argocd_controller.go index ff1198664..73909b146 100644 --- a/controllers/argocd/argocd_controller.go +++ b/controllers/argocd/argocd_controller.go @@ -107,17 +107,18 @@ func (r *ReconcileArgoCD) Reconcile(ctx context.Context, request ctrl.Request) ( // Error reading the object - requeue the request. return reconcile.Result{}, err } + //debug line + fmt.Println(r.LabelSelector) // Fetch labelSelector from r.LabelSelector (command-line option) labelSelector, err := labels.Parse(r.LabelSelector) if err != nil { - reqLogger.Info("error parsing the labelSelector '%s'.", labelSelector) + reqLogger.Info(fmt.Sprintf("error parsing the labelSelector '%s'.", labelSelector)) return reconcile.Result{}, err } - // Match the value of labelSelector from ReconcileArgoCD to labels from the argocd instance if !labelSelector.Matches(labels.Set(argocd.Labels)) { - reqLogger.Info("the ArgoCD instance does not match the label selector %s and skipping for reconcillation", r.LabelSelector) + reqLogger.Info(fmt.Sprintf("the ArgoCD instance does not match the label selector '%s' and skipping for reconcillation", r.LabelSelector)) return reconcile.Result{}, nil } diff --git a/main.go b/main.go index e55315d2f..715b8dedc 100644 --- a/main.go +++ b/main.go @@ -104,6 +104,7 @@ func main() { setupLog.Info("error parsing the labelSelector '%s'.", labelSelectorFlag) os.Exit(1) } + setupLog.Info(fmt.Sprintf("Watching labelselector \"%s\"", labelSelectorFlag)) // Inspect cluster to verify availability of extra features if err := argocd.InspectCluster(); err != nil { @@ -194,7 +195,8 @@ func main() { os.Exit(1) } } - + setupLog.Info("AAAAAAAAAAA0") + setupLog.Info(labelSelectorFlag) if err = (&argocd.ReconcileArgoCD{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(),