Skip to content

Commit

Permalink
Added watch for subscription and SMCP
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhAgniRedhat committed Aug 7, 2024
1 parent 08ee682 commit 33e66d8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/operator/controller/gatewayclass/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (

logf "github.com/openshift/cluster-ingress-operator/pkg/log"

maistrav2 "github.com/maistra/istio-operator/pkg/apis/maistra/v2"
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"

"k8s.io/client-go/tools/record"

gatewayapiv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
Expand All @@ -14,6 +17,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/predicate"
Expand Down Expand Up @@ -61,6 +65,24 @@ func NewUnmanaged(mgr manager.Manager, config Config) (controller.Controller, er
if err := c.Watch(source.Kind(operatorCache, &gatewayapiv1beta1.GatewayClass{}), &handler.EnqueueRequestForObject{}, isOurGatewayClass, predicate.Not(isIstioGatewayClass)); err != nil {
return nil, err
}
if err := c.Watch(source.Kind(operatorCache, &maistrav2.ServiceMeshControlPlane{}), &handler.EnqueueRequestForObject{}, predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool { return false },
DeleteFunc: func(e event.DeleteEvent) bool { return true },
UpdateFunc: func(e event.UpdateEvent) bool { return false },
GenericFunc: func(e event.GenericEvent) bool { return false },
}); err != nil {
return nil, err
}

if err := c.Watch(source.Kind(operatorCache, &operatorsv1alpha1.Subscription{}), &handler.EnqueueRequestForObject{}, predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool { return false },
DeleteFunc: func(e event.DeleteEvent) bool { return true },
UpdateFunc: func(e event.UpdateEvent) bool { return false },
GenericFunc: func(e event.GenericEvent) bool { return false },
}); err != nil {
return nil, err
}

return c, nil
}

Expand Down

0 comments on commit 33e66d8

Please sign in to comment.