var node_labels as string (#4764)
parent
ff1bc739f1
commit
8485136f9a
|
@ -117,11 +117,13 @@ Stack](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/dns-stack.m
|
||||||
from the kube-apiserver when the certificate expiration approaches.
|
from the kube-apiserver when the certificate expiration approaches.
|
||||||
* *node_labels* - Labels applied to nodes via kubelet --node-labels parameter.
|
* *node_labels* - Labels applied to nodes via kubelet --node-labels parameter.
|
||||||
For example, labels can be set in the inventory as variables or more widely in group_vars.
|
For example, labels can be set in the inventory as variables or more widely in group_vars.
|
||||||
*node_labels* must be defined as a dict:
|
*node_labels* can be defined either as a dict or a comma-separaded labels string:
|
||||||
```
|
```
|
||||||
node_labels:
|
node_labels:
|
||||||
label1_name: label1_value
|
label1_name: label1_value
|
||||||
label2_name: label2_value
|
label2_name: label2_value
|
||||||
|
|
||||||
|
node_labels: "label1_name=label1_value,label2_name=label2_value"
|
||||||
```
|
```
|
||||||
* *node_taints* - Taints applied to nodes via kubelet --register-with-taints parameter.
|
* *node_taints* - Taints applied to nodes via kubelet --register-with-taints parameter.
|
||||||
For example, taints can be set in the inventory as variables or more widely in group_vars.
|
For example, taints can be set in the inventory as variables or more widely in group_vars.
|
||||||
|
|
|
@ -91,10 +91,15 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set inventory_node_labels = [] %}
|
{% set inventory_node_labels = [] %}
|
||||||
{% if node_labels is defined and node_labels is mapping %}
|
{% if node_labels is defined %}
|
||||||
|
{% if node_labels is mapping %}
|
||||||
{% for labelname, labelvalue in node_labels.items() %}
|
{% for labelname, labelvalue in node_labels.items() %}
|
||||||
{% set dummy = inventory_node_labels.append('%s=%s'|format(labelname, labelvalue)) %}
|
{% set dummy = inventory_node_labels.append('%s=%s'|format(labelname, labelvalue)) %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% for label in node_labels.split(",") %}
|
||||||
|
{% set dummy = inventory_node_labels.append(label) %}
|
||||||
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set all_node_labels = role_node_labels + inventory_node_labels %}
|
{% set all_node_labels = role_node_labels + inventory_node_labels %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue