Skip to content

Commit e003d67

Browse files
committed
gateway tls config
1 parent a1d2106 commit e003d67

File tree

12 files changed

+873
-435
lines changed

12 files changed

+873
-435
lines changed

apis/v1/gateway_types.go

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,13 @@ type GatewaySpec struct {
295295
//
296296
// +optional
297297
AllowedListeners *AllowedListeners `json:"allowedListeners,omitempty"`
298-
299-
// TLSConfigs stores TLS configurations for a Gateway.
298+
// GatewayTLSConfig specifies frontend tls configuration for gateway.
300299
//
301-
// - If the `port` field in `TLSConfig` is not set, the TLS configuration applies
302-
// to all listeners in the gateway. We call this `default` configuration.
303-
// - If the `port` field in `TLSConfig` is set, the TLS configuration applies
304-
// only to listeners with a matching port. Each port requires a unique TLS configuration.
305-
// - Per-port configurations can override the `default` configuration.
306-
// - The `default` configuration is optional. Clients can apply TLS configuration
307-
// to a subset of listeners by creating only per-port configurations.
308-
// Listeners with a port that does not match any TLS configuration will
309-
// not have `frontendValidation` set.
300+
// Support: Extended
310301
//
311-
// Support: Core
312302
// +optional
313-
//
314303
// <gateway:experimental>
315-
TLSConfigs []TLSConfig `json:"tlsConfigs,omitempty"`
304+
TLS *GatewayTLSConfig `json:"tls,omitempty"`
316305
}
317306

318307
// AllowedListeners defines which ListenerSets can be attached to this Gateway.
@@ -612,6 +601,31 @@ type ListenerTLSConfig struct {
612601
Options map[AnnotationKey]AnnotationValue `json:"options,omitempty"`
613602
}
614603

604+
// GatewayTLSConfig specifies frontend tls configuration for gateway.
605+
type GatewayTLSConfig struct {
606+
// default specifies the default client certificate validation configuration
607+
// for all Listeners handling HTTPS traffic, unless a per-port configuration
608+
// is defined.
609+
//
610+
// support: Core
611+
//
612+
// +required
613+
// <gateway:experimental>
614+
Default TLSConfig `json:"default"`
615+
616+
// PerPort specifies tls configuration assigned per port.
617+
// Per port configuration is optional. Once set this configuration overrides
618+
// the default configuration for all Listeners handling HTTPS traffic
619+
// that match this port.
620+
// Each override port requires a unique TLS configuration.
621+
//
622+
// support: Core
623+
//
624+
// +optional
625+
// <gateway:experimental>
626+
PerPort []TLSPortConfig `json:"perport,omitempty"`
627+
}
628+
615629
// TLSModeType type defines how a Gateway handles TLS sessions.
616630
//
617631
// +kubebuilder:validation:Enum=Terminate;Passthrough
@@ -630,30 +644,40 @@ const (
630644
TLSModePassthrough TLSModeType = "Passthrough"
631645
)
632646

633-
// TLSConfig describes a TLS configuration that can be applied to all Gateway
634-
// Listeners or to all Listeners matching the Port if set.
647+
// TLSConfig describes a TLS configuration. Currently, it stores only the client
648+
// certificate validation configuration, but this may be extended in the future.
635649
type TLSConfig struct {
636-
// The Port indicates the Port Number to which the TLS configuration will be
637-
// applied. If the field is not set the TLS Configuration will be applied to
638-
// all Listeners.
639-
//
640-
// Support: Extended
641-
//
642-
// +optional
643-
// <gateway:experimental>
644-
Port *PortNumber `json:"port,omitempty"`
645-
//
646650
// FrontendValidation holds configuration information for validating the frontend (client).
647651
// Setting this field will result in mutual authentication when connecting to the gateway.
648652
// In browsers this may result in a dialog appearing
649653
// that requests a user to specify the client certificate.
650654
// The maximum depth of a certificate chain accepted in verification is Implementation specific.
651655
//
652-
// Support: Extended
656+
// Support: Core
653657
//
654-
// +optional
658+
// +required
659+
// <gateway:experimental>
660+
FrontendValidation FrontendTLSValidation `json:"frontendValidation"`
661+
}
662+
663+
type TLSPortConfig struct {
664+
// The Port indicates the Port Number to which the TLS configuration will be
665+
// applied. This configuration will be applied to all Listeners handling HTTPS
666+
// traffic that match this port.
667+
//
668+
// Support: Core
669+
//
670+
// +required
671+
// <gateway:experimental>
672+
Port PortNumber `json:"port"`
673+
// TLS store the configuration that will be applied to all Listeners handling
674+
// HTTPS traffic and matching given port.
675+
//
676+
// Support: Core
677+
//
678+
// +required
655679
// <gateway:experimental>
656-
FrontendValidation *FrontendTLSValidation `json:"frontendValidation,omitempty"`
680+
TLS TLSConfig `json:"tls"`
657681
}
658682

659683
// FrontendTLSValidation holds configuration information that can be used to validate
@@ -685,7 +709,7 @@ type FrontendTLSValidation struct {
685709
// +listType=atomic
686710
// +kubebuilder:validation:MaxItems=8
687711
// +kubebuilder:validation:MinItems=1
688-
CACertificateRefs []ObjectReference `json:"caCertificateRefs,omitempty"`
712+
CACertificateRefs []ObjectReference `json:"caCertificateRefs"`
689713

690714
// FrontendValidationMode defines the mode for validating the client certificate.
691715
// There are two possible modes:

apis/v1/zz_generated.deepcopy.go

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

applyconfiguration/apis/v1/gatewayspec.go

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

applyconfiguration/apis/v1/gatewaytlsconfig.go

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

applyconfiguration/apis/v1/tlsconfig.go

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

applyconfiguration/apis/v1/tlsportconfig.go

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

0 commit comments

Comments
 (0)