Skip to content

Commit 69e4a75

Browse files
committed
resolve comments
1 parent da6bffa commit 69e4a75

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

internal/controller/ingressclass_v1beta1_controller.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,16 @@ func (r *IngressClassV1beta1Reconciler) processInfrastructure(tctx *provider.Tra
187187
return nil
188188
}
189189

190+
// Since v1beta1 does not support specifying the target namespace,
191+
// and GatewayProxy is a namespace-scoped resource, we default to using
192+
// the "default" namespace for convenience.
190193
namespace := "default"
191194
if IngressClassV1beta1.Spec.Parameters.Namespace != nil {
192195
namespace = *IngressClassV1beta1.Spec.Parameters.Namespace
193196
}
194197

195198
gatewayProxy := new(v1alpha1.GatewayProxy)
196-
if err := r.Get(context.Background(), client.ObjectKey{
199+
if err := r.Get(tctx, client.ObjectKey{
197200
Namespace: namespace,
198201
Name: IngressClassV1beta1.Spec.Parameters.Name,
199202
}, gatewayProxy); err != nil {
@@ -212,7 +215,7 @@ func (r *IngressClassV1beta1Reconciler) processInfrastructure(tctx *provider.Tra
212215
if auth.AdminKey.ValueFrom.SecretKeyRef != nil {
213216
secretRef := auth.AdminKey.ValueFrom.SecretKeyRef
214217
secret := &corev1.Secret{}
215-
if err := r.Get(context.Background(), client.ObjectKey{
218+
if err := r.Get(tctx, client.ObjectKey{
216219
Namespace: namespace,
217220
Name: secretRef.Name,
218221
}, secret); err != nil {

internal/controller/utils.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import (
4141
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4242
"k8s.io/apimachinery/pkg/labels"
4343
k8stypes "k8s.io/apimachinery/pkg/types"
44-
"k8s.io/utils/ptr"
4544
ctrl "sigs.k8s.io/controller-runtime"
4645
"sigs.k8s.io/controller-runtime/pkg/client"
4746
"sigs.k8s.io/controller-runtime/pkg/event"
@@ -1571,16 +1570,6 @@ func MatchConsumerGatewayRef(ctx context.Context, c client.Client, log logr.Logg
15711570
return matchesController(string(gatewayClass.Spec.ControllerName))
15721571
}
15731572

1574-
func GetIngressClassName(obj client.Object) string {
1575-
switch t := obj.(type) {
1576-
case *networkingv1.Ingress:
1577-
return ptr.Deref(t.Spec.IngressClassName, "")
1578-
case *networkingv1beta1.IngressClass:
1579-
return ""
1580-
}
1581-
return ""
1582-
}
1583-
15841573
// watchEndpointSliceOrEndpoints adds watcher for EndpointSlice or Endpoints based on cluster API support
15851574
func watchEndpointSliceOrEndpoints(bdr *ctrl.Builder, supportsEndpointSlice bool, endpointSliceMapFunc, endpointsMapFunc handler.MapFunc, log logr.Logger) *ctrl.Builder {
15861575
if supportsEndpointSlice {

internal/manager/controllers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func registerV2ForReadinessGVK(mgr manager.Manager, readier readiness.ReadinessM
257257
types.GvkOf(&apiv2.ApisixConsumer{}),
258258
}
259259
if utils.HasAPIResource(mgr, &netv1.Ingress{}) {
260-
gvks = append(gvks, types.GvkOf(&netv1.IngressClass{}))
260+
gvks = append(gvks, types.GvkOf(&netv1.Ingress{}))
261261
}
262262

263263
c := mgr.GetClient()

0 commit comments

Comments
 (0)