From 65ac78d8fdb3538537e534c2983f4a70da8994d2 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Tue, 16 Jul 2024 13:43:26 +0200 Subject: [PATCH 1/2] vshn-lbaas-hieradata: Add support for configuring `internal_router_vip` --- modules/vshn-lbaas-hieradata/main.tf | 25 ++++++++++--------- .../templates/hieradata.yaml.tmpl | 3 +++ modules/vshn-lbaas-hieradata/variables.tf | 6 +++++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/modules/vshn-lbaas-hieradata/main.tf b/modules/vshn-lbaas-hieradata/main.tf index b7e0332..e30e0bc 100644 --- a/modules/vshn-lbaas-hieradata/main.tf +++ b/modules/vshn-lbaas-hieradata/main.tf @@ -24,18 +24,19 @@ resource "local_file" "lb_hieradata" { content = templatefile( "${path.module}/templates/hieradata.yaml.tmpl", { - "cloud_provider" = var.cloud_provider - "cluster_id" = var.cluster_id - "distribution" = var.distribution - "ingress_controller" = var.ingress_controller - "api_credentials" = local.api_credentials - "api_vip" = var.api_vip - "internal_vip" = var.internal_vip - "nat_vip" = var.nat_vip - "router_vip" = var.router_vip - "public_interface" = local.public_interface - "private_interfaces" = local.private_interfaces - "nodes" = local.instance_fqdns + "cloud_provider" = var.cloud_provider + "cluster_id" = var.cluster_id + "distribution" = var.distribution + "ingress_controller" = var.ingress_controller + "api_credentials" = local.api_credentials + "api_vip" = var.api_vip + "internal_vip" = var.internal_vip + "internal_router_vip" = var.internal_router_vip + "nat_vip" = var.nat_vip + "router_vip" = var.router_vip + "public_interface" = local.public_interface + "private_interfaces" = local.private_interfaces + "nodes" = local.instance_fqdns "backends" = { "api" = var.api_backends[*] "router" = var.router_backends[*], diff --git a/modules/vshn-lbaas-hieradata/templates/hieradata.yaml.tmpl b/modules/vshn-lbaas-hieradata/templates/hieradata.yaml.tmpl index 3372ab1..c9d9106 100644 --- a/modules/vshn-lbaas-hieradata/templates/hieradata.yaml.tmpl +++ b/modules/vshn-lbaas-hieradata/templates/hieradata.yaml.tmpl @@ -28,6 +28,9 @@ profile_openshift4_gateway::floating_address_provider: ${cloud_provider} %{ if internal_vip != "" ~} profile_openshift4_gateway::internal_vip: ${internal_vip} %{ endif ~} +%{ if internal_router_vip != "" ~} +profile_openshift4_gateway::internal_router_vip: ${internal_router_vip} +%{ endif ~} profile_openshift4_gateway::floating_address_settings: %{ for k, v in api_credentials ~} ${k}: ${v} diff --git a/modules/vshn-lbaas-hieradata/variables.tf b/modules/vshn-lbaas-hieradata/variables.tf index fd260b9..fae8933 100644 --- a/modules/vshn-lbaas-hieradata/variables.tf +++ b/modules/vshn-lbaas-hieradata/variables.tf @@ -80,6 +80,12 @@ variable "internal_vip" { default = "" } +variable "internal_router_vip" { + type = string + description = "Virtual IP for the ingress controller/application router in the internal network" + default = "" +} + variable "api_vip" { type = string description = "Floating IP for the Kubernetes/OpenShift API" From 7a0cb7fde37e0ee5f77b3e670a9896806a82889c Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Tue, 16 Jul 2024 13:58:11 +0200 Subject: [PATCH 2/2] vshn-lbaas-cloudscale: Add variable to configure an internal router VIP --- modules/vshn-lbaas-cloudscale/hiera.tf | 1 + modules/vshn-lbaas-cloudscale/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/modules/vshn-lbaas-cloudscale/hiera.tf b/modules/vshn-lbaas-cloudscale/hiera.tf index 42ba9ad..429a624 100644 --- a/modules/vshn-lbaas-cloudscale/hiera.tf +++ b/modules/vshn-lbaas-cloudscale/hiera.tf @@ -19,6 +19,7 @@ module "hiera" { hieradata_repo_user = var.hieradata_repo_user api_vip = var.enable_api_vip ? cidrhost(local.api_vip[0].network, 0) : "" internal_vip = var.internal_vip + internal_router_vip = var.internal_router_vip nat_vip = var.enable_nat_vip ? cidrhost(local.nat_vip[0].network, 0) : "" router_vip = var.enable_router_vip ? cidrhost(local.router_vip[0].network, 0) : "" team = var.team diff --git a/modules/vshn-lbaas-cloudscale/variables.tf b/modules/vshn-lbaas-cloudscale/variables.tf index 80b70a1..5eb221f 100644 --- a/modules/vshn-lbaas-cloudscale/variables.tf +++ b/modules/vshn-lbaas-cloudscale/variables.tf @@ -90,6 +90,12 @@ variable "internal_vip" { default = "" } +variable "internal_router_vip" { + type = string + description = "Virtual IP for the ingress controller/application router in the internal network" + default = "" +} + variable "team" { type = string description = "Team to assign the load balancers to in Icinga. All lower case."