AlinsRan commented on code in PR #2444:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2444#discussion_r2181932566


##########
internal/controller/gatewayproxy_controller.go:
##########
@@ -0,0 +1,174 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package controller
+
+import (
+       "context"
+       "errors"
+
+       "github.com/go-logr/logr"
+       corev1 "k8s.io/api/core/v1"
+       discoveryv1 "k8s.io/api/discovery/v1"
+       networkingv1 "k8s.io/api/networking/v1"
+       "k8s.io/apimachinery/pkg/runtime"
+       "k8s.io/apimachinery/pkg/types"
+       ctrl "sigs.k8s.io/controller-runtime"
+       "sigs.k8s.io/controller-runtime/pkg/client"
+       "sigs.k8s.io/controller-runtime/pkg/handler"
+       "sigs.k8s.io/controller-runtime/pkg/reconcile"
+       v1 "sigs.k8s.io/gateway-api/apis/v1"
+
+       "github.com/apache/apisix-ingress-controller/api/v1alpha1"
+       
"github.com/apache/apisix-ingress-controller/internal/controller/indexer"
+       "github.com/apache/apisix-ingress-controller/internal/provider"
+       "github.com/apache/apisix-ingress-controller/internal/utils"
+)
+
+// GatewayProxyController reconciles a GatewayProxy object.
+type GatewayProxyController struct {
+       client.Client
+
+       Scheme   *runtime.Scheme
+       Log      logr.Logger
+       Provider provider.Provider
+}
+
+func (r *GatewayProxyController) SetupWithManager(mrg ctrl.Manager) error {
+       return ctrl.NewControllerManagedBy(mrg).
+               For(&v1alpha1.GatewayProxy{}).
+               Watches(&corev1.Service{},
+                       
handler.EnqueueRequestsFromMapFunc(r.listGatewayProxiesForProviderService),
+               ).
+               Watches(&discoveryv1.EndpointSlice{},
+                       
handler.EnqueueRequestsFromMapFunc(r.listGatewayProxiesForProviderEndpointSlice),
+               ).
+               Watches(&corev1.Secret{},
+                       
handler.EnqueueRequestsFromMapFunc(r.listGatewayProxiesForSecret),
+               ).
+               Complete(r)
+}
+
+func (r *GatewayProxyController) Reconcile(ctx context.Context, req 
ctrl.Request) (reconcile.Result, error) {
+       var gp v1alpha1.GatewayProxy
+       if err := r.Get(ctx, req.NamespacedName, &gp); err != nil {

Review Comment:
   Do we not need to handle deletion events?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to