SKE loop
This commit is contained in:
parent
91fdd1d420
commit
f43585ca95
4 changed files with 129 additions and 149 deletions
|
|
@ -18,19 +18,19 @@ locals {
|
||||||
}
|
}
|
||||||
|
|
||||||
module "stackit_ske_cluster" {
|
module "stackit_ske_cluster" {
|
||||||
|
for_each = var.ske_clusters
|
||||||
source = "../ske"
|
source = "../ske"
|
||||||
|
project_id = local.project_ids[each.value.project_key]
|
||||||
|
name = each.value.name
|
||||||
|
node_pools = each.value.node_pools
|
||||||
|
network = {
|
||||||
|
id = each.value.network_id
|
||||||
|
}
|
||||||
|
|
||||||
# required variables
|
kubernetes_version_min = lookup(each.value, "kubernetes_version_min", null)
|
||||||
project_id = local.project_ids[var.ske_target_project_key]
|
hibernations = lookup(each.value, "hibernations", null)
|
||||||
name = var.name
|
maintenance = lookup(each.value, "maintenance", null)
|
||||||
node_pools = var.node_pools
|
extensions = lookup(each.value, "extensions", null)
|
||||||
|
default_region = var.default_region
|
||||||
# optional variables
|
|
||||||
kubernetes_version_min = var.kubernetes_version_min
|
|
||||||
hibernations = var.hibernations
|
|
||||||
maintenance = var.maintenance
|
|
||||||
extensions = var.extensions
|
|
||||||
network = var.network
|
|
||||||
default_region = var.default_region
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ organization_id = "03a34540-3c1a-4794-b2c6-7111ecf824ef"
|
||||||
|
|
||||||
Projects_map = {
|
Projects_map = {
|
||||||
"projekt-alpha" = {
|
"projekt-alpha" = {
|
||||||
name = "tf_modules_test_1"
|
name = "tf_modules_test_3"
|
||||||
owner_email = "janis.hahn@stackit.cloud"
|
owner_email = "janis.hahn@stackit.cloud"
|
||||||
},
|
},
|
||||||
"projekt-beta" = {
|
"projekt-beta" = {
|
||||||
name = "tf_modules_test_2"
|
name = "tf_modules_test_4"
|
||||||
owner_email = "janis.hahn@stackit.cloud"
|
owner_email = "janis.hahn@stackit.cloud"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,63 +21,71 @@ SNA_network_ranges = [
|
||||||
|
|
||||||
SNA_transfer_network = "172.16.0.0/24"
|
SNA_transfer_network = "172.16.0.0/24"
|
||||||
|
|
||||||
name = "cluster"
|
ske_clusters = {
|
||||||
|
|
||||||
ske_target_project_key = "projekt-alpha" # projekt-alpha or projekt-beta ... or other from above to ensure scalability
|
"prod-cluster" = {
|
||||||
|
name = "clusterprod"
|
||||||
|
project_key = "projekt-alpha"
|
||||||
|
network_id = "53917a75-0014-49b0-a4d6-e62934ab479f" # WICHTIG: Hier die Netzwerk-ID connecten
|
||||||
|
kubernetes_version_min = "1.32.5"
|
||||||
|
|
||||||
node_pools = [
|
node_pools = [
|
||||||
{
|
{
|
||||||
name = "default-pool"
|
name = "defaulpool"
|
||||||
machine_type = "c1.2"
|
machine_type = "c1.2"
|
||||||
availability_zones = ["eu01-1"]
|
availability_zones = ["eu01-1"]
|
||||||
minimum = 1
|
minimum = 1
|
||||||
maximum = 2
|
maximum = 2
|
||||||
cri = "containerd"
|
cri = "containerd"
|
||||||
volume_type = "storage_premium_perf1"
|
volume_type = "storage_premium_perf1"
|
||||||
volume_size = 20
|
volume_size = 21
|
||||||
labels = {
|
labels = { "worker" = "default" }
|
||||||
"worker" = "default"
|
taints = [{
|
||||||
|
effect = "NoSchedule"
|
||||||
|
key = "app"
|
||||||
|
value = "database"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
hibernations = [
|
||||||
|
{
|
||||||
|
start = "00 18 * * 1-5" # Mo-Fr um 18:00 Uhr
|
||||||
|
end = "00 08 * * 1-5" # Mo-Fr um 08:00 Uhr
|
||||||
|
timezone = "Europe/Berlin"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
maintenance = {
|
||||||
|
enable_kubernetes_version_updates = true
|
||||||
|
enable_machine_image_version_updates = true
|
||||||
|
start = "01:00:00Z"
|
||||||
|
end = "03:00:00Z"
|
||||||
}
|
}
|
||||||
taints = [{
|
|
||||||
effect = "NoSchedule"
|
|
||||||
key = "app"
|
|
||||||
value = "database"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
kubernetes_version_min = "1.32.5"
|
extensions = {
|
||||||
|
acl = {
|
||||||
|
enabled = true
|
||||||
|
allowed_cidrs = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
hibernations = [
|
"dev-cluster" = {
|
||||||
{
|
name = "clusterdev"
|
||||||
start = "00 18 * * 1-5" # Mo-Fr um 18:00 Uhr
|
kubernetes_version_min = "1.32.5"
|
||||||
end = "00 08 * * 1-5" # Mo-Fr um 08:00 Uhr
|
project_key = "projekt-beta"
|
||||||
timezone = "Europe/Berlin"
|
network_id = "9c3dea6a-2971-414e-8c06-04618aa2c1f7" # WICHTIG: Hier die Netzwerk-ID connecten
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
maintenance = {
|
node_pools = [
|
||||||
enable_kubernetes_version_updates = true
|
{
|
||||||
enable_machine_image_version_updates = true
|
name = "devpool"
|
||||||
start = "01:00:00Z"
|
machine_type = "c1.2"
|
||||||
end = "03:00:00Z"
|
availability_zones = ["eu01-2"]
|
||||||
}
|
minimum = 1
|
||||||
|
maximum = 1
|
||||||
extensions = {
|
volume_size = 21
|
||||||
acl = {
|
}
|
||||||
enabled = true
|
]
|
||||||
allowed_cidrs = ["0.0.0.0/0"]
|
|
||||||
}
|
|
||||||
argus = {
|
|
||||||
enabled = true
|
|
||||||
argus_instance_id = "deine-argus-instanz-id"
|
|
||||||
}
|
|
||||||
dns = {
|
|
||||||
enabled = true
|
|
||||||
zones = ["example.com"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
network = {
|
|
||||||
id = "bae113a7-cc47-4b1e-8abd-3cdacdd53f28"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ variable "organization_id" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "ske_target_project_key" { type = string }
|
|
||||||
variable "service_account_key_path" {
|
variable "service_account_key_path" {
|
||||||
type = string
|
type = string
|
||||||
default = "/home/hahnjan/.stackit/sa.json"
|
default = "/home/hahnjan/.stackit/sa.json"
|
||||||
|
|
@ -41,87 +40,60 @@ variable "Projects_map" {
|
||||||
|
|
||||||
# SKE variables
|
# SKE variables
|
||||||
|
|
||||||
variable "name" {
|
variable "ske_clusters" {
|
||||||
description = "Ein Präfix für den Namen des SKE-Clusters."
|
description = "Eine Map von SKE-Clustern"
|
||||||
type = string
|
type = map(object({
|
||||||
default = "my-ske-cluster"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "node_pools" {
|
name = string
|
||||||
description = "One or more node_pool blocks."
|
project_key = string
|
||||||
type = list(object({
|
network_id = string
|
||||||
name = string
|
|
||||||
machine_type = string
|
kubernetes_version_min = optional(string)
|
||||||
availability_zones = list(string)
|
hibernations = optional(list(object({
|
||||||
minimum = number
|
start = string
|
||||||
maximum = number
|
end = string
|
||||||
allow_system_components = optional(bool)
|
timezone = optional(string)
|
||||||
cri = optional(string)
|
|
||||||
labels = optional(map(string))
|
|
||||||
max_surge = optional(number)
|
|
||||||
max_unavailable = optional(number)
|
|
||||||
os_name = optional(string)
|
|
||||||
os_version_min = optional(string)
|
|
||||||
taints = optional(list(object({
|
|
||||||
effect = string
|
|
||||||
key = string
|
|
||||||
value = optional(string)
|
|
||||||
})))
|
})))
|
||||||
volume_size = optional(number)
|
maintenance = optional(object({
|
||||||
volume_type = optional(string)
|
enable_kubernetes_version_updates = bool
|
||||||
|
enable_machine_image_version_updates = bool
|
||||||
|
start = string
|
||||||
|
end = string
|
||||||
|
}))
|
||||||
|
extensions = optional(object({
|
||||||
|
acl = optional(object({
|
||||||
|
enabled = bool
|
||||||
|
allowed_cidrs = list(string)
|
||||||
|
}))
|
||||||
|
argus = optional(object({
|
||||||
|
enabled = bool
|
||||||
|
argus_instance_id = string
|
||||||
|
}))
|
||||||
|
}))
|
||||||
|
|
||||||
|
node_pools = list(object({
|
||||||
|
|
||||||
|
name = string
|
||||||
|
machine_type = string
|
||||||
|
availability_zones = list(string)
|
||||||
|
minimum = number
|
||||||
|
maximum = number
|
||||||
|
|
||||||
|
allow_system_components = optional(bool)
|
||||||
|
cri = optional(string)
|
||||||
|
labels = optional(map(string))
|
||||||
|
max_surge = optional(number)
|
||||||
|
max_unavailable = optional(number)
|
||||||
|
os_name = optional(string)
|
||||||
|
os_version_min = optional(string)
|
||||||
|
volume_size = optional(number)
|
||||||
|
volume_type = optional(string)
|
||||||
|
taints = optional(list(object({
|
||||||
|
effect = string
|
||||||
|
key = string
|
||||||
|
value = optional(string)
|
||||||
|
})))
|
||||||
|
}))
|
||||||
}))
|
}))
|
||||||
}
|
default = {}
|
||||||
|
|
||||||
variable "kubernetes_version_min" {
|
|
||||||
description = "The minimum Kubernetes version."
|
|
||||||
type = string
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "hibernations" {
|
|
||||||
description = "A list of hibernation schedules for the cluster."
|
|
||||||
type = list(object({
|
|
||||||
start = string
|
|
||||||
end = string
|
|
||||||
timezone = optional(string)
|
|
||||||
}))
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "maintenance" {
|
|
||||||
description = "A single maintenance block."
|
|
||||||
type = object({
|
|
||||||
enable_kubernetes_version_updates = bool
|
|
||||||
enable_machine_image_version_updates = bool
|
|
||||||
start = string
|
|
||||||
end = string
|
|
||||||
})
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "extensions" {
|
|
||||||
description = "A single extensions block."
|
|
||||||
type = object({
|
|
||||||
acl = optional(object({
|
|
||||||
enabled = bool
|
|
||||||
allowed_cidrs = list(string)
|
|
||||||
}))
|
|
||||||
argus = optional(object({
|
|
||||||
enabled = bool
|
|
||||||
argus_instance_id = string
|
|
||||||
}))
|
|
||||||
dns = optional(object({
|
|
||||||
enabled = bool
|
|
||||||
zones = optional(list(string))
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "network" {
|
|
||||||
description = "Network block."
|
|
||||||
type = object({
|
|
||||||
id = string
|
|
||||||
})
|
|
||||||
default = null
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ variable "node_pools" {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Optionale Variablen --
|
# Optionale Variablen
|
||||||
variable "kubernetes_version_min" {
|
variable "kubernetes_version_min" {
|
||||||
description = "The minimum Kubernetes version."
|
description = "The minimum Kubernetes version."
|
||||||
type = string
|
type = string
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue