Skip to content

Commit fafbd12

Browse files
authored
Change internal loadbalancer IP to SHARED_LOADBALANCER_VIP (#646)
* Change internal loadbalancer IP to `SHARED_LOADBALANCER_VIP` * Add internal HTTPS to `cloud` * Terraform `fmt`
1 parent 9dd71bf commit fafbd12

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

k8s/overlays/cloud.micropowermanager.io/kustomization.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ components:
1212

1313
images:
1414
- name: enaccess/micropowermanager-backend:latest
15-
newTag: 0.0.19
15+
newTag: 0.0.25
1616
- name: enaccess/micropowermanager-frontend:latest
17-
newTag: 0.0.19
17+
newTag: 0.0.25
18+
- name: enaccess/micropowermanager-scheduler:latest
19+
newTag: 0.0.25
1820

1921
patches:
2022
- path: configmap-cloud-backend.yaml
@@ -25,7 +27,7 @@ patches:
2527
target:
2628
kind: ConfigMap
2729
name: mpm-configmap-frontend
28-
# Setting a static IP external address for our load balancer, see
30+
# Setting a static IP external address for our external loadbalancer, see
2931
# https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip#use_an_ingress
3032
- patch: |-
3133
apiVersion: networking.k8s.io/v1
@@ -34,14 +36,16 @@ patches:
3436
name: mpm-ingress
3537
annotations:
3638
kubernetes.io/ingress.global-static-ip-name: loadbalancer-global-address-cloud
37-
# Setting a static internal IP address for our load balancer, see
39+
# Setting a static internal IP address and TLS for our internal loadbalancer, see
3840
# https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balance-ingress#static_ip_addressing
41+
# https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balance-ingress#https_between_client_and_load_balancer
3942
- patch: |-
4043
apiVersion: networking.k8s.io/v1
4144
kind: Ingress
4245
metadata:
4346
name: mpm-ingress-internal
4447
annotations:
48+
ingress.gcp.kubernetes.io/pre-shared-cert: internal-loadbalancer-cert-cloud
4549
kubernetes.io/ingress.regional-static-ip-name: internal-loadbalancer-address-cloud
4650
- patch: |-
4751
apiVersion: networking.gke.io/v1

terraform/gcp_kubernetes/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ resource "google_compute_address" "internal_loadbalancer_address" {
143143
name = local.network_internal_loadbalancer_address_name
144144
region = var.gcp_region
145145
address_type = "INTERNAL"
146+
address = var.internal_loadbalancer_address
147+
purpose = "SHARED_LOADBALANCER_VIP"
146148
subnetwork = "default"
147149
}
148150

terraform/gcp_kubernetes/variables.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ variable "create_internal_loadbalancer_address" {
3838
default = false
3939
}
4040

41+
variable "internal_loadbalancer_address" {
42+
description = <<EOT
43+
Optional static internal IP address for the load balancer.
44+
45+
If provided, the load balancer will use this specific IP instead of automatically assigning one.
46+
This IP must be part of the subnet associated with the region.
47+
48+
In most cases, this can be left blank. However, specifying a static IP is useful when the same
49+
address needs to be reused — for example, during reprovisioning — to ensure continuity for external systems
50+
that depend on a consistent internal IP.
51+
EOT
52+
type = string
53+
default = null
54+
55+
validation {
56+
condition = (
57+
var.internal_loadbalancer_address == null ||
58+
can(regex("^([0-9]{1,3}\\.){3}[0-9]{1,3}$", var.internal_loadbalancer_address))
59+
)
60+
error_message = "If set, internal_loadbalancer_address must be a valid IPv4 address."
61+
}
62+
}
63+
4164
variable "db_tier" {
4265
description = "The machine type to use for the Cloud SQL database. See tiers for more details and supported versions."
4366
type = string

0 commit comments

Comments
 (0)