From bf63546a7945a64f68eedd0b0415e54e5e18596a Mon Sep 17 00:00:00 2001 From: Adrien Reslinger Date: Wed, 24 Mar 2021 23:04:54 +0100 Subject: [PATCH] Update deployment of scope --- bin/update.sh | 14 +++++++------- defaults/main.yml | 3 ++- tasks/main.yml | 13 ++++++------- vars/main.yml | 2 -- vars/scope-files.yaml | 10 ---------- 5 files changed, 15 insertions(+), 27 deletions(-) delete mode 100644 vars/main.yml delete mode 100644 vars/scope-files.yaml diff --git a/bin/update.sh b/bin/update.sh index 8371a2a..ad8f7dd 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -curl -L0 https://cloud.weave.works/k8s/1.13.1/scope.yaml -o scope.yaml -sed -e /^apiVersion/d -e /^kind/d -e /^items/d -e "s/^ //" -e '/^- / i---' -e 's/^[ -] //' -i scope.yaml -kubernetes-split-yaml scope.yaml > generated.log -mv generated/*.yaml files/scope/ -echo -e '---\nweave_scope_files:' > vars/scope-files.yaml -cat generated.log | while read LIGNE; do if [ $(echo "${LIGNE}" | grep -c ^File) -eq 1 ]; then echo -n "${LIGNE} "; else echo "${LIGNE}"; fi; done | grep ^File | sort -V | sed 's|.*\(generated/\)\(.*\.yaml\)| - "scope/\2"|' >> vars/scope-files.yaml -rm -fr generated{,.log} scope.yaml +#curl -L0 https://cloud.weave.works/k8s/1.13.1/scope.yaml -o scope.yaml +#sed -e /^apiVersion/d -e /^kind/d -e /^items/d -e "s/^ //" -e '/^- / i---' -e 's/^[ -] //' -i scope.yaml +#kubernetes-split-yaml scope.yaml > generated.log +#mv generated/*.yaml files/scope/ +#echo -e '---\nweave_scope_files:' > vars/scope-files.yaml +#cat generated.log | while read LIGNE; do if [ $(echo "${LIGNE}" | grep -c ^File) -eq 1 ]; then echo -n "${LIGNE} "; else echo "${LIGNE}"; fi; done | grep ^File | sort -V | sed 's|.*\(generated/\)\(.*\.yaml\)| - "scope/\2"|' >> vars/scope-files.yaml +#rm -fr generated{,.log} scope.yaml diff --git a/defaults/main.yml b/defaults/main.yml index aa0c472..4213249 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -9,4 +9,5 @@ basic_auth: false #traefik_namespace: traefik weave_net_password: "SuperMotDePasseDeLaMortQuiTue4012!" -scope_version: 1.13.0 +weave_scope: false +weave_scope_version: 1.13.1 diff --git a/tasks/main.yml b/tasks/main.yml index 4cebee5..a30c524 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -28,8 +28,6 @@ - name: Weave Scope setup block: - - name: Include Weave Scope vars - include_vars: scope-files.yaml - name: namespace k8s: context: "{{ my_context }}" @@ -87,14 +85,15 @@ # file found https://github.com/weaveworks/scope/tree/master/examples/k8s/ - name: Weave Scope files k8s: - state: present + state: "present" context: "{{ my_context }}" + namespace: 'weave' merge_type: merge - resource_definition: "{{ lookup('file', item) | from_yaml }}" - with_items: - - "{{ weave_scope_files }}" - when: + definition: "{{ item }}" + with_items: "{{ lookup('url', 'https://cloud.weave.works/k8s/' + weave_scope_version + '/scope.yaml', split_lines=False) | from_yaml_all | list }}" + when: - weave_scope|bool + - item is not none tags: - weave - weave-scope diff --git a/vars/main.yml b/vars/main.yml deleted file mode 100644 index ba6f665..0000000 --- a/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -user: "{{ ansible_user_id }}" -weave_scope: false \ No newline at end of file diff --git a/vars/scope-files.yaml b/vars/scope-files.yaml deleted file mode 100644 index 5b2810b..0000000 --- a/vars/scope-files.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -weave_scope_files: - - "scope/weave-Namespace.yaml" - - "scope/weave-scope-ServiceAccount.yaml" - - "scope/weave-scope-ClusterRole.yaml" - - "scope/weave-scope-ClusterRoleBinding.yaml" - - "scope/weave-scope-app-Deployment.yaml" - - "scope/weave-scope-app-Service.yaml" - - "scope/weave-scope-cluster-agent-Deployment.yaml" - - "scope/weave-scope-agent-DaemonSet.yaml"