Update deployment of scope
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adrien Reslinger 2021-03-24 23:04:54 +01:00
parent 75fb29d1e2
commit bf63546a79
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
5 changed files with 15 additions and 27 deletions

View file

@ -1,11 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -L0 https://cloud.weave.works/k8s/1.13.1/scope.yaml -o 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 #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 #kubernetes-split-yaml scope.yaml > generated.log
mv generated/*.yaml files/scope/ #mv generated/*.yaml files/scope/
echo -e '---\nweave_scope_files:' > vars/scope-files.yaml #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 #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 #rm -fr generated{,.log} scope.yaml

View file

@ -9,4 +9,5 @@ basic_auth: false
#traefik_namespace: traefik #traefik_namespace: traefik
weave_net_password: "SuperMotDePasseDeLaMortQuiTue4012!" weave_net_password: "SuperMotDePasseDeLaMortQuiTue4012!"
scope_version: 1.13.0 weave_scope: false
weave_scope_version: 1.13.1

View file

@ -28,8 +28,6 @@
- name: Weave Scope setup - name: Weave Scope setup
block: block:
- name: Include Weave Scope vars
include_vars: scope-files.yaml
- name: namespace - name: namespace
k8s: k8s:
context: "{{ my_context }}" context: "{{ my_context }}"
@ -87,14 +85,15 @@
# file found https://github.com/weaveworks/scope/tree/master/examples/k8s/ # file found https://github.com/weaveworks/scope/tree/master/examples/k8s/
- name: Weave Scope files - name: Weave Scope files
k8s: k8s:
state: present state: "present"
context: "{{ my_context }}" context: "{{ my_context }}"
namespace: 'weave'
merge_type: merge merge_type: merge
resource_definition: "{{ lookup('file', item) | from_yaml }}" definition: "{{ item }}"
with_items: with_items: "{{ lookup('url', 'https://cloud.weave.works/k8s/' + weave_scope_version + '/scope.yaml', split_lines=False) | from_yaml_all | list }}"
- "{{ weave_scope_files }}" when:
when:
- weave_scope|bool - weave_scope|bool
- item is not none
tags: tags:
- weave - weave
- weave-scope - weave-scope

View file

@ -1,2 +0,0 @@
user: "{{ ansible_user_id }}"
weave_scope: false

View file

@ -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"