mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-08 23:12:18 -04:00
stackit: add k8s api load balancer (#2925)
This commit is contained in:
parent
62acec17f6
commit
2a61861a1c
20 changed files with 298 additions and 378 deletions
|
@ -0,0 +1,47 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
stackit = {
|
||||
source = "stackitcloud/stackit"
|
||||
version = "0.12.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "stackit_loadbalancer" "loadbalancer" {
|
||||
project_id = var.stackit_project_id
|
||||
name = "${var.name}-lb"
|
||||
target_pools = [
|
||||
for portName, port in var.ports : {
|
||||
name = "target-pool-${portName}"
|
||||
target_port = port
|
||||
targets = [
|
||||
for ip in var.member_ips : {
|
||||
display_name = "target-${portName}"
|
||||
ip = ip
|
||||
}
|
||||
]
|
||||
active_health_check = {
|
||||
healthy_threshold = 10
|
||||
interval = "3s"
|
||||
interval_jitter = "3s"
|
||||
timeout = "3s"
|
||||
unhealthy_threshold = 10
|
||||
}
|
||||
}
|
||||
]
|
||||
listeners = [
|
||||
for portName, port in var.ports : {
|
||||
name = "listener-${portName}"
|
||||
port = port
|
||||
protocol = "PROTOCOL_TCP"
|
||||
target_pool = "target-pool-${portName}"
|
||||
}
|
||||
]
|
||||
networks = [
|
||||
{
|
||||
network_id = var.network_id
|
||||
role = "ROLE_LISTENERS_AND_TARGETS"
|
||||
}
|
||||
]
|
||||
external_address = var.external_address
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
variable "name" {
|
||||
type = string
|
||||
description = "Base name of the load balancer."
|
||||
}
|
||||
|
||||
variable "member_ips" {
|
||||
type = list(string)
|
||||
description = "IP addresses of the members of the load balancer pool."
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "network_id" {
|
||||
type = string
|
||||
description = "ID of the network."
|
||||
}
|
||||
|
||||
variable "external_address" {
|
||||
type = string
|
||||
description = "External address of the load balancer."
|
||||
}
|
||||
|
||||
variable "ports" {
|
||||
type = map(number)
|
||||
description = "Ports to listen on incoming traffic."
|
||||
}
|
||||
|
||||
variable "stackit_project_id" {
|
||||
type = string
|
||||
description = "STACKIT project ID."
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue