Add node_labels variable in workers modules to set initial node labels (#550)
* Also add `worker_node_labels` variable in `kubernetes` modules to set initial node labels for the default workers
This commit is contained in:
parent
8703f2c3c5
commit
99ab81f79c
|
@ -154,3 +154,9 @@ variable "enable_aggregation" {
|
||||||
default = "false"
|
default = "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "worker_node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,5 +19,6 @@ module "workers" {
|
||||||
service_cidr = var.service_cidr
|
service_cidr = var.service_cidr
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
clc_snippets = var.worker_clc_snippets
|
clc_snippets = var.worker_clc_snippets
|
||||||
|
node_labels = var.worker_node_labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ systemd:
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
|
%{ for label in split(",", node_labels) }
|
||||||
|
--node-labels=${label} \
|
||||||
|
%{ endfor ~}
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
|
|
|
@ -105,3 +105,8 @@ variable "cluster_domain_suffix" {
|
||||||
default = "cluster.local"
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ data "template_file" "worker-config" {
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
cgroup_driver = local.flavor == "flatcar" && local.channel == "edge" ? "systemd" : "cgroupfs"
|
cgroup_driver = local.flavor == "flatcar" && local.channel == "edge" ? "systemd" : "cgroupfs"
|
||||||
|
node_labels = join(",", var.node_labels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,3 +154,8 @@ variable "enable_aggregation" {
|
||||||
default = "false"
|
default = "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "worker_node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
|
@ -19,5 +19,6 @@ module "workers" {
|
||||||
service_cidr = var.service_cidr
|
service_cidr = var.service_cidr
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
snippets = var.worker_snippets
|
snippets = var.worker_snippets
|
||||||
|
node_labels = var.worker_node_labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,9 @@ systemd:
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
|
%{ for label in split(",", node_labels) }
|
||||||
|
--node-labels=${label} \
|
||||||
|
%{ endfor ~}
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
|
|
|
@ -105,3 +105,8 @@ variable "cluster_domain_suffix" {
|
||||||
default = "cluster.local"
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ data "template_file" "worker-config" {
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
node_labels = join(",", var.node_labels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,3 +135,9 @@ variable "enable_aggregation" {
|
||||||
default = "false"
|
default = "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "worker_node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,5 +20,6 @@ module "workers" {
|
||||||
service_cidr = var.service_cidr
|
service_cidr = var.service_cidr
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
clc_snippets = var.worker_clc_snippets
|
clc_snippets = var.worker_clc_snippets
|
||||||
|
node_labels = var.worker_node_labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,9 @@ systemd:
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
|
%{ for label in split(",", node_labels) }
|
||||||
|
--node-labels=${label} \
|
||||||
|
%{ endfor ~}
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
|
|
|
@ -91,3 +91,8 @@ variable "cluster_domain_suffix" {
|
||||||
default = "cluster.local"
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ data "template_file" "worker-config" {
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
node_labels = join(",", var.node_labels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,3 +129,9 @@ variable "enable_aggregation" {
|
||||||
default = "false"
|
default = "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "worker_node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,5 +18,6 @@ module "workers" {
|
||||||
service_cidr = var.service_cidr
|
service_cidr = var.service_cidr
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
clc_snippets = var.worker_clc_snippets
|
clc_snippets = var.worker_clc_snippets
|
||||||
|
node_labels = var.worker_node_labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,9 @@ systemd:
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
|
%{ for label in split(",", node_labels) }
|
||||||
|
--node-labels=${label} \
|
||||||
|
%{ endfor ~}
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
|
|
|
@ -81,6 +81,12 @@ variable "cluster_domain_suffix" {
|
||||||
default = "cluster.local"
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "node_labels" {
|
||||||
|
description = "List of additional labels to add to worker nodes"
|
||||||
|
type = list
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
variable "clc_snippets" {
|
variable "clc_snippets" {
|
||||||
type = list(string)
|
type = list(string)
|
||||||
description = "Container Linux Config snippets"
|
description = "Container Linux Config snippets"
|
||||||
|
|
|
@ -82,6 +82,7 @@ data "template_file" "worker-config" {
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
node_labels = join(",", var.node_labels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue