Skip to content

Commit

Permalink
internal/dag: Gateway Listeners with invalid references should have r…
Browse files Browse the repository at this point in the history
…eason RefNotPermitted (#4664)

See kubernetes-sigs/gateway-api#1305 and kubernetes-sigs/gateway-api#1334

Fixes conformance test failures on main

Signed-off-by: Sunjay Bhatia <sunjayb@vmware.com>
  • Loading branch information
sunjayBhatia authored Aug 25, 2022
1 parent fc49f3b commit 6e6099a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/4664-sunjayBhatia-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Gateway Listeners with Secret references whose namespace is not covered by a ReferenceGrant should have their status reason set to RefNotPermitted.
2 changes: 1 addition & 1 deletion internal/dag/gatewayapi_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ func (p *GatewayAPIProcessor) resolveListenerSecret(certificateRefs []gatewayapi
listenerName,
gatewayapi_v1beta1.ListenerConditionResolvedRefs,
metav1.ConditionFalse,
gatewayapi_v1beta1.ListenerReasonInvalidCertificateRef,
gatewayapi_v1beta1.ListenerReasonRefNotPermitted,
fmt.Sprintf("Spec.VirtualHost.TLS.CertificateRefs %q namespace must match the Gateway's namespace or be covered by a ReferencePolicy/ReferenceGrant", certificateRef.Name),
)
return nil
Expand Down
12 changes: 6 additions & 6 deletions internal/dag/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3871,7 +3871,7 @@ func TestGatewayAPIHTTPRouteDAGStatus(t *testing.T) {
{
Type: string(gatewayapi_v1beta1.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(gatewayapi_v1beta1.ListenerReasonInvalidCertificateRef),
Reason: string(gatewayapi_v1beta1.ListenerReasonRefNotPermitted),
Message: "Spec.VirtualHost.TLS.CertificateRefs \"secret\" namespace must match the Gateway's namespace or be covered by a ReferencePolicy/ReferenceGrant",
},
},
Expand Down Expand Up @@ -4015,7 +4015,7 @@ func TestGatewayAPIHTTPRouteDAGStatus(t *testing.T) {
{
Type: string(gatewayapi_v1beta1.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(gatewayapi_v1beta1.ListenerReasonInvalidCertificateRef),
Reason: string(gatewayapi_v1beta1.ListenerReasonRefNotPermitted),
Message: "Spec.VirtualHost.TLS.CertificateRefs \"secret\" namespace must match the Gateway's namespace or be covered by a ReferencePolicy/ReferenceGrant",
},
},
Expand Down Expand Up @@ -4103,7 +4103,7 @@ func TestGatewayAPIHTTPRouteDAGStatus(t *testing.T) {
{
Type: string(gatewayapi_v1beta1.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(gatewayapi_v1beta1.ListenerReasonInvalidCertificateRef),
Reason: string(gatewayapi_v1beta1.ListenerReasonRefNotPermitted),
Message: "Spec.VirtualHost.TLS.CertificateRefs \"secret\" namespace must match the Gateway's namespace or be covered by a ReferencePolicy/ReferenceGrant",
},
},
Expand Down Expand Up @@ -4191,7 +4191,7 @@ func TestGatewayAPIHTTPRouteDAGStatus(t *testing.T) {
{
Type: string(gatewayapi_v1beta1.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(gatewayapi_v1beta1.ListenerReasonInvalidCertificateRef),
Reason: string(gatewayapi_v1beta1.ListenerReasonRefNotPermitted),
Message: "Spec.VirtualHost.TLS.CertificateRefs \"secret\" namespace must match the Gateway's namespace or be covered by a ReferencePolicy/ReferenceGrant",
},
},
Expand Down Expand Up @@ -4279,7 +4279,7 @@ func TestGatewayAPIHTTPRouteDAGStatus(t *testing.T) {
{
Type: string(gatewayapi_v1beta1.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(gatewayapi_v1beta1.ListenerReasonInvalidCertificateRef),
Reason: string(gatewayapi_v1beta1.ListenerReasonRefNotPermitted),
Message: "Spec.VirtualHost.TLS.CertificateRefs \"secret\" namespace must match the Gateway's namespace or be covered by a ReferencePolicy/ReferenceGrant",
},
},
Expand Down Expand Up @@ -4368,7 +4368,7 @@ func TestGatewayAPIHTTPRouteDAGStatus(t *testing.T) {
{
Type: string(gatewayapi_v1beta1.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(gatewayapi_v1beta1.ListenerReasonInvalidCertificateRef),
Reason: string(gatewayapi_v1beta1.ListenerReasonRefNotPermitted),
Message: "Spec.VirtualHost.TLS.CertificateRefs \"secret\" namespace must match the Gateway's namespace or be covered by a ReferencePolicy/ReferenceGrant",
},
},
Expand Down

0 comments on commit 6e6099a

Please sign in to comment.