Skip to content

feat: Support Cilium Gateway API - #281

Open
EssamEmad wants to merge 2 commits into
hcloud-talos:mainfrom
EssamEmad:main
Open

EssamEmad wants to merge 2 commits into
hcloud-talos:mainfrom
EssamEmad:main

Conversation

@EssamEmad

@EssamEmad EssamEmad commented Sep 6, 2025

Copy link
Copy Markdown

Context

The high-level intent behind this issue was to make it easy for a user of this library to use Cilium as Gateway API implementation. The suggestion was to allow customising cilium configuration without having to add a lot of boilerplate.
On further experimenting, this approach wouldn't scale well as:

  1. Enabling gateway API involves setting a collection of flags and installing dependencies
  2. If cilium was installed (with gateway enabled) before dependencies are installed, gateways wouldn't work even if the dependencies were installed later. This is because the Cilium operator doesn't continuously reconcile.

Proposition

I think we should either make cilium configuration easily editable (as proposed in the initial issue) or abstract away features through variables. Given the above, this PR proposes the latter option and uses that to support Cilium Gateway API.

NOTE: We install the experimental yaml and not the main yaml as the former includes tlsroute CRDs which are required for the Gateway API regardless of whether it uses TLS or not.

@github-actions

github-actions Bot commented Sep 6, 2025

Copy link
Copy Markdown

Commitlint-Check

Thanks for your contribution ❤️

commitlint has detected that all commit messages in this PR follow the conventional commit format 🎉

@github-actions

github-actions Bot commented Sep 6, 2025

Copy link
Copy Markdown

Terraform-Check (version: 1.8.5): ✅

🖌 Terraform Format: ✅
# Outputs:


# Errors:

⚙️ Terraform Init: ✅
# Outputs:

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/helm versions matching ">= 3.0.2"...
- Finding alekc/kubectl versions matching ">= 2.1.3"...
- Finding hashicorp/tls versions matching ">= 4.1.0"...
- Finding hetznercloud/hcloud versions matching ">= 1.52.0"...
- Finding siderolabs/talos versions matching ">= 0.9.0"...
- Finding hashicorp/http versions matching ">= 3.5.0"...
- Installing hashicorp/tls v4.1.0...
- Installed hashicorp/tls v4.1.0 (signed by HashiCorp)
- Installing hetznercloud/hcloud v1.52.0...
- Installed hetznercloud/hcloud v1.52.0 (signed by a HashiCorp partner, key ID 5219EACB3A77198B)
- Installing siderolabs/talos v0.9.0...
- Installed siderolabs/talos v0.9.0 (signed by a HashiCorp partner, key ID AF0815C7E2EC16A8)
- Installing hashicorp/http v3.5.0...
- Installed hashicorp/http v3.5.0 (signed by HashiCorp)
- Installing hashicorp/helm v3.0.2...
- Installed hashicorp/helm v3.0.2 (signed by HashiCorp)
- Installing alekc/kubectl v2.1.3...
- Installed alekc/kubectl v2.1.3 (self-signed, key ID 772FB27A86DAFCE7)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.


# Errors:

🤖 Terraform Validate: ✅
# Outputs:
Success! The configuration is valid.



# Errors:

@github-actions

github-actions Bot commented Sep 6, 2025

Copy link
Copy Markdown

Terraform-Check (version: 1.9.8): ✅

🖌 Terraform Format: ✅
# Outputs:


# Errors:

⚙️ Terraform Init: ✅
# Outputs:
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/http versions matching ">= 3.5.0"...
- Finding hashicorp/helm versions matching ">= 3.0.2"...
- Finding alekc/kubectl versions matching ">= 2.1.3"...
- Finding hashicorp/tls versions matching ">= 4.1.0"...
- Finding hetznercloud/hcloud versions matching ">= 1.52.0"...
- Finding siderolabs/talos versions matching ">= 0.9.0"...
- Installing hashicorp/helm v3.0.2...
- Installed hashicorp/helm v3.0.2 (signed by HashiCorp)
- Installing alekc/kubectl v2.1.3...
- Installed alekc/kubectl v2.1.3 (self-signed, key ID 772FB27A86DAFCE7)
- Installing hashicorp/tls v4.1.0...
- Installed hashicorp/tls v4.1.0 (signed by HashiCorp)
- Installing hetznercloud/hcloud v1.52.0...
- Installed hetznercloud/hcloud v1.52.0 (signed by a HashiCorp partner, key ID 5219EACB3A77198B)
- Installing siderolabs/talos v0.9.0...
- Installed siderolabs/talos v0.9.0 (signed by a HashiCorp partner, key ID AF0815C7E2EC16A8)
- Installing hashicorp/http v3.5.0...
- Installed hashicorp/http v3.5.0 (signed by HashiCorp)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.


# Errors:

🤖 Terraform Validate: ✅
# Outputs:
Success! The configuration is valid.



# Errors:

EssamEmad added a commit to alrimaal/IaasOps that referenced this pull request Sep 6, 2025
This diff uses the upstream [PR](hcloud-talos/terraform-hcloud-talos#281) and enables encryption in cilium
@EssamEmad EssamEmad changed the title Support Cilium Gateway API feat: Support Cilium Gateway API Sep 7, 2025

@mrclrchtr mrclrchtr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ensure correct conventional commit messages are used.

Comment thread manifest_cilium.tf
Comment on lines +88 to +90
{ name = "l7proxy.enabled"
value = "true"
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do this? What are the consequences? How is backward compatibility?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it for Cilium Gatway according to the docs and it's enabled by default. If I change it to base it on var.cilium_enable_gateway_api, it won't be backwards compatible.

Comment thread manifest_cilium.tf
Comment on lines +117 to +119
data "http" "gateway_api_crds" {
url = "https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.3.0/experimental-install.yaml"
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use helm, like I used with the prometheus_operator_crds? I really don't want to use GitHub sources if possible.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to be on Helm yet. I think the options are:

  1. Pull from github
  2. Download the file and commit to this repository.

What do you think?

Comment thread README.md
Comment on lines +80 to +87
#### Cilium Gateway API
To use Cilium as [Gateway API](https://gateway-api.sigs.k8s.io/) implementation, set `cilium_enable_gateway_api`
variable. This will install the required dependencies. When you configure a gateway later on, the Cilium operator
will provision an hcloud Load Balancer using Hcloud Controller Manager.
> [!IMPORTANT]
> This step will fail if the load balancer
> is not configured with the right [annotations](https://github.com/hetznercloud/hcloud-cloud-controller-manager/blob/main/docs/guides/load-balancer/quickstart.md)
> and the gateway will not provision endpoints.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we really want to do that, then we should also provision and properly configure the load balancers in this module. Otherwise, it's too much of a dependency for me.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be ideal but I am not sure if it's possible? Currently, load balancers are created by the Gateway which goes uses the HCCM CR to allocate a physical load balancer and set the correct downstream hosts. I don't see a way to assign an existing load balancer in the documentation. It also seems standard across clouds rather than Hetzner-specific.

I would also point out some benefits by keeping it this way:

  • The load balancer lifecycle will be bound (automatically) to the gateway's lifecycle. Consider a complex case with separate infra and application teams. If the load balancer is provisioned outside the gateway, and the applications team removed the gateway, the load balancer will be left stale until someone remembers to remove it as opposed to being fully managed by the gateway.
  • We can provision Cilium once and create as many load balancers and gateways later rather than having to figure out how many gateways we will create when provisioning infrastructure.

Comment thread variables.tf
- Installing preqreuisite CRDs https://docs.cilium.io/en/stable/network/servicemesh/gateway-api/gateway-api/
- Installing tlsroute CRD
- Enabling Gateway API
This variable is incompatible with `cilium_values`. If the latter is set, this variable isn't used

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I can't find the code that contains that... why would that be?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is the pre-existing behaviour — I haven't changed this part. We do this here

@EssamEmad
EssamEmad force-pushed the main branch 2 times, most recently from 3869e94 to 66bdc97 Compare September 15, 2025 08:02
Abstracts away gateway API configuration with a variable and installs required dependencies.

NOTE: We install the experimental yaml as it includes tlsroute CRDs.
This is required for the Gateway API regardless of whether it uses TLS or not.

Test Plan

```
terraform validate
```

\+
Use it on my cluster and validate that gateway is correctly configured.
This diff adds important information about configuring the cilium API gateway.
This isn't directly related to provisioning the cloud in terraform.
However,  it's key to making cilium gateway work with Hetzner and isn't documented on the internet.
@EssamEmad

Copy link
Copy Markdown
Author

Hey @mrclrchtr following up on this PR. Would be nice to converge. Let me know your thoughts.

@EssamEmad

Copy link
Copy Markdown
Author

Hey @mrclrchtr could you look at this and decide one way or the other please? I need to pull changes from upstream and will have to rebase my changes so it would be nice to merge it to cut the toil a bit.

@EssamEmad
EssamEmad requested a review from mrclrchtr December 9, 2025 00:28
@JensvandeWiel

JensvandeWiel commented Jan 28, 2026

Copy link
Copy Markdown

I would love this to be added; it would also be nice to make Hubble configurable. @EssamEmad do you have a workaround for now? Maybe it's also nice to have a preconfigured way to enable ingress. And would love a way to expose the gateway using hostport when you don't need/have a load balancer. (When using single node, to minimize costs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants