Skip to content

Commit bc1e880

Browse files
committed
api: experimental ResolvedRefs condition for Gateway
Signed-off-by: Norwin Schnyder <[email protected]>
1 parent 41e57f2 commit bc1e880

File tree

3 files changed

+117
-41
lines changed

3 files changed

+117
-41
lines changed

apis/v1/gateway_types.go

Lines changed: 68 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -526,20 +526,30 @@ const (
526526

527527
// GatewayBackendTLS describes backend TLS configuration for gateway.
528528
type GatewayBackendTLS struct {
529-
// ClientCertificateRef is a reference to an object that contains a Client
530-
// Certificate and the associated private key.
531-
//
532-
// References to a resource in different namespace are invalid UNLESS there
533-
// is a ReferenceGrant in the target namespace that allows the certificate
534-
// to be attached. If a ReferenceGrant does not allow this reference, the
535-
// "ResolvedRefs" condition MUST be set to False for this listener with the
536-
// "RefNotPermitted" reason.
537-
//
538-
// ClientCertificateRef can reference to standard Kubernetes resources, i.e.
539-
// Secret, or implementation-specific custom resources.
540-
//
541-
// Support: Core
542-
//
529+
// ClientCertificateRef references an object that contains a client certificate
530+
// and its associated private key. It can reference standard Kubernetes resources,
531+
// i.e., Secret, or implementation-specific custom resources.
532+
//
533+
// A ClientCertificateRef is considered invalid if:
534+
//
535+
// * It refers to a resource that cannot be resolved (e.g., the referenced resource
536+
// does not exist) or is misconfigured (e.g., a Secret does not contain the keys
537+
// named `tls.crt` and `tls.key`). In this case, the `ResolvedRefs` condition
538+
// on the Gateway MUST be set to False with the Reason `InvalidClientCertificateRef`
539+
// and the Message of the Condition MUST indicate why the reference is invalid.
540+
//
541+
// * It refers to a resource in another namespace UNLESS there is a ReferenceGrant
542+
// in the target namespace that allows the certificate to be attached.
543+
// If a ReferenceGrant does not allow this reference, the `ResolvedRefs` condition
544+
// on the Gateway MUST be set to False with the Reason `RefNotPermitted`.
545+
//
546+
// Implementations MAY choose to perform further validation of the certificate
547+
// content (e.g., checking expiry or enforcing specific formats). In such cases,
548+
// an implementation-specific Reason and Message MUST be set.
549+
//
550+
// Support: Core - Reference to a Kubernetes TLS Secret (with the type `kubernetes.io/tls`).
551+
// Support: Implementation-specific - Other resource kinds or Secrets with a
552+
// different type (e.g., `Opaque`).
543553
// +optional
544554
// <gateway:experimental>
545555
ClientCertificateRef *SecretObjectReference `json:"clientCertificateRef,omitempty"`
@@ -1237,6 +1247,50 @@ const (
12371247
GatewayReasonNotReconciled GatewayConditionReason = "NotReconciled"
12381248
)
12391249

1250+
const (
1251+
// This condition indicates whether the controller was able to resolve all
1252+
// the object references for the Gateway that are not part of a specific
1253+
// Listener configuration.
1254+
//
1255+
// Possible reasons for this condition to be True are:
1256+
//
1257+
// * "ResolvedRefs"
1258+
//
1259+
// Possible reasons for this condition to be False are:
1260+
//
1261+
// * "RefNotPermitted"
1262+
// * "InvalidClientCertificateRef"
1263+
//
1264+
// Controllers may raise this condition with other reasons, but should
1265+
// prefer to use the reasons listed above to improve interoperability.
1266+
//
1267+
// Note: This condition is considered Experimental and may change in future
1268+
// releases of the API.
1269+
GatewayConditionResolvedRefs GatewayConditionType = "ResolvedRefs"
1270+
1271+
// This reason is used with the "ResolvedRefs" condition when the condition
1272+
// is true.
1273+
GatewayReasonResolvedRefs GatewayConditionReason = "ResolvedRefs"
1274+
1275+
// This reason is used with the "ResolvedRefs" condition when the Gateway
1276+
// has an invalid ClientCertificateRef in its backend TLS configuration.
1277+
// A ClientCertificateRef is considered invalid when it refers to a
1278+
// nonexistent or unsupported resource or kind, or when the data within
1279+
// that resource is malformed.
1280+
// This reason must be used only when the reference is allowed, either by
1281+
// referencing an object in the same namespace as the Gateway, or when
1282+
// a cross-namespace reference has been explicitly allowed by a ReferenceGrant.
1283+
// If the reference is not allowed, the reason RefNotPermitted must be used
1284+
// instead.
1285+
GatewayReasonInvalidClientCertificateRef GatewayConditionReason = "InvalidClientCertificateRef"
1286+
1287+
// This reason is used with the "ResolvedRefs" condition when the Gateway
1288+
// has a top-level backend TLS configuration that references an object in
1289+
// another namespace, where the object in the other namespace does not have
1290+
// a ReferenceGrant explicitly allowing the reference.
1291+
GatewayReasonRefNotPermitted GatewayConditionReason = "RefNotPermitted"
1292+
)
1293+
12401294
const (
12411295
// "Ready" is a condition type reserved for future use. It should not be used by implementations.
12421296
//

config/crd/experimental/gateway.networking.k8s.io_gateways.yaml

Lines changed: 48 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/openapi/zz_generated.openapi.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)