Skip to content
52 changes: 47 additions & 5 deletions apis/gateway/v1beta1/targetgroupconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ type HealthCheckConfiguration struct {
// +optional
HealthCheckPath *string `json:"healthCheckPath,omitempty"`

// healthCheckPort The port to use to connect with the target.
// healthCheckPort The port the load balancer uses when performing health checks on targets.
// The default is to use the port on which each target receives traffic from the load balancer.
// +optional
HealthCheckPort *int32 `json:"healthCheckPort,omitempty"`
HealthCheckPort *string `json:"healthCheckPort,omitempty"`

// healthCheckProtocol The protocol to use to connect with the target. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.
// +optional
Expand Down Expand Up @@ -116,6 +117,18 @@ const (
TargetGroupHealthCheckProtocolTCP TargetGroupHealthCheckProtocol = "tcp"
)

// +kubebuilder:validation:Enum=HTTP;HTTPS;TCP;TLS;UDP;TCP_UDP
type Protocol string

const (
ProtocolHTTP Protocol = "HTTP"
ProtocolHTTPS Protocol = "HTTPS"
ProtocolTCP Protocol = "TCP"
ProtocolTLS Protocol = "TLS"
ProtocolUDP Protocol = "UDP"
ProtocolTCP_UDP Protocol = "TCP_UDP"
)

// +kubebuilder:validation:Enum=http1;http2;grpc
type ProtocolVersion string

Expand All @@ -125,12 +138,23 @@ const (
ProtocolVersionGRPC ProtocolVersion = "grpc"
)

// +kubebuilder:validation:Enum=none;prefer-route-specific;prefer-default
type MergeMode string

const (
MergeModeNone MergeMode = "none"
MergeModePreferRouteSpecific MergeMode = "prefer-route-specific"
MergeModePreferDefault MergeMode = "prefer-default"
)

// TargetGroupConfigurationSpec defines the TargetGroup properties for a route.
type TargetGroupConfigurationSpec struct {

// targetReference the kubernetes object to attach the Target Group settings to.
TargetReference Reference `json:"targetReference"`

// mergeMode the mode to use for merging the identified per-route configuration and default configuration.

// defaultRouteConfiguration fallback configuration applied to all routes, unless overridden by route-specific configurations.
// +optional
DefaultConfiguration TargetGroupProps `json:"defaultConfiguration,omitempty"`
Expand All @@ -141,19 +165,23 @@ type TargetGroupConfigurationSpec struct {
}

// +kubebuilder:validation:Pattern="^(HTTPRoute|TLSRoute|TCPRoute|UDPRoute|GRPCRoute)?:([^:]+)?:([^:]+)?$"
type RouteName string
type RouteIdentifier string

// RouteConfiguration defines the per route configuration
type RouteConfiguration struct {
// name the name of the route, it should be in the form of ROUTE:NAMESPACE:NAME
Name RouteName `json:"name"`
// name the identifier of the route, it should be in the form of ROUTE:NAMESPACE:NAME
Identifier RouteIdentifier `json:"identifier"`

// targetGroupProps the target group specific properties
TargetGroupProps TargetGroupProps `json:"targetGroupProps"`
}

// TargetGroupProps defines the target group properties
type TargetGroupProps struct {
// targetGroupName specifies the name to assign to the Target Group. If not defined, then one is generated.
// +optional
TargetGroupName string `json:"targetGroupName,omitempty"`

// ipAddressType specifies whether the target group is of type IPv4 or IPv6. If unspecified, it will be automatically inferred.
// +optional
IPAddressType *TargetGroupIPAddressType `json:"ipAddressType,omitempty"`
Expand All @@ -174,10 +202,20 @@ type TargetGroupProps struct {
// +optional
TargetType *TargetType `json:"targetType,omitempty"`

// Protocol [Application / Network Load Balancer] the protocol for the target group.
// If unspecified, it will be automatically inferred.
// +optional
Protocol *Protocol `json:"protocol,omitempty"`

// protocolVersion [HTTP/HTTPS protocol] The protocol version. The possible values are GRPC , HTTP1 and HTTP2
// +optional
ProtocolVersion *ProtocolVersion `json:"protocolVersion,omitempty"`

// EnableMultiCluster [Application / Network LoadBalancer]
// Allows for multiple Clusters / Services to use the generated TargetGroup ARN
// +optional
EnableMultiCluster bool `json:"enableMultiCluster,omitempty"`

// vpcID is the VPC of the TargetGroup. If unspecified, it will be automatically inferred.
// +optional
VpcID *string `json:"vpcID,omitempty"`
Expand Down Expand Up @@ -231,6 +269,10 @@ type TargetGroupConfiguration struct {
Status TargetGroupConfigurationStatus `json:"status,omitempty"`
}

func (tgConfig *TargetGroupConfiguration) GetTargetGroupConfigForRoute(name, namespace, kind string) *TargetGroupProps {
return &tgConfig.Spec.DefaultConfiguration
}

// +kubebuilder:object:root=true

// TargetGroupConfigurationList contains a list of TargetGroupConfiguration
Expand Down
7 changes: 6 additions & 1 deletion apis/gateway/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 54 additions & 12 deletions config/crd/gateway/gateway-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ spec:
description: defaultRouteConfiguration fallback configuration applied
to all routes, unless overridden by route-specific configurations.
properties:
enableMultiCluster:
description: |-
EnableMultiCluster [Application / Network LoadBalancer]
Allows for multiple Clusters / Services to use the generated TargetGroup ARN
type: boolean
healthCheckConfig:
description: healthCheckConfig The Health Check configuration
for this backend.
Expand All @@ -365,10 +370,10 @@ spec:
on the targets.
type: string
healthCheckPort:
description: healthCheckPort The port to use to connect with
the target.
format: int32
type: integer
description: |-
healthCheckPort The port the load balancer uses when performing health checks on targets.
The default is to use the port on which each target receives traffic from the load balancer.
type: string
healthCheckProtocol:
description: healthCheckProtocol The protocol to use to connect
with the target. The GENEVE, TLS, UDP, and TCP_UDP protocols
Expand Down Expand Up @@ -462,6 +467,18 @@ spec:
type: object
type: object
x-kubernetes-map-type: atomic
protocol:
description: |-
Protocol [Application / Network Load Balancer] the protocol for the target group.
If unspecified, it will be automatically inferred.
enum:
- HTTP
- HTTPS
- TCP
- TLS
- UDP
- TCP_UDP
type: string
protocolVersion:
description: protocolVersion [HTTP/HTTPS protocol] The protocol
version. The possible values are GRPC , HTTP1 and HTTP2
Expand Down Expand Up @@ -503,6 +520,10 @@ spec:
- value
type: object
type: array
targetGroupName:
description: targetGroupName specifies the name to assign to the
Target Group. If not defined, then one is generated.
type: string
targetType:
description: targetType is the TargetType of TargetGroup. If unspecified,
it will be automatically inferred as instance.
Expand All @@ -521,14 +542,19 @@ spec:
items:
description: RouteConfiguration defines the per route configuration
properties:
name:
description: name the name of the route, it should be in the
form of ROUTE:NAMESPACE:NAME
identifier:
description: name the identifier of the route, it should be
in the form of ROUTE:NAMESPACE:NAME
pattern: ^(HTTPRoute|TLSRoute|TCPRoute|UDPRoute|GRPCRoute)?:([^:]+)?:([^:]+)?$
type: string
targetGroupProps:
description: targetGroupProps the target group specific properties
properties:
enableMultiCluster:
description: |-
EnableMultiCluster [Application / Network LoadBalancer]
Allows for multiple Clusters / Services to use the generated TargetGroup ARN
type: boolean
healthCheckConfig:
description: healthCheckConfig The Health Check configuration
for this backend.
Expand All @@ -544,10 +570,10 @@ spec:
checks on the targets.
type: string
healthCheckPort:
description: healthCheckPort The port to use to connect
with the target.
format: int32
type: integer
description: |-
healthCheckPort The port the load balancer uses when performing health checks on targets.
The default is to use the port on which each target receives traffic from the load balancer.
type: string
healthCheckProtocol:
description: healthCheckProtocol The protocol to use
to connect with the target. The GENEVE, TLS, UDP,
Expand Down Expand Up @@ -644,6 +670,18 @@ spec:
type: object
type: object
x-kubernetes-map-type: atomic
protocol:
description: |-
Protocol [Application / Network Load Balancer] the protocol for the target group.
If unspecified, it will be automatically inferred.
enum:
- HTTP
- HTTPS
- TCP
- TLS
- UDP
- TCP_UDP
type: string
protocolVersion:
description: protocolVersion [HTTP/HTTPS protocol] The protocol
version. The possible values are GRPC , HTTP1 and HTTP2
Expand Down Expand Up @@ -686,6 +724,10 @@ spec:
- value
type: object
type: array
targetGroupName:
description: targetGroupName specifies the name to assign
to the Target Group. If not defined, then one is generated.
type: string
targetType:
description: targetType is the TargetType of TargetGroup.
If unspecified, it will be automatically inferred as instance.
Expand All @@ -699,7 +741,7 @@ spec:
type: string
type: object
required:
- name
- identifier
- targetGroupProps
type: object
type: array
Expand Down
Loading
Loading