summaryrefslogtreecommitdiff
path: root/roles/kubernetes/decorations/tasks/annotations.yml
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-08-19 23:12:06 +0200
committerChristian Pointner <equinox@spreadspace.org>2022-08-19 23:12:06 +0200
commit2e17e55783c109e917d8b0f14c5de05632f44761 (patch)
treef913f8b762e6e5bace08f3ab89459bc677666daa /roles/kubernetes/decorations/tasks/annotations.yml
parentkubernetes: add support for ansible managed node annotations,labels and taints (diff)
kubernetes/decorations: replace '/' with '%' in stamp file names
Diffstat (limited to 'roles/kubernetes/decorations/tasks/annotations.yml')
-rw-r--r--roles/kubernetes/decorations/tasks/annotations.yml10
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