Skip to content

Commit b8620be

Browse files
committed
update more
Signed-off-by: zirain <[email protected]>
1 parent e004096 commit b8620be

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

internal/gatewayapi/testdata/envoyproxy-accesslog-file-json-no-format.out.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ gatewayClass:
1111
kind: EnvoyProxy
1212
name: test
1313
namespace: envoy-gateway-system
14-
status: {}
14+
status:
15+
conditions:
16+
- lastTransitionTime: null
17+
message: Valid GatewayClass
18+
reason: Accepted
19+
status: "True"
20+
type: Accepted
1521
gateways:
1622
- apiVersion: gateway.networking.k8s.io/v1
1723
kind: Gateway

internal/gatewayapi/translator.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,10 @@ func (t *Translator) GetRelevantGateways(resources *resource.Resources) (
292292
) {
293293
envoyproxyMap := make(map[types.NamespacedName]*egv1a1.EnvoyProxy, len(resources.EnvoyProxiesForGateways)+1)
294294
envoyproxyValidationErrorMap := make(map[types.NamespacedName]error, len(resources.EnvoyProxiesForGateways))
295-
// make sure that the EnvoyProxyForGatewayClass is valid
296-
// TODO: how to handle EnvoyProxy for GatewayClass not found?
295+
296+
// if EnvoyProxy not found, provider layer set GC status to not accepted.
297+
// if EnvoyProxy found but invalid, set GC status to not accepted,
298+
// otherwise set GC status to accepted.
297299
if ep := resources.EnvoyProxyForGatewayClass; ep != nil {
298300
err := validateEnvoyProxy(ep)
299301
if err != nil {
@@ -305,11 +307,14 @@ func (t *Translator) GetRelevantGateways(resources *resource.Resources) (
305307
fmt.Sprintf("%s: %v", status.MsgGatewayClassInvalidParams, err))
306308
return
307309
} else {
308-
status.SetGatewayClassAccepted(
309-
resources.GatewayClass,
310-
true,
311-
string(gwapiv1.GatewayClassReasonAccepted),
312-
status.MsgValidGatewayClass)
310+
// TODO: remove this nil check after we update all the testdata.
311+
if resources.GatewayClass != nil {
312+
status.SetGatewayClassAccepted(
313+
resources.GatewayClass,
314+
true,
315+
string(gwapiv1.GatewayClassReasonAccepted),
316+
status.MsgValidGatewayClass)
317+
}
313318
}
314319

315320
key := utils.NamespacedName(ep)

0 commit comments

Comments
 (0)