Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use case: delete openebs control plane components from a k8s cluster #88

Closed
amitbhatt818 opened this issue Jun 30, 2020 · 0 comments
Closed

Comments

@amitbhatt818
Copy link
Contributor

What is the issue ??

  • In our e2e pipeline we are deleting openebs components from the cluster using ansible script which is responsible for deleting opnebs from the cluster. We need to do the same using declarative approach.

Script used to remove openebs from cluster

## Check if SPC is present in the cluster
- name: Checking if SPC is present in the cluster
  shell: kubectl get spc --no-headers | wc -l
  args:
    executable: /bin/bash
  register: spc

## Clean up SPC (if any present) from the cluster
- name: Cleaning up SPC from the cluster
  shell: kubectl delete spc --all                                                            
  args:                                            
    executable: /bin/bash                          
  when: "spc.stdout > '0'"

## Check if PV is present in the cluster
- name: Checking if PV is present in the cluster
  shell: kubectl get pv -n openebs --no-headers | wc -l
  args:
    executable: /bin/bash
  register: pv

## Clean up PV (if any present) from the cluster
- name: Removing PV from the cluster
  shell: kubectl delete pv -n {{ namespace }} --all
  args:
    executable: /bin/bash
  when: "pv.stdout > '0'"

## Check if BD is present in the cluster
- name: Checking if BD is present in the cluster
  shell: kubectl get bd -n openebs --no-headers | wc -l
  args:
    executable: /bin/bash
  register: bd

## Clean up BD (if any present) from the cluster
- name: Removing Blockdevices from the cluster
  shell: kubectl delete bd -n {{ namespace }} --all
  args:
    executable: /bin/bash
  when: "bd.stdout > '0'"
      
## Cleaning up deployment
- name: Removing deployment from openebs namespace
  shell: kubectl delete deploy -n {{ namespace }} --all
  args:
    executable: /bin/bash

## Cleaning up NDM Daemonset
- name: Removing NDM DaemonSet
  shell: kubectl delete ds -n {{ namespace }} --all
  args:
    executable: /bin/bash

## Cleaning up OpenEBS Namespace
- name: Removing openebs namespace
  shell: kubectl delete ns {{ namespace }}
  args:
    executable: /bin/bash
             
## Checking openebs ns is deleted or not
- name: Waiting for graceful termination of openebs namespace
  shell: kubectl get ns --no-headers | grep {{ namespace }} | awk '{print $1}' | wc -l
  args:
    executable: /bin/bash
  register: openebs_ns
  until: "openebs_ns.stdout=='0'"
  retries: 30
  delay: 2

- name: Waiting for graceful termination of openebs pods
  shell: kubectl get pods -n {{ namespace }} --no-headers | awk '{print $1}' | wc -l
  args:
    executable: /bin/bash
  register: pod_list
  until: "pod_list.stdout=='0'"
  retries: 30
  delay: 5

- name: Check openebses should not have openebs active entry
  uri:
    url: "{{ director_url }}/v3/groups/{{ group_id }}/openebses?state=active&clusterId={{ cluster_id }}"
    url_username: "{{ username.stdout }}"
    url_password: "{{ password.stdout }}"
    method: GET
    status_code: 200
  register: openebses_active
  until: "openebses_active.json.data == []"
  delay: 10
  retries: 30


@amitbhatt818 amitbhatt818 changed the title Delete openebs control plan components from cluster using d-operators Delete openebs control plane components from cluster using d-operators Jun 30, 2020
@AmitKumarDas AmitKumarDas changed the title Delete openebs control plane components from cluster using d-operators use case: delete openebs control plane components from a k8s cluster Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants