Skip to content

Commit

Permalink
Do not reconcile when terminal CR spec not changed.
Browse files Browse the repository at this point in the history
Signed-off-by: zzjin <[email protected]>
  • Loading branch information
zzjin committed Oct 24, 2024
1 parent 1dd468c commit 50186b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions controllers/terminal/controllers/terminal_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"

"github.com/labring/sealos/controllers/pkg/utils/label"
terminalv1 "github.com/labring/sealos/controllers/terminal/api/v1"
Expand Down Expand Up @@ -400,7 +402,9 @@ func (r *TerminalReconciler) SetupWithManager(mgr ctrl.Manager) error {
r.recorder = mgr.GetEventRecorderFor("sealos-terminal-controller")
r.Config = mgr.GetConfig()
return ctrl.NewControllerManagedBy(mgr).
For(&terminalv1.Terminal{}).
Owns(&appsv1.Deployment{}).Owns(&corev1.Service{}).Owns(&networkingv1.Ingress{}).
For(&terminalv1.Terminal{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
Owns(&appsv1.Deployment{}, builder.WithPredicates(predicate.ResourceVersionChangedPredicate{})).
Owns(&corev1.Service{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
Owns(&networkingv1.Ingress{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
Complete(r)
}

0 comments on commit 50186b1

Please sign in to comment.