Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/dag: Gateway Listeners with invalid references should have reason RefNotPermitted #4664

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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