feat: add option to apply custom node labels
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a75b4c8250
commit
25c06319c0
@ -51,3 +51,5 @@ k3s_server_admission_configuration:
|
||||
|
||||
k3s_server_resource_creations: []
|
||||
k3s_server_resource_patches: []
|
||||
|
||||
k3s_node_labels: {}
|
||||
|
@ -28,6 +28,8 @@
|
||||
# type: Opaque
|
||||
# data:
|
||||
# token: "{{ hcloud_token | b64encode }}"
|
||||
k3s_node_labels:
|
||||
node.kubernetes.io/exclude-from-external-load-balancers: "true"
|
||||
pre_tasks:
|
||||
- name: Override host variables
|
||||
ansible.builtin.set_fact:
|
||||
|
@ -21,6 +21,13 @@ def test_k3s_node_ready(host):
|
||||
assert "rocky9-k3s:Ready=True;" in nodes
|
||||
|
||||
|
||||
def test_k3s_node_labels(host):
|
||||
jsonpth = '{.items[0].metadata.labels}' # noqa
|
||||
nodes = host.run(f"k3s kubectl get nodes -o jsonpath='{jsonpth}'").stdout
|
||||
|
||||
assert '"node.kubernetes.io/exclude-from-external-load-balancers":"true"' in nodes
|
||||
|
||||
|
||||
def test_k3s_cluster_ready(host):
|
||||
cluster = host.run("k3s kubectl get --raw='/readyz'").stdout
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
||||
state: patched
|
||||
definition:
|
||||
metadata:
|
||||
labels: "{{ (__k3s_node_lables['control'] if k3s_server | bool else __k3s_node_lables['worker']) | combine(__k3s_node_lables['general']) }}"
|
||||
labels: "{{ (__k3s_node_lables['control'] if k3s_server | bool else __k3s_node_lables['worker']) | combine(__k3s_node_lables['general'], k3s_node_labels) }}"
|
||||
delegate_to: "{{ hostvars[k3s_server_nodes[0]]['inventory_hostname'] }}"
|
||||
|
||||
- name: Patch existing resources
|
||||
|
Loading…
Reference in New Issue
Block a user