Refacto and add lb

This commit is contained in:
2024-01-24 15:29:36 +01:00
parent 7c343269d6
commit 9b53fa3eac
13 changed files with 168 additions and 69 deletions

View File

@@ -10,12 +10,16 @@ variable "namespace" {
variable "labels" {
type = map(string)
}
variable "annotations" {
type = map(string)
default = {}
}
variable "svc_type" {
type = string
default = "ClusterIP"
validation {
condition = contains(["ClusterIP", "ExternalName", "NodePort"], var.svc_type)
error_message = "Only ClusterIP or ExternalName is allowed"
condition = contains(["ClusterIP", "ExternalName", "NodePort", "LoadBalancer"], var.svc_type)
error_message = "Only ClusterIP, ExternalName, NodePort or LoadBalancer is allowed"
}
}
variable "ports" {
@@ -46,3 +50,15 @@ variable "node_ports" {
error_message = "The range of valid ports is 30000-32767"
}
}
variable "lb_ports" {
type = list(number)
default = [8080]
}
variable "lb_policy" {
type = string
default = "Cluster"
validation {
condition = contains(["Cluster", "Local"], var.lb_policy)
error_message = "Only Cluster or Local is allowed"
}
}