diff --git a/pkg/operator/controller/gatewayclass/controller.go b/pkg/operator/controller/gatewayclass/controller.go index 800214ac53..ac31006f2f 100644 --- a/pkg/operator/controller/gatewayclass/controller.go +++ b/pkg/operator/controller/gatewayclass/controller.go @@ -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" @@ -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" @@ -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 }