diff options
Diffstat (limited to 'roles/kubernetes/decorations/tasks/annotations.yml')
-rw-r--r-- | roles/kubernetes/decorations/tasks/annotations.yml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/roles/kubernetes/decorations/tasks/annotations.yml b/roles/kubernetes/decorations/tasks/annotations.yml index 9b47ecbf..0c0438f6 100644 --- a/roles/kubernetes/decorations/tasks/annotations.yml +++ b/roles/kubernetes/decorations/tasks/annotations.yml @@ -7,7 +7,7 @@ register: kubectl_list_annotations - set_fact: - current_annotations: "{{ kubectl_list_annotations.stdout | from_json }}" + current_annotations: "{{ kubectl_list_annotations.stdout | ternary(kubectl_list_annotations.stdout, '[]') | from_json }}" - name: add annotations to node delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}" @@ -22,7 +22,7 @@ loop_control: label: "{{ item.key }}={{ item.value }}" copy: - dest: "/etc/kubernetes/decorations/annotations/{{ item.key }}" + dest: "/etc/kubernetes/decorations/annotations/{{ item.key | replace('/', '%') }}" content: "{{ item.value }}" - name: get list of managed labels @@ -32,13 +32,13 @@ - name: remove superflous annotations from node delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}" - loop: "{{ managed_annotations.files | map(attribute='path') | map('basename') }}" + loop: "{{ managed_annotations.files | map(attribute='path') | map('basename') | replace('%', '/') }}" when: "item not in kubernetes_node_annotations" command: kubectl --kubeconfig /etc/kubernetes/admin.conf annotate --overwrite node '{{ kubernetes_node_name }}' '{{ item }}-' - name: remove stamp files for superflous annotations - loop: "{{ managed_annotations.files | map(attribute='path') | map('basename') }}" + loop: "{{ managed_annotations.files | map(attribute='path') | map('basename') | replace('%', '/') }}" when: "item not in kubernetes_node_annotations" file: - path: "/etc/kubernetes/decorations/annotations/{{ item }}" + path: "/etc/kubernetes/decorations/annotations/{{ item | replace('/', '%') }}" state: absent |