Explorar o código

Added log for first secret reconciliation after errors
Fixes #444

Signed-off-by: Gustavo Fernandes de Carvalho <gustavo.carvalho@container-solutions.com>

Gustavo Fernandes de Carvalho %!s(int64=4) %!d(string=hai) anos
pai
achega
b8ba78d1b1

+ 6 - 1
pkg/controllers/externalsecret/externalsecret_controller.go

@@ -238,11 +238,16 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
 	}
 
 	conditionSynced := NewExternalSecretCondition(esv1alpha1.ExternalSecretReady, v1.ConditionTrue, esv1alpha1.ConditionReasonSecretSynced, "Secret was synced")
+	currCond := GetExternalSecretCondition(externalSecret.Status, esv1alpha1.ExternalSecretReady)
 	SetExternalSecretCondition(&externalSecret, *conditionSynced)
 	externalSecret.Status.RefreshTime = metav1.NewTime(time.Now())
 	externalSecret.Status.SyncedResourceVersion = getResourceVersion(externalSecret)
 	syncCallsTotal.With(syncCallsMetricLabels).Inc()
-	log.V(1).Info("reconciled secret")
+	if currCond == nil || currCond.Status != conditionSynced.Status {
+		log.Info("reconciled secret")
+	} else {
+		log.V(1).Info("reconciled secret")
+	}
 
 	return ctrl.Result{
 		RequeueAfter: refreshInt,