Skip to content

Commit

Permalink
Merge pull request #122 from nsathyaseelan/refactor-jiva-provision
Browse files Browse the repository at this point in the history
refactor[e2e]: Modify the test case to provision the jiva operator
  • Loading branch information
w3aman authored Aug 6, 2021
2 parents c9325ff + 05f7c59 commit f653b25
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 43 deletions.
246 changes: 203 additions & 43 deletions e2e-tests/experiments/jiva-operator/jiva-csi-provisioner/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,128 @@
status: 'SOT'

- block:

- name: Downloading jiva operator yaml for rc tag
get_url:
url: "{{ release_operator_link }}"
dest: "{{ playbook_dir }}/{{ jiva_operator }}"
force: yes
register: release_operator
- block:
- name: Downloading jiva operator yaml for release tag
get_url:
url: "{{ release_operator_link }}"
dest: "{{ playbook_dir }}/{{ jiva_operator }}"
force: yes
register: release_operator

- name: Downloading localpv operator yaml for release tag
get_url:
url: "{{ release_hostpath_link }}"
dest: "{{ playbook_dir }}/{{ charts_localpv_operator }}"
force: yes
register: localpv_operator

- block:

- name: Deploy localpv operator
shell: >
kubectl apply -f {{ charts_localpv_operator }}
args:
executable: /bin/bash
register: localpv_status

- name: Deploy jiva operator
shell: >
kubectl apply -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deploy_status

when: lookup('env','ACTION') == "provision"

- block:

- name: Deprovision jiva operator
shell: >
kubectl delete -f {{ jiva_operator }}
args:
executable: /bin/bash
register: jiva_deprovision
ignore_errors: True

- name: Deprovision localpv operator
shell: >
kubectl delete -f {{ charts_localpv_operator }}
args:
executable: /bin/bash
register: deprovision_status
ignore_errors: True

when: lookup('env','ACTION') == "deprovision"

when: rc_tag == ""

- block:

- name: Downloading jiva operator yaml release tag
get_url:
url: "{{ rc_operator_link }}"
dest: "{{ playbook_dir }}/{{ jiva_operator }}"
force: yes
register: rc_operator
when: rc_tag != ""
- name: Downloading jiva operator yaml release tag
get_url:
url: "{{ rc_operator_link }}"
dest: "{{ playbook_dir }}/{{ jiva_operator }}"
force: yes
register: rc_operator

- name: Downloading hostpath operator yaml
get_url:
url: "{{ hostpath_operator_link }}"
dest: "{{ playbook_dir }}/{{ hostpath_operator }}"
force: yes
register: result_hostpath

- name: Change the Localpv provisioner image
replace:
path: "{{ hostpath_operator }}"
regexp: "openebs/provisioner-localpv-ci:dev-120403"
replace: "openebs/provisioner-localpv:{{ localpv_tag }}"

- name: Deploy jiva operator
shell: >
kubectl apply -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deploy_status
when: lookup('env','ACTION') == "provision"
- name: Change the OpenEBS component labels to desired version in Operator yaml
replace:
path: "{{ hostpath_operator }}"
regexp: 'openebs.io/version: dev'
replace: "openebs.io/version: {{ localpv_tag }}"

- block:

- name: Deploy localpv operator
shell: >
kubectl apply -f {{ hostpath_operator }}
args:
executable: /bin/bash
register: localpv_status

- name: Deploy jiva operator
shell: >
kubectl apply -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deploy_status

when: lookup('env','ACTION') == "provision"

- block:

- name: Deprovision jiva operator
shell: >
kubectl delete -f {{ jiva_operator }}
args:
executable: /bin/bash
register: jiva_deprovision
ignore_errors: True

- name: Deprovision localpv operator
shell: >
kubectl delete -f {{ hostpath_operator }}
args:
executable: /bin/bash
register: deprovision_status
ignore_errors: True

when: lookup('env','ACTION') == "deprovision"

- name: Deprovision jiva operator
shell: >
kubectl delete -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deprovision_status
ignore_errors: True
when: lookup('env','ACTION') == "deprovision"
when: rc_tag != ""

when:
- release_tag == "commit_id"
Expand All @@ -67,21 +156,52 @@
delay: 5
retries: 3

- name: Deploy jiva operator
shell: >
kubectl apply -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deploy_status
- name: Downloading the localpv operator file from charts
get_url:
url: "{{ charts_hostpath_link }}"
dest: "{{ playbook_dir }}/{{ charts_localpv_operator }}"
force: yes
register: status
until: "'OK' in status.msg"
delay: 5
retries: 3

- block:

- name: Deploy localpv operator
shell: >
kubectl apply -f {{ charts_localpv_operator }}
args:
executable: /bin/bash
register: charts_localpv

- name: Deploy jiva operator
shell: >
kubectl apply -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deploy_status

when: lookup('env','ACTION') == "provision"

- name: Deprovision jiva operator
shell: >
kubectl delete -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deprovision_status
ignore_errors: True
- block:

- name: Deprovision jiva operator
shell: >
kubectl delete -f {{ jiva_operator }}
args:
executable: /bin/bash
register: deprovision_status
ignore_errors: True

- name: Deprovision localpv operator
shell: >
kubectl delete -f {{ charts_localpv_operator }}
args:
executable: /bin/bash
register: deprovision_localpv
ignore_errors: True

when: lookup('env','ACTION') == "deprovision"

when:
Expand Down Expand Up @@ -109,7 +229,23 @@
until: "'OK' in result.msg"
delay: 5
retries: 3


- name: Downloading hostpath operator yaml
get_url:
url: "{{ hostpath_operator_link }}"
dest: "{{ playbook_dir }}/{{ hostpath_operator }}"
force: yes
register: result_hostpath
until: "'OK' in result_hostpath.msg"
delay: 5
retries: 3

- name: Change the Localpv provisioner image
replace:
path: "{{ hostpath_operator }}"
regexp: "openebs/provisioner-localpv-ci:dev-120403"
replace: "openebs/provisioner-localpv:ci"

- block:

- name: Change the OpenEBS component labels to desired version in Operator yaml
Expand Down Expand Up @@ -158,6 +294,13 @@

- block:

- name: Deploy localpv operator
shell: >
kubectl apply -f {{ hostpath_operator }}
args:
executable: /bin/bash
register: charts_localpv

- name: Install the Jiva operator in operator namespace
shell: kubectl apply -f operator.yaml
args:
Expand Down Expand Up @@ -192,13 +335,30 @@
register: status
failed_when: "status.rc != 0"

- name: Deprovision localpv operator
shell: >
kubectl delete -f {{ hostpath_operator }}
args:
executable: /bin/bash
register: deprovision_localpv
ignore_errors: True

when: action == "deprovision"

when:
- release_tag == "master"

- block:

- name: Check if the OpenEBS-localpv-provisioner is running
shell: >
kubectl get pods -n {{ operator_ns }}
-o jsonpath='{.items[?(@.metadata.labels.name=="openebs-localpv-provisioner")].status.phase}'
register: local_pv
until: "'Running' in local_pv.stdout"
delay: 5
retries: 120

- name: Obtain the Jiva operator pod in operator namespace
shell: >
kubectl get po -n {{ operator_ns }} --no-headers -l name=jiva-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ commit_id: "{{ lookup('env','COMMIT_ID') }}"

rc_tag: "{{ lookup('env','RC_TAG') }}"

localpv_tag: "{{ lookup('env','OPENEBS_VERSION') }}-{{ lookup('env','RC_TAG') }}"

operator_ns: "{{ lookup('env','OPERATOR_NS') }}"

operator_link: https://raw.githubusercontent.com/openebs/jiva-operator/master/deploy/operator.yaml
Expand All @@ -34,6 +36,16 @@ release_operator_link: "https://raw.githubusercontent.com/openebs/charts/{{ comm

rc_operator_link: "https://raw.githubusercontent.com/openebs/charts/{{ commit_id }}/{{ openebs_version }}/jiva-operator-{{ rc_tag }}.yaml"

hostpath_operator_link: "https://raw.githubusercontent.com/openebs/dynamic-localpv-provisioner/develop/deploy/kubectl/provisioner-hostpath.yaml"

charts_hostpath_link: "https://raw.githubusercontent.com/openebs/charts/gh-pages/{{ openebs_version }}/hostpath-operator.yaml"

release_hostpath_link: "https://raw.githubusercontent.com/openebs/charts/{{ commit_id }}/{{ openebs_version }}/hostpath-operator.yaml"

charts_localpv_operator: hostpath-operator.yaml

hostpath_operator: provisioner-hostpath.yaml

jiva_operator: jiva-operator.yaml

operator_yaml: operator.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: openebs-hostpath
annotations:
openebs.io/cas-type: local
cas.openebs.io/config: |
- name: StorageType
value: hostpath
provisioner: openebs.io/local
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
with_items:
- jiva-csi
- jiva-csi-xfs
- openebs-hostpath

when: action == "provision"

Expand All @@ -70,6 +71,7 @@
with_items:
- jiva-csi
- jiva-csi-xfs
- openebs-hostpath

when: action == "deprovision"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ action: "{{ lookup('env','ACTION') }}"
storage_policies:
- jiva-csi-xfs-sc.yml
- jiva-csi-sc.yml
- localpv-sc.yml

0 comments on commit f653b25

Please sign in to comment.