aboutsummaryrefslogtreecommitdiffstats
path: root/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/clear-danm.yaml
blob: 1f98980533e41081c9c7c5f61e0f5e2d96023f71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---

- name: Delete DanmNet CRD's
  k8s:
    state: absent
    definition: '{{ item }}'
  with_items: '{{ lookup("url", "https://raw.githubusercontent.com/nokia/danm/v4.3.0/integration/crds/lightweight/DanmNet.yaml", split_lines=False) | from_yaml_all | list }}'
  when: item is not none

- name: Delete DanmEp CRD's
  k8s:
    state: absent
    definition: '{{ item }}'
  with_items: '{{ lookup("url", "https://raw.githubusercontent.com/nokia/danm/v4.3.0/integration/crds/lightweight/DanmEp.yaml", split_lines=False) | from_yaml_all | list }}'
  when: item is not none


- name: Delete Danm service account
  k8s:
    state: absent
    kind: ServiceAccount
    name: danm
    namespace: kube-system

- name: Delete Danm cni conf
  command: sudo rm -f  /etc/cni/net.d/00-danm.conf

- name: Delete Danm cni kubeconfig
  command: sudo rm -f /etc/cni/net.d/danm-kubeconfig

- name: Delete Danm rbac
  k8s:
    state: absent
    definition: '{{ item }}'
  with_items: '{{ lookup("url", "https://raw.githubusercontent.com/nokia/danm/v4.3.0/integration/cni_config/danm_rbac.yaml", split_lines=False) | from_yaml_all | list }}'
  when: item is not none

- name: Delete Danm cni plugins
  k8s:
    state: absent
    definition: "{{ lookup('file', 'danm-cni-plugins.yaml') }}"

- name: Delete Danm netwatcher
  k8s:
    state: absent
    definition: "{{ lookup('file', 'danm-netwatcher-daemonset.yaml') }}"

- name: Get CA Bundle
  shell: kubectl config view --raw -o json | jq -r '.clusters[0].cluster."certificate-authority-data"' | tr -d '"'
  register: danm_ca_bundle

- name: Generate webhook deployment
  template:
    src: danm-webhook.yaml
    dest: /tmp/danm-webhook.yaml
    mode: 0644
  vars:
    ca_bundle: "{{ danm_ca_bundle.stdout }}"

- name: Delete Danm webhook
  k8s:
    state: absent
    src: /tmp/danm-webhook.yaml