Skip to content

Commit b0fb534

Browse files
committed
skip reconcile if spec not changed
1 parent 939589b commit b0fb534

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/controller/etcdcluster_controller.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import (
2121
"fmt"
2222
"slices"
2323

24+
"sigs.k8s.io/controller-runtime/pkg/builder"
25+
"sigs.k8s.io/controller-runtime/pkg/predicate"
26+
2427
appsv1 "k8s.io/api/apps/v1"
2528
corev1 "k8s.io/api/core/v1"
2629
"k8s.io/apimachinery/pkg/api/errors"
@@ -437,7 +440,7 @@ func (r *EtcdClusterReconciler) updateClusterState(cluster *etcdaenixiov1alpha1.
437440
// SetupWithManager sets up the controller with the Manager.
438441
func (r *EtcdClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
439442
return ctrl.NewControllerManagedBy(mgr).
440-
For(&etcdaenixiov1alpha1.EtcdCluster{}).
443+
For(&etcdaenixiov1alpha1.EtcdCluster{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
441444
Owns(&appsv1.StatefulSet{}).
442445
Owns(&corev1.ConfigMap{}).
443446
Owns(&corev1.Service{}).

0 commit comments

Comments
 (0)