fix creation of heketi volumes and storage provisioning validation
parent
74cad6b811
commit
b56f465145
|
@ -1,11 +1,9 @@
|
|||
---
|
||||
- name: "Test heketi storage."
|
||||
tags: ["test"]
|
||||
command: "kubectl get secrets,endpoints,services,jobs --output=json"
|
||||
changed_when: false
|
||||
register: "heketi_storage_state"
|
||||
- name: "Create heketi storage."
|
||||
tags: ["test"]
|
||||
command: "kubectl create -f {{ artifacts_dir }}/heketi-storage.json"
|
||||
vars:
|
||||
secret_query: "items[?metadata.name=='heketi-storage-secret' && kind=='Secret']"
|
||||
|
@ -18,7 +16,6 @@
|
|||
- "heketi_storage_state.stdout|from_json|json_query(service_query)|length == 0"
|
||||
- "heketi_storage_state.stdout|from_json|json_query(job_query)|length == 0"
|
||||
- name: "Get state of heketi storage service, endpoint, secret and job."
|
||||
tags: ["test"]
|
||||
command: "kubectl get secrets,endpoints,services,jobs --output=json"
|
||||
changed_when: false
|
||||
register: "heketi_storage_state"
|
||||
|
@ -26,11 +23,11 @@
|
|||
secret_query: "items[?metadata.name=='heketi-storage-secret' && kind=='Secret']"
|
||||
endpoints_query: "items[?metadata.name=='heketi-storage-endpoints' && kind=='Endpoints']"
|
||||
service_query: "items[?metadata.name=='heketi-storage-endpoints' && kind=='Service']"
|
||||
job_query: "items[?metadata.name=='heketi-storage-copy-job' && kind=='Job' && status.conditions[?type=='Complete']]|[0].status.conditions|[0].status"
|
||||
job_query: "items[?metadata.name=='heketi-storage-copy-job' && kind=='Job']"
|
||||
until:
|
||||
- "heketi_storage_state.stdout|from_json|json_query(secret_query)|length == 1"
|
||||
- "heketi_storage_state.stdout|from_json|json_query(endpoints_query)|length == 1"
|
||||
- "heketi_storage_state.stdout|from_json|json_query(service_query)|length > 0"
|
||||
- "heketi_storage_state.stdout|from_json|json_query(job_query) == 'True'"
|
||||
- "heketi_storage_state.stdout|from_json|json_query(job_query)|length == 1"
|
||||
retries: 10
|
||||
delay: 10
|
||||
|
|
|
@ -16,5 +16,23 @@
|
|||
vars: { volume: "{{ volume_information.stdout|from_json }}" }
|
||||
when: "volume.name == 'heketidbstorage'"
|
||||
- name: "Provision database volume."
|
||||
command: "kubectl create -f {{ artifacts_dir }}/heketi-storage.json"
|
||||
when: "heketi_database_volume_exists != true"
|
||||
command: "heketi-cli -s http://localhost:48080 setup-openshift-heketi-storage"
|
||||
when: "heketi_database_volume_exists is undefined"
|
||||
- name: "Get heketi volume ids."
|
||||
command: "heketi-cli -s http://localhost:48080 volume list --json"
|
||||
changed_when: false
|
||||
register: "heketi_volumes"
|
||||
- name: "Get heketi volumes."
|
||||
changed_when: false
|
||||
command: "heketi-cli -s http://localhost:48080 volume info {{ volume_id }} --json"
|
||||
with_items: "{{ heketi_volumes.stdout|from_json|json_query(\"volumes[*]\") }}"
|
||||
loop_control: { loop_var: "volume_id" }
|
||||
register: "volumes_information"
|
||||
- name: "Test heketi database volume."
|
||||
set_fact: { heketi_database_volume_created: true }
|
||||
with_items: "{{ volumes_information.results }}"
|
||||
loop_control: { loop_var: "volume_information" }
|
||||
vars: { volume: "{{ volume_information.stdout|from_json }}" }
|
||||
when: "volume.name == 'heketidbstorage'"
|
||||
- name: "Ensure heketi database volume exists."
|
||||
assert: { that: "heketi_database_volume_created is defined" , msg: "Heketi database volume does not exist." }
|
||||
|
|
Loading…
Reference in New Issue