Support creating and attaching floating IPs to lb#36
Support creating and attaching floating IPs to lb#36chi-quita-a wants to merge 1 commit intorelease-2.29.0-ck8sfrom
Conversation
rarescosma
left a comment
There was a problem hiding this comment.
Great work ChatG(ehm) Joy, my main concern here is that if the underlying module API allows for multiple IP address attachments, why should we restrict it to one?
contrib/terraform/upcloud/modules/kubernetes-cluster/variables.tf
Outdated
Show resolved
Hide resolved
simonklb
left a comment
There was a problem hiding this comment.
Not super familiar with the UpCloud setup but does the UpCloud Terraform provider support creating the floating IPs as well and if so could we instead automate that too instead of having to create the floating IPs manually and adding them as input configuration?
It's worse than you think: they don't support the creation of unattached IPs at all. So in order to get it you must first create an attached one, then detach it manually from whatever random machine you chose, and then use it.. |
This doesn't work? https://registry.terraform.io/providers/UpCloudLtd/upcloud/latest/docs/resources/floating_ip_address |
I've looked at that as well. But from my understanding, Terraform provider does support creating detached floating IPs, but the example you shared attaches them to a server NIC via mac_address. For lb, attachment is done through the |
36c8c50 to
e93db13
Compare
Yeah, can't argue about the restriction. Sure, if the provider happily supports multiple ip_addresses, there’s no need for us to pretend we live in a single-IP universe. |
I think it's the one at the bottom of the snippet that's attached to the server. But the one on the top is detached (based on the comment it looks like they at least attempted to support creating detached IPs) |
simonklb
left a comment
There was a problem hiding this comment.
This still does not create the floating IPs and from the looks of the discussions in the thread and the provider documentation it should be possible. If not please explain why!
Down with IP monogamy! |
I'm fine with restricting the scope and making the assumption we have a detached IP address on hand (or multiple). |
64d03ee to
154b88a
Compare
|
Testing: Verified that traffic reaches the Kubernetes API through the floating IP via the load balancer: The 403 response confirms the request successfully reached the Kubernetes API server through the floating IP and load balancer. Rejected because no authentication credentials were provided
|
154b88a to
5beef5e
Compare
So, we shouldn't extend the scope to also handle creating floating IPs via Terraform using upcloud_floating_ip_address? |
I'm withholding my approval until I know the answer to this. I don't really understand why we shouldn't also manage the floating IPs using Terraform when it's such a small change for a big win. No strong opinion though. |
I think that would be an optimal improvement. So, do you reckon that we should keep |
A boolean sounds good to me but I'm letting the final decision go to @elastisys/goto-upcloud and/or @elastisys/goto-kubespray ! |
…cers via Terraform
5beef5e to
c8731ac
Compare
Exactly my thought. I actually played around with this before I PR:d on to master (wrong base) and caused multiple commit issues. I have now reapplied that resource. Have a look and give me your take on it. |

What type of PR is this?
What this PR does / why we need it:
Background
UpCloud does not support Cluster API, so Kubernetes clusters are provisioned using Terraform for infrastructure creation and Kubespray for cluster bootstrapping.
UpCloud provides CSI support, enabling dynamic volume provisioning via PVCs, but there is no cloud controller manager. Consequently:
Service type=LoadBalancercannot be used.NodePort, fronted by the Terraform-managed load balancer.Until now, UpCloud load balancers exposed only a stable DNS name. While the DNS name is persistent, it does not provide a stable IP address suitable for firewall whitelisting in customer environments.
Problem
Customers require stable IP addresses to whitelist cluster ingress endpoints.
Solution
UpCloud introduced support for attaching floating IPs directly to load balancers.
This PR:
ip_addressesonupcloud_loadbalancerloadbalancersvariable schema with two optional fields:create_floating_ip = optional(bool, false)— lets Terraform create and manage the floating IP automaticallyip_addresses = optional(list(object({...})), [])— allows attaching pre-existing floating IPs manuallycreate_floating_ip = true, Terraform creates aupcloud_floating_ip_addressresource and wires it into the LB automaticallyip_addressesis set, pre-existing floating IPs are attached directlyWhich issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Floating IPs can now be attached to UpCloud Load Balancers in two ways:
Option A — Terraform managed (recommended):
Option B — Pre-existing floating IP:
How to test:
create_floating_ip = truein yourcluster.tfvarsExpected response is a 403 from the Kubernetes API, confirming traffic is successfully routed through the floating IP and load balancer.
References:
Does this PR introduce a user-facing change?:
Yes, admin-facing change, no changes for end-users.
create_floating_ip = trueto have Terraform manage the floating IP lifecycle.ip_addressesto attach pre-existing floating IPs.