Procházet zdrojové kódy

Updating fluentd label and wait to be in a single shell rather than running a script from /tmp

Eric Wolinetz před 6 roky
rodič
revize
4ac6b4b70c

+ 0 - 22
roles/openshift_logging_fluentd/tasks/label_and_wait.yaml

@@ -1,22 +0,0 @@
----
-# This script is a special case because we need to pause between nodes while
-# labeling to avoid overloading the scheduler.
-# Also, looping over this task file (label_and_wait) causes memory to balloon
-# in some instances due to dynamic include bug in ansible, so we can't add the
-# wait in ansible directly.
-- name: Create temporary fluentd labeling script
-  template:
-    src: fluentd_label.sh.j2
-    dest: /tmp/fluentd_label.temp.sh
-    mode: "0744"
-
-- name: Execute the fluentd temporary labeling script
-  command: "/tmp/fluentd_label.temp.sh {{ fluentd_host }}"
-  with_items: "{{ openshift_logging_fluentd_hosts }}"
-  loop_control:
-    loop_var: fluentd_host
-
-- name: Remove temporary fluentd labeling script
-  file:
-    path: /tmp/fluentd_label.temp.sh
-    state: absent

+ 11 - 1
roles/openshift_logging_fluentd/tasks/main.yaml

@@ -199,7 +199,17 @@
     openshift_logging_fluentd_hosts: "{{ fluentd_hosts.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
   when: "'--all' in openshift_logging_fluentd_hosts"
 
-- import_tasks: label_and_wait.yaml
+# We need to pause between nodes while labeling to avoid overloading the scheduler.
+- name: Label OCP nodes for Fluentd
+  shell: >
+    {{ openshift_client_binary }} --config=/etc/origin/master/admin.kubeconfig \
+    label --overwrite node {{ fluentd_host }} \
+    {% for k, v in openshift_logging_fluentd_nodeselector.items() %} {{ k }}={{ v }} {% endfor %} \
+    && \
+    sleep {{ openshift_logging_fluentd_label_delay }}
+  with_items: "{{ openshift_logging_fluentd_hosts }}"
+  loop_control:
+    loop_var: fluentd_host
 
 - name: Delete temp directory
   file:

+ 0 - 8
roles/openshift_logging_fluentd/templates/fluentd_label.sh.j2

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-{{ openshift_client_binary }} --config=/etc/origin/master/admin.kubeconfig \
-  label --overwrite node $1 \
-  {% for k, v in openshift_logging_fluentd_nodeselector.items() %} {{ k }}={{ v }} {% endfor %}
-
-# We sleep here because scheduler will get overwhelmed if we label all nodes at once.
-sleep {{ openshift_logging_fluentd_label_delay }}