|
9 | 9 | "sigs.k8s.io/aws-load-balancer-controller/pkg/gateway/constants" |
10 | 10 | "sigs.k8s.io/controller-runtime/pkg/client" |
11 | 11 | gwv1 "sigs.k8s.io/gateway-api/apis/v1" |
12 | | - gwalpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" |
13 | 12 | ) |
14 | 13 |
|
15 | 14 | // IsGatewayManagedByLBController checks if a Gateway is managed by the ALB/NLB Gateway Controller |
@@ -104,48 +103,6 @@ func GetImpactedGatewaysFromParentRefs(ctx context.Context, k8sClient client.Cli |
104 | 103 | return impactedGateways, err |
105 | 104 | } |
106 | 105 |
|
107 | | -func GetImpactedGatewaysFromBackendRefs(ctx context.Context, k8sClient client.Client, tcpRoutes []gwalpha2.TCPRouteRule, resourceNamespace string, gwController string) ([]types.NamespacedName, error) { |
108 | | - resultSet := sets.New[types.NamespacedName]() |
109 | | - processedSet := sets.New[types.NamespacedName]() |
110 | | - errorSet := sets.New[types.NamespacedName]() |
111 | | - for _, route := range tcpRoutes { |
112 | | - for _, ref := range route.BackendRefs { |
113 | | - if ref.Kind == nil || *ref.Kind != "Gateway" { |
114 | | - continue |
115 | | - } |
116 | | - |
117 | | - ns := resourceNamespace |
118 | | - if ref.Namespace != nil { |
119 | | - ns = string(*ref.Namespace) |
120 | | - } |
121 | | - nsn := types.NamespacedName{ |
122 | | - Namespace: ns, |
123 | | - Name: string(ref.Name), |
124 | | - } |
125 | | - if processedSet.Has(nsn) { |
126 | | - continue |
127 | | - } |
128 | | - |
129 | | - gw := &gwv1.Gateway{} |
130 | | - if err := k8sClient.Get(ctx, nsn, gw); err != nil { |
131 | | - // Ignore and continue processing other refs |
132 | | - errorSet.Insert(nsn) |
133 | | - continue |
134 | | - } |
135 | | - processedSet.Insert(nsn) |
136 | | - |
137 | | - if IsGatewayManagedByLBController(ctx, k8sClient, gw, gwController) { |
138 | | - resultSet.Insert(nsn) |
139 | | - } |
140 | | - } |
141 | | - } |
142 | | - var err error |
143 | | - if resultSet.Len() > 0 { |
144 | | - err = fmt.Errorf("failed to list gateways, %s", resultSet.UnsortedList()) |
145 | | - } |
146 | | - return resultSet.UnsortedList(), err |
147 | | -} |
148 | | - |
149 | 106 | // GetImpactedGatewayClassesFromLbConfig identifies GatewayClasses affected by LoadBalancer configuration changes. |
150 | 107 | // Returns GatewayClasses that reference the specified LoadBalancer configuration. |
151 | 108 | func GetImpactedGatewayClassesFromLbConfig(ctx context.Context, k8sClient client.Client, lbconfig *elbv2gw.LoadBalancerConfiguration, gwControllers sets.Set[string]) (map[string]*gwv1.GatewayClass, error) { |
|
0 commit comments