From 649388188b41931622f9a6f393b7a9a540e0591b Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Sat, 9 Sep 2017 23:38:38 +0300 Subject: [PATCH] Fix netchecker update side effect (#1644) * Fix netchecker update side effect kubectl apply should only be used on resources created with kubectl apply. To workaround this, we should apply the old manifest before upgrading it. * Update 030_check-network.yml --- .../ansible/tasks/netchecker.yml | 17 +++++++++++++++++ tests/testcases/030_check-network.yml | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/roles/kubernetes-apps/ansible/tasks/netchecker.yml b/roles/kubernetes-apps/ansible/tasks/netchecker.yml index a74a4dc87..4e91da224 100644 --- a/roles/kubernetes-apps/ansible/tasks/netchecker.yml +++ b/roles/kubernetes-apps/ansible/tasks/netchecker.yml @@ -1,4 +1,21 @@ --- + +- name: Kubernetes Apps | Check if netchecker-server manifest already exists + stat: + path: "{{ kube_config_dir }}/netchecker-server-deployment.yml.j2" + register: netchecker_server_manifest + tags: ['facts', 'upgrade'] + +- name: Kubernetes Apps | Apply netchecker-server manifest to update annotations + kube: + name: "netchecker-server" + namespace: "{{ netcheck_namespace }}" + kubectl: "{{bin_dir}}/kubectl" + resource: "deploy" + state: latest + when: inventory_hostname == groups['kube-master'][0] and netchecker_server_manifest.stat.exists + tags: upgrade + - name: Kubernetes Apps | Lay Down Netchecker Template template: src: "{{item.file}}" diff --git a/tests/testcases/030_check-network.yml b/tests/testcases/030_check-network.yml index ee5f60785..7c934c592 100644 --- a/tests/testcases/030_check-network.yml +++ b/tests/testcases/030_check-network.yml @@ -16,7 +16,7 @@ shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide" register: get_pods - - debug: msg="{{get_pods.stdout}}" + - debug: msg="{{get_pods.stdout.split('\n')}}" - name: Get pod names shell: "{{bin_dir}}/kubectl get pods -o json"