Skip to content

Commit 9e13b19

Browse files
committed
gateway tls config
1 parent a1d2106 commit 9e13b19

File tree

7 files changed

+171
-366
lines changed

7 files changed

+171
-366
lines changed

apis/v1/gateway_types.go

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,12 @@ 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+
// <gateway:experimental>
310301
//
311-
// Support: Core
312302
// +optional
313-
//
314-
// <gateway:experimental>
315-
TLSConfigs []TLSConfig `json:"tlsConfigs,omitempty"`
303+
TLS *GatewayTLSConfig `json:"tls,omitempty"`
316304
}
317305

318306
// AllowedListeners defines which ListenerSets can be attached to this Gateway.
@@ -612,6 +600,31 @@ type ListenerTLSConfig struct {
612600
Options map[AnnotationKey]AnnotationValue `json:"options,omitempty"`
613601
}
614602

603+
// GatewayTLSConfig specifies frontend tls configuration for gateway.
604+
type GatewayTLSConfig struct {
605+
// defaultTLS specifies the default client certificate validation configuration
606+
// for all Listeners handling HTTPS traffic, unless a per-port configuration
607+
// is defined.
608+
//
609+
// support: Core
610+
//
611+
// +required
612+
// <gateway:experimental>
613+
defaultTLS FrontendTLSValidation
614+
615+
// tlsPerPort specifies tls configuration assigned per port.
616+
// Per port configuration is optional. Once set this configuration overrides
617+
// the default configuration for all Listeners handling HTTPS traffic
618+
// that match this port.
619+
// Each override port requires a unique TLS configuration.
620+
//
621+
// support: Core
622+
//
623+
// +optional
624+
// <gateway:experimental>
625+
tlsPerPort []TLSConfig
626+
}
627+
615628
// TLSModeType type defines how a Gateway handles TLS sessions.
616629
//
617630
// +kubebuilder:validation:Enum=Terminate;Passthrough
@@ -630,18 +643,17 @@ const (
630643
TLSModePassthrough TLSModeType = "Passthrough"
631644
)
632645

633-
// TLSConfig describes a TLS configuration that can be applied to all Gateway
634-
// Listeners or to all Listeners matching the Port if set.
646+
// TLSConfig describes a TLS configuration defined per port.
635647
type TLSConfig struct {
636648
// 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.
649+
// applied. This configuration will be applied to all Listeners handling HTTPS
650+
// traffic that match this port.
639651
//
640652
// Support: Extended
641653
//
642-
// +optional
654+
// +required
643655
// <gateway:experimental>
644-
Port *PortNumber `json:"port,omitempty"`
656+
Port PortNumber `json:"port,omitempty"`
645657
//
646658
// FrontendValidation holds configuration information for validating the frontend (client).
647659
// Setting this field will result in mutual authentication when connecting to the gateway.
@@ -651,9 +663,8 @@ type TLSConfig struct {
651663
//
652664
// Support: Extended
653665
//
654-
// +optional
655666
// <gateway:experimental>
656-
FrontendValidation *FrontendTLSValidation `json:"frontendValidation,omitempty"`
667+
FrontendValidation FrontendTLSValidation `json:"frontendValidation,omitempty"`
657668
}
658669

659670
// FrontendTLSValidation holds configuration information that can be used to validate

apis/v1/zz_generated.deepcopy.go

Lines changed: 28 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/internal/internal.go

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

0 commit comments

Comments
 (0)