Skip to content

Commit 9f64606

Browse files
committed
Add support for Cilium-based Gateway API
1 parent a57bca8 commit 9f64606

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

cilium.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ locals {
2929
keys = base64encode(local.cilium_ipsec_key_config.format)
3030
}
3131
} : null
32+
33+
# Cilium integration with Gateway API
34+
cilium_gateway_api_manifest = var.gateway_api_enabled ? {
35+
apiVersion = "gateway.networking.k8s.io/v1"
36+
kind = "GatewayClass"
37+
metadata = {
38+
name = "cilium"
39+
namespace = "kube-system"
40+
}
41+
spec = {
42+
gatewayClassName = "cilium"
43+
infrastructure = {
44+
annotations = local.ingress_load_balancer_annotations
45+
}
46+
}
47+
} : null
3248
}
3349

3450
# Generate random key when IPSec is enabled
@@ -94,6 +110,11 @@ data "helm_template" "cilium" {
94110
loadBalancer = {
95111
acceleration = "native"
96112
}
113+
gatewayAPI = {
114+
enabled = var.gateway_api_enabled
115+
enableProxyProtocol = true
116+
externalTrafficPolicy = var.ingress_service_external_traffic_policy
117+
}
97118
hubble = {
98119
enabled = var.cilium_hubble_enabled
99120
relay = { enabled = var.cilium_hubble_relay_enabled }
@@ -151,6 +172,8 @@ locals {
151172
${yamlencode(local.cilium_ipsec_keys_manifest)}
152173
---
153174
${data.helm_template.cilium.manifest}
175+
---
176+
${yamlencode(local.cilium_gateway_api_manifest)}
154177
EOF
155178
} : null
156179
}

talos_config.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ locals {
2828
talos_manifests = concat(
2929
var.talos_ccm_enabled ? ["https://raw.githubusercontent.com/siderolabs/talos-cloud-controller-manager/${var.talos_ccm_version}/docs/deploy/cloud-controller-manager-daemonset.yml"] : [],
3030
var.prometheus_operator_crds_enabled ? ["https://github.com/prometheus-operator/prometheus-operator/releases/download/${var.prometheus_operator_crds_version}/stripped-down-crds.yaml"] : [],
31+
var.gateway_api_enabled ? ["https://github.com/kubernetes-sigs/gateway-api/releases/download/${var.gateway_api_version}/${var.gateway_api_experimental_enabled ? "experimental" : "standard"}-install.yaml"] : [],
3132
var.talos_extra_remote_manifests != null ? var.talos_extra_remote_manifests : []
3233
)
3334

variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,3 +1661,27 @@ variable "prometheus_operator_crds_version" {
16611661
default = "v0.86.1" # https://github.com/prometheus-operator/prometheus-operator
16621662
description = "Specifies the version of the Prometheus Operator Custom Resource Definitions (CRDs) to deploy."
16631663
}
1664+
1665+
# Gateway API
1666+
variable "gateway_api_enabled" {
1667+
type = bool
1668+
default = false
1669+
description = "Enables the Gateway API Custom Resource Definitions (CRDs) deployment."
1670+
}
1671+
1672+
variable "gateway_api_version" {
1673+
type = string
1674+
default = "v1.3.0" # https://github.com/kubernetes-sigs/gateway-api
1675+
description = "Specifies the version of the Gateway API Custom Resource Definitions (CRDs) to deploy."
1676+
1677+
validation {
1678+
condition = var.ingress_controller_type != "cilium" || (var.cilium_helm_version == "v1.18.2" && var.gateway_api_version == "v1.3.0")
1679+
error_message = "When ingress_controller_type is 'cilium', cilium_helm_version must be 'v1.18.2' and gateway_api_version must be 'v1.3.0'."
1680+
}
1681+
}
1682+
1683+
variable "gateway_api_experimental_enabled" {
1684+
type = bool
1685+
default = false
1686+
description = "Enables the experimental Gateway API features. These features are not yet part of the official Gateway API specification and may change in future releases."
1687+
}

0 commit comments

Comments
 (0)