1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-15 17:51:01 +00:00

fix: update condition when error message changes

fixes #116
This commit is contained in:
Moritz Johner 2021-05-01 19:03:16 +02:00
parent b843b5f149
commit f49de4f887
2 changed files with 7 additions and 1 deletions

View file

@ -28,6 +28,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/predicate"
esv1alpha1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1alpha1"
"github.com/external-secrets/external-secrets/pkg/provider"
@ -231,8 +232,12 @@ func (r *Reconciler) getProviderSecretData(ctx context.Context, providerClient p
}
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
// prevent reconcile on status updates
// https://github.com/kubernetes-sigs/kubebuilder/issues/618#issuecomment-698018831
pred := predicate.GenerationChangedPredicate{}
return ctrl.NewControllerManagedBy(mgr).
For(&esv1alpha1.ExternalSecret{}).
WithEventFilter(pred).
Owns(&corev1.Secret{}).
Complete(r)
}

View file

@ -46,7 +46,8 @@ func GetExternalSecretCondition(status esv1alpha1.ExternalSecretStatus, condType
func SetExternalSecretCondition(es *esv1alpha1.ExternalSecret, condition esv1alpha1.ExternalSecretStatusCondition) {
currentCond := GetExternalSecretCondition(es.Status, condition.Type)
if currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason {
if currentCond != nil && currentCond.Status == condition.Status &&
currentCond.Reason == condition.Reason && currentCond.Message == condition.Message {
updateExternalSecretCondition(es, &condition, 1.0)
return
}