aboutsummaryrefslogtreecommitdiffstats
path: root/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/clear-danm.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/clear-danm.yaml')
-rw-r--r--tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/clear-danm.yaml63
1 files changed, 63 insertions, 0 deletions
diff --git a/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/clear-danm.yaml b/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/clear-danm.yaml
new file mode 100644
index 00000000..1f989805
--- /dev/null
+++ b/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/clear-danm.yaml
@@ -0,0 +1,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