Skip to content

Commit

Permalink
labels singleno
Browse files Browse the repository at this point in the history
  • Loading branch information
ReSearchITEng committed Jan 31, 2022
1 parent 699fd51 commit 4f6e504
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions roles/tools/tasks/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,26 @@
ignore_errors: yes
when:
- inventory_hostname not in groups['masters']
tags:
- all

- block:
- name: get name of primary_master when single node cluster
environment:
KUBECONFIG: /etc/kubernetes/admin.conf
shell: 'kubectl get no -o=jsonpath="{.items[0].metadata.name}"'
register: result_primary_master_name

- block:
# - name: get name of primary_master when single node cluster
# environment:
# KUBECONFIG: /etc/kubernetes/admin.conf
# shell: 'kubectl get no -o=jsonpath="{.items[0].metadata.name}"'
# register: result_primary_master_name

- name: when cluster is one machine only, labeling it also as infra node
environment:
KUBECONFIG: /etc/kubernetes/admin.conf
shell: 'kubectl label nodes {{ result_primary_master_name.stdout_lines[0] }} "node-role.kubernetes.io/infra=" --overwrite'
shell: 'kubectl label nodes -l="node-role.kubernetes.io/master=" "node-role.kubernetes.io/infra=" --overwrite'
register: command_result
changed_when: '"not labeled" not in command_result.stdout'
ignore_errors: yes
when:
- groups['all'] | length == 1
tags:
- all
when:
- groups['all'] | length == 1
tags:
- all

0 comments on commit 4f6e504

Please sign in to comment.