Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion nullplatform/container_orchestration/eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ locals {
var.service_account_name != "" ? { service_account_name = var.service_account_name } : {},
)

traffic_manager = merge(
var.traffic_manager_version != "" ? { version = var.traffic_manager_version } : {},
var.traffic_manager_port != null ? { port = var.traffic_manager_port } : {},
)

attributes = merge(
{
cluster = local.cluster
Expand All @@ -41,7 +46,7 @@ locals {
length(local.network) > 0 ? { network = local.network } : {},
length(local.resource_management) > 0 ? { resource_management = local.resource_management } : {},
length(local.security) > 0 ? { security = local.security } : {},
var.traffic_manager_version != "" ? { traffic_manager = { version = var.traffic_manager_version } } : {},
length(local.traffic_manager) > 0 ? { traffic_manager = local.traffic_manager } : {},
length(var.object_modifiers) > 0 ? { object_modifiers = { modifiers = var.object_modifiers } } : {},
)
}
Expand Down
23 changes: 23 additions & 0 deletions nullplatform/container_orchestration/eks/tests/eks.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,29 @@ run "with_traffic_manager" {
condition = strcontains(nullplatform_provider_config.eks_config.attributes, "latest")
error_message = "Attributes should contain traffic manager version"
}

assert {
condition = !strcontains(nullplatform_provider_config.eks_config.attributes, "\"port\"")
error_message = "Attributes should not contain traffic manager port when not set"
}
}

run "with_traffic_manager_port" {
command = plan

variables {
traffic_manager_port = 10080
}

assert {
condition = strcontains(nullplatform_provider_config.eks_config.attributes, "\"port\":10080")
error_message = "Attributes should contain the traffic manager port"
}

assert {
condition = strcontains(nullplatform_provider_config.eks_config.attributes, "\"version\":\"latest\"")
error_message = "Setting the port must not drop the traffic manager version"
}
}

run "with_object_modifiers" {
Expand Down
11 changes: 11 additions & 0 deletions nullplatform/container_orchestration/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ variable "traffic_manager_version" {
default = "latest"
}

variable "traffic_manager_port" {
description = "Port the traffic manager sidecar binds inside the pod. Defaults to 80 when unset. Set a different port (10080 recommended) when the cluster does not allow pod-to-pod traffic on port 80, which surfaces as a healthy pod that receives no traffic because kubelet probes are node-local and bypass the filtering. Open the port for pod-to-pod traffic before setting this value"
type = number
default = null
nullable = true
validation {
condition = var.traffic_manager_port == null || (var.traffic_manager_port >= 1 && var.traffic_manager_port <= 65535)
error_message = "traffic_manager_port must be between 1 and 65535."
}
}

variable "object_modifiers" {
description = "List of modifications to dynamically modify k8s objects"
type = list(object({
Expand Down
Loading