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
13 changes: 11 additions & 2 deletions iac/provider/kubespray/hosts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ all:
oc_worker_nodes: null

oc_controlplane_nodes:
%{ if network_plugin == "kube-ovn" ~}
%{ if length(controlplane_node_labels) > 0 ~}
vars:
node_labels:
"kube-ovn/role": "master"
%{ for key, value in controlplane_node_labels ~}
"${key}": "${value}"
%{ endfor ~}
%{ endif ~}
hosts:
%{ for master in master_nodes ~}
Expand All @@ -39,6 +41,13 @@ oc_controlplane_nodes:
%{endfor ~}

oc_worker_nodes:
%{ if length(worker_node_labels) > 0 ~}
vars:
node_labels:
%{ for key, value in worker_node_labels ~}
"${key}": "${value}"
%{ endfor ~}
%{ endif ~}
hosts:
%{ for worker in worker_nodes ~}
${worker.name}:
Expand Down
3 changes: 3 additions & 0 deletions iac/provider/kubespray/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ resource "local_file" "ansible_inventory" {
ssh_user = var.ssh_user
worker_nodes = var.worker_nodes
windows_nodes = var.windows_nodes
controlplane_node_labels = var.controlplane_node_labels
worker_node_labels = var.worker_node_labels

})

filename = "./inventory/inventory.yaml"
Expand Down
14 changes: 13 additions & 1 deletion iac/provider/kubespray/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,16 @@ variable "windows_nodes" {
variable "use_octavia" {
type = bool
default = true
}
}

variable "controlplane_node_labels" {
type = map(string)
default = {}
description = "Map of Kubernetes labels to apply to control plane nodes. Keys and values are strings."
}

variable "worker_node_labels" {
type = map(string)
default = {}
description = "Map of Kubernetes labels to apply to worker nodes. Keys and values are strings."
}
Loading