Skip to content

Commit

Permalink
Merge pull request #1034 from kube-hetzner/fix/lb-upgrade
Browse files Browse the repository at this point in the history
Fix/lb upgrade
  • Loading branch information
mysticaltech authored Oct 17, 2023
2 parents 5cc05e4 + 3eaae1c commit 4405857
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion init.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "hcloud_load_balancer" "cluster" {
count = local.has_external_load_balancer ? 0 : 1
name = var.cluster_name
name = local.load_balancer_name

load_balancer_type = var.load_balancer_type
location = var.load_balancer_location
Expand Down
5 changes: 3 additions & 2 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ locals {
using_klipper_lb = var.enable_klipper_metal_lb || local.is_single_node_cluster

has_external_load_balancer = local.using_klipper_lb || local.ingress_controller == "none"
load_balancer_name = "${var.cluster_name}-${var.ingress_controller}"

ingress_replica_count = (var.ingress_replica_count > 0) ? var.ingress_replica_count : (local.agent_count > 2) ? 3 : (local.agent_count == 2) ? 2 : 1
ingress_max_replica_count = (var.ingress_max_replica_count > local.ingress_replica_count) ? var.ingress_max_replica_count : local.ingress_replica_count
Expand Down Expand Up @@ -455,7 +456,7 @@ controller:
%{if !local.using_klipper_lb~}
service:
annotations:
"load-balancer.hetzner.cloud/name": "${var.cluster_name}"
"load-balancer.hetzner.cloud/name": "${local.load_balancer_name}"
"load-balancer.hetzner.cloud/use-private-ip": "true"
"load-balancer.hetzner.cloud/disable-private-ingress": "true"
"load-balancer.hetzner.cloud/disable-public-network": "${var.load_balancer_disable_public_network}"
Expand All @@ -482,7 +483,7 @@ service:
type: LoadBalancer
%{if !local.using_klipper_lb~}
annotations:
"load-balancer.hetzner.cloud/name": "${var.cluster_name}"
"load-balancer.hetzner.cloud/name": "${local.load_balancer_name}"
"load-balancer.hetzner.cloud/use-private-ip": "true"
"load-balancer.hetzner.cloud/disable-private-ingress": "true"
"load-balancer.hetzner.cloud/disable-public-network": "${var.load_balancer_disable_public_network}"
Expand Down

3 comments on commit 4405857

@eeriksen
Copy link

Choose a reason for hiding this comment

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

@mysticaltech Hi! While trying to upgrade, terraform apply just creates a new LB without targets or services. Is this perhaps related to the name change?

@mysticaltech
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@eeriksen Please see steps to resolve it here, it should be pretty quick. #1028

@mysticaltech
Copy link
Collaborator Author

@mysticaltech mysticaltech commented on 4405857 Oct 23, 2023

Choose a reason for hiding this comment

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

@eeriksen You just need to remove the old LB (as in delete in from Hetzner) and change the IP address (in DNS) of the LB domain to the newly created IP address. You can get the latter with kubectl get svc -A.

Please sign in to comment.