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

Added tasks specific to cstor deployment in libiscsi playbook #1859

Merged
merged 1 commit into from
Aug 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions e2e/ansible/playbooks/compliance/iscsi/libiscsi-cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
---
- name: Obtaining PV name
shell: kubectl get pvc -n {{ namespace }} --no-headers -o custom-columns=:metadata.name
args:
executable: /bin/bash
register: pv
delegate_to: "{{groups['kubernetes-kubemasters'].0}}"

- include_tasks: "{{utils_path}}/delete_deploy.yml"
vars:
ns: "{{ namespace }}"
app_yml: "{{ volume_def }}"

- name: Confirm whether the pods are deleted.
shell: source ~/.profile; kubectl get pods -n {{ namespace }}
args:
executable: /bin/bash
delegate_to: "{{groups['kubernetes-kubemasters'].0}}"
register: result
until: "pv.stdout not in result.stdout"
delay: 30
retries: 10
when: storage_engine == 'jiva'

- name: Confirm the iSCSI target has been deleted
shell: source ~/.profile; kubectl get pvc -n {{ namespace }}
- name: Confirm if the target pod is deleted
shell: source ~/.profile; kubectl get pods -n {{ operator_ns }} | grep {{ namespace }}
args:
executable: /bin/bash
delegate_to: "{{groups['kubernetes-kubemasters'].0}}"
register: result
until: "'pvc' not in result.stdout"
delay: 120
retries: 6
changed_when: true
until: "pv.stdout not in result.stdout"
delay: 30
retries: 10
when: storage_engine == 'cStor'

- name: Remove test artifacts
file:
125 changes: 89 additions & 36 deletions e2e/ansible/playbooks/compliance/iscsi/libiscsi.yml
Original file line number Diff line number Diff line change
@@ -38,46 +38,99 @@
status: create
ns: "{{ namespace }}"

- name: 3a) Create a storage volume via a pvc
shell: source ~/.profile; kubectl apply -f "{{ volume_def }}" -n {{ namespace }}
args:
executable: /bin/bash
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"
- block:

- name: 3b) Confirm volume container is running
shell: source ~/.profile; kubectl get pods -n {{ namespace }} | grep {{item}} | grep Running | wc -l
args:
executable: /bin/bash
register: result
until: result.stdout|int >= 1
delay: 30
retries: 10
with_items:
- ctrl
- rep
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"
- name: Replace storage-class to use jiva storage engine
replace:
path: "{{ result_kube_home.stdout }}/{{ volume_def }}"
regexp: 'openebs-standard'
replace: '{{ jiva_sc }}'
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"

- name: 3a) Create a storage volume via a pvc
shell: source ~/.profile; kubectl apply -f "{{ result_kube_home.stdout }}/{{ volume_def }}" -n {{ namespace }}
args:
executable: /bin/bash
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"

- name: 3b) Confirm volume container is running
shell: source ~/.profile; kubectl get pods -n {{ namespace }} | grep {{item}} | grep Running | wc -l
args:
executable: /bin/bash
register: result
until: result.stdout|int >= 1
delay: 30
retries: 10
with_items:
- ctrl
- rep
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"

- name: 4) Get storage ctrl pod name
shell: source ~/.profile; kubectl get pods -n {{ namespace }} | grep ctrl
args:
executable: /bin/bash
register: ctrl_name
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"

- name: 4a) Set ctrl pod name to variable
set_fact:
ctrl_pod_name: "{{ ctrl_name.stdout.split()[0] }}"

- name: 4) Get storage ctrl pod name
shell: source ~/.profile; kubectl get pods -n {{ namespace }} | grep ctrl
args:
executable: /bin/bash
register: ctrl_name
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"
- name: 4b) Get IP address of ctrl pod
shell: source ~/.profile; kubectl describe pod {{ ctrl_pod_name }} -n {{ namespace }} | grep IP
args:
executable: /bin/bash
register: ctrl_IP
delegate_to: "{{groups['kubernetes-kubemasters'].0}}"

- name: 4a) Set ctrl pod name to variable
set_fact:
ctrl_pod_name: "{{ ctrl_name.stdout.split()[0] }}"
- name: 4c) Set IP of Pod to variable
set_fact:
ctrl_ip: "{{ ctrl_IP.stdout_lines[0].split()[1]}}"

when: storage_engine == 'jiva'

- name: 4b) Get IP address of ctrl pod
shell: source ~/.profile; kubectl describe pod {{ ctrl_pod_name }} -n {{ namespace }} | grep IP
args:
executable: /bin/bash
register: ctrl_IP
delegate_to: "{{groups['kubernetes-kubemasters'].0}}"
- block:

- name: 4c) Set IP of Pod to variable
set_fact:
ctrl_ip: "{{ ctrl_IP.stdout_lines[0].split()[1]}}"
- name: Replace the storage class in the volume definition yaml
replace:
path: "{{ result_kube_home.stdout }}/{{ volume_def }}"
regexp: 'openebs-standard'
replace: '{{ cstor_sc }}'
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"

- name: 3a) Create a storage volume via a pvc
shell: source ~/.profile; kubectl apply -f "{{ result_kube_home.stdout }}/{{ volume_def }}" -n {{ namespace }}
args:
executable: /bin/bash
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"

- name: Check if the cstor target has been created and running.
shell: source ~/.profile; kubectl get pods -n {{ operator_ns }} -l openebs.io/target=cstor-target | grep {{ namespace }}
args:
executable: /bin/bash
register: pods_list
until: "'Running' in pods_list.stdout"
delay: 30
retries: 15
delegate_to: "{{ groups['kubernetes-kubemasters'].0 }}"

- name: Get the target pod name
set_fact:
ctrl_pod_name: "{{ pods_list.stdout.split()[0] }}"

- name: 4b) Get IP address of ctrl pod
shell: source ~/.profile; kubectl describe pod {{ ctrl_pod_name }} -n {{ operator_ns }} | grep IP
args:
executable: /bin/bash
register: ctrl_IP
delegate_to: "{{groups['kubernetes-kubemasters'].0}}"

- name: 4c) Set IP of Pod to variable
set_fact:
ctrl_ip: "{{ ctrl_IP.stdout_lines[0].split()[1]}}"

when: storage_engine == 'cStor'

- name: 5) Copy libiscsi test list into kube minion
copy:
@@ -172,4 +225,4 @@

- name: Set Test Name as Fact
set_fact:
testname: "{{ test_name }}"
testname: "{{ test_name }}"