summaryrefslogtreecommitdiffstats
path: root/roles/openshift_storage_glusterfs/tasks
diff options
context:
space:
mode:
authorJose A. Rivera <jarrpa@redhat.com>2017-10-16 15:55:31 -0500
committerJose A. Rivera <jarrpa@redhat.com>2017-11-08 08:51:24 -0600
commitcfe73d1ebb9a29d51f0e96aa6df561b52332f859 (patch)
treec256897a057dd99fb2c55216be1ac19f34e97346 /roles/openshift_storage_glusterfs/tasks
parent5b85d56f5b2a5f3cc21fcdd17a3237d44b35c375 (diff)
downloadopenshift-cfe73d1ebb9a29d51f0e96aa6df561b52332f859.tar.gz
openshift-cfe73d1ebb9a29d51f0e96aa6df561b52332f859.tar.bz2
openshift-cfe73d1ebb9a29d51f0e96aa6df561b52332f859.tar.xz
openshift-cfe73d1ebb9a29d51f0e96aa6df561b52332f859.zip
GlusterFS: Add gluster-s3 functionality
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Diffstat (limited to 'roles/openshift_storage_glusterfs/tasks')
-rw-r--r--roles/openshift_storage_glusterfs/tasks/gluster_s3_deploy.yml113
-rw-r--r--roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml95
-rw-r--r--roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml10
-rw-r--r--roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml10
4 files changed, 183 insertions, 45 deletions
diff --git a/roles/openshift_storage_glusterfs/tasks/gluster_s3_deploy.yml b/roles/openshift_storage_glusterfs/tasks/gluster_s3_deploy.yml
new file mode 100644
index 000000000..1664ecc1e
--- /dev/null
+++ b/roles/openshift_storage_glusterfs/tasks/gluster_s3_deploy.yml
@@ -0,0 +1,113 @@
+---
+- name: Delete pre-existing gluster-s3 resources
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: "{{ item.kind }}"
+ name: "{{ item.name | default(omit) }}"
+ selector: "{{ item.selector | default(omit) }}"
+ state: absent
+ with_items:
+ - kind: "all,svc,deploy,secret,sc,pvc"
+ selector: "gluster-s3"
+ failed_when: False
+ when: glusterfs_wipe
+
+- name: Wait for gluster-s3 pods to terminate
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: pod
+ state: list
+ selector: "glusterfs=s3-{{ glusterfs_name }}-provisioner-pod"
+ register: gluster_s3_pod
+ until: "gluster_s3_pod.results.results[0]['items'] | count == 0"
+ delay: 10
+ retries: "{{ (glusterfs_timeout | int / 10) | int }}"
+ when: glusterfs_wipe
+
+- name: Copy gluster-s3 PVCs template file
+ copy:
+ src: "{{ openshift.common.examples_content_version }}/{{ item }}"
+ dest: "{{ mktemp.stdout }}/{{ item }}"
+ with_items:
+ - "gluster-s3-pvcs-template.yml"
+
+- name: Create gluster-s3 PVCs template
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: template
+ name: "gluster-s3-pvcs"
+ state: present
+ files:
+ - "{{ mktemp.stdout }}/gluster-s3-pvcs-template.yml"
+
+- name: Create gluster-s3 PVCs
+ oc_process:
+ namespace: "{{ glusterfs_namespace }}"
+ template_name: "gluster-s3-pvcs"
+ create: True
+ params:
+ S3_ACCOUNT: "{{ glusterfs_s3_account }}"
+ PVC: "{{ glusterfs_s3_pvc }}"
+ PVC_SIZE: "{{ glusterfs_s3_pvc_size }}"
+ META_PVC: "{{ glusterfs_s3_meta_pvc }}"
+ META_PVC_SIZE: "{{ glusterfs_s3_meta_pvc_size }}"
+ CLUSTER_NAME: "{{ glusterfs_name }}"
+
+- name: Wait for gluster-s3 PVCs
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: pvc
+ state: list
+ selector: "glusterfs=s3-{{ glusterfs_name }}-{{ glusterfs_s3_account }}-storage"
+ register: gluster_s3_pvcs
+ until:
+ - "gluster_s3_pvcs.results.results[0]['items'] | count > 0"
+ # Pod's 'Bound' status must be True
+ - "gluster_s3_pvcs.results.results[0]['items'] | oo_collect(attribute='status.conditions') | oo_collect(attribute='status', filters={'type': 'Bound'}) | map('bool') | select | list | count == 2"
+ delay: 10
+ retries: "{{ (glusterfs_timeout | int / 10) | int }}"
+
+- name: Copy gluster-s3 template file
+ copy:
+ src: "{{ openshift.common.examples_content_version }}/{{ item }}"
+ dest: "{{ mktemp.stdout }}/{{ item }}"
+ with_items:
+ - "gluster-s3-template.yml"
+
+- name: Create gluster-s3 template
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: template
+ name: "gluster-s3"
+ state: present
+ files:
+ - "{{ mktemp.stdout }}/gluster-s3-template.yml"
+
+- name: Deploy gluster-s3 service
+ oc_process:
+ namespace: "{{ glusterfs_namespace }}"
+ template_name: "gluster-s3"
+ create: True
+ params:
+ IMAGE_NAME: "{{ glusterfs_s3_image }}"
+ IMAGE_VERSION: "{{ glusterfs_s3_version }}"
+ S3_ACCOUNT: "{{ glusterfs_s3_account }}"
+ S3_USER: "{{ glusterfs_s3_user }}"
+ S3_PASSWORD: "{{ glusterfs_s3_password }}"
+ PVC: "{{ glusterfs_s3_pvc }}"
+ META_PVC: "{{ glusterfs_s3_meta_pvc }}"
+ CLUSTER_NAME: "{{ glusterfs_name }}"
+
+- name: Wait for gluster-s3 pod
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: pod
+ state: list
+ selector: "glusterfs=s3-{{ glusterfs_name }}-{{ glusterfs_s3_account }}-pod"
+ register: gluster_s3_pod
+ until:
+ - "gluster_s3_pod.results.results[0]['items'] | count > 0"
+ # Pod's 'Ready' status must be True
+ - "gluster_s3_pod.results.results[0]['items'] | oo_collect(attribute='status.conditions') | oo_collect(attribute='status', filters={'type': 'Ready'}) | map('bool') | select | list | count == 1"
+ delay: 10
+ retries: "{{ (glusterfs_timeout | int / 10) | int }}"
diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml
index 4e5bf69de..2a678af57 100644
--- a/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml
+++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml
@@ -259,54 +259,59 @@
- glusterfs_heketi_is_native
- glusterfs_heketi_is_missing
-- name: Create heketi secret
- oc_secret:
- namespace: "{{ glusterfs_namespace }}"
- state: present
- name: "heketi-{{ glusterfs_name }}-admin-secret"
- type: "kubernetes.io/glusterfs"
- force: True
- contents:
- - path: key
- data: "{{ glusterfs_heketi_admin_key }}"
- when:
- - glusterfs_storageclass
- - glusterfs_heketi_admin_key is defined
-
-- name: Get heketi route
- oc_obj:
- namespace: "{{ glusterfs_namespace }}"
- kind: route
- state: list
- name: "heketi-{{ glusterfs_name }}"
- register: heketi_route
- when:
- - glusterfs_storageclass
- - glusterfs_heketi_is_native
-
-- name: Determine StorageClass heketi URL
+- name: Check if gluster-s3 can't be deployed
set_fact:
- glusterfs_heketi_route: "{{ heketi_route.results.results[0]['spec']['host'] }}"
+ glusterfs_s3_deploy: False
when:
- - glusterfs_storageclass
- - glusterfs_heketi_is_native
-
-- name: Generate GlusterFS StorageClass file
- template:
- src: "{{ openshift.common.examples_content_version }}/glusterfs-storageclass.yml.j2"
- dest: "{{ mktemp.stdout }}/glusterfs-storageclass.yml"
+ - "glusterfs_s3_account is not defined or glusterfs_s3_user is not defined or glusterfs_s3_password is not defined"
+
+- block:
+ - name: Create heketi secret
+ oc_secret:
+ namespace: "{{ glusterfs_namespace }}"
+ state: present
+ name: "heketi-{{ glusterfs_name }}-admin-secret"
+ type: "kubernetes.io/glusterfs"
+ force: True
+ contents:
+ - path: key
+ data: "{{ glusterfs_heketi_admin_key }}"
+ when:
+ - glusterfs_heketi_admin_key is defined
+
+ - name: Get heketi route
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: route
+ state: list
+ name: "heketi-{{ glusterfs_name }}"
+ register: heketi_route
+ when:
+ - glusterfs_heketi_is_native
+
+ - name: Determine StorageClass heketi URL
+ set_fact:
+ glusterfs_heketi_route: "{{ heketi_route.results.results[0]['spec']['host'] }}"
+ when:
+ - glusterfs_heketi_is_native
+
+ - name: Generate GlusterFS StorageClass file
+ template:
+ src: "{{ openshift.common.examples_content_version }}/glusterfs-storageclass.yml.j2"
+ dest: "{{ mktemp.stdout }}/glusterfs-storageclass.yml"
+
+ - name: Create GlusterFS StorageClass
+ oc_obj:
+ state: present
+ kind: storageclass
+ name: "glusterfs-{{ glusterfs_name }}"
+ files:
+ - "{{ mktemp.stdout }}/glusterfs-storageclass.yml"
when:
- - glusterfs_storageclass
-
-- name: Create GlusterFS StorageClass
- oc_obj:
- state: present
- kind: storageclass
- name: "glusterfs-{{ glusterfs_name }}"
- files:
- - "{{ mktemp.stdout }}/glusterfs-storageclass.yml"
- when:
- - glusterfs_storageclass
+ - glusterfs_storageclass or glusterfs_s3_deploy
- include: glusterblock_deploy.yml
when: glusterfs_block_deploy
+
+- include: gluster_s3_deploy.yml
+ when: glusterfs_s3_deploy
diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml
index a084c4858..e2d740f35 100644
--- a/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml
+++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml
@@ -13,6 +13,16 @@
glusterfs_block_image: "{{ openshift_storage_glusterfs_block_image }}"
glusterfs_block_version: "{{ openshift_storage_glusterfs_block_version }}"
glusterfs_block_max_host_vol: "{{ openshift_storage_glusterfs_block_max_host_vol }}"
+ glusterfs_s3_deploy: "{{ openshift_storage_glusterfs_s3_deploy | bool }}"
+ glusterfs_s3_image: "{{ openshift_storage_glusterfs_s3_image }}"
+ glusterfs_s3_version: "{{ openshift_storage_glusterfs_s3_version }}"
+ glusterfs_s3_account: "{{ openshift_storage_glusterfs_s3_account }}"
+ glusterfs_s3_user: "{{ openshift_storage_glusterfs_s3_user }}"
+ glusterfs_s3_password: "{{ openshift_storage_glusterfs_s3_password }}"
+ glusterfs_s3_pvc: "{{ openshift_storage_glusterfs_s3_pvc }}"
+ glusterfs_s3_pvc_size: "{{ openshift_storage_glusterfs_s3_pvc_size }}"
+ glusterfs_s3_meta_pvc: "{{ openshift_storage_glusterfs_s3_meta_pvc }}"
+ glusterfs_s3_meta_pvc_size: "{{ openshift_storage_glusterfs_s3_meta_pvc_size }}"
glusterfs_wipe: "{{ openshift_storage_glusterfs_wipe | bool }}"
glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_heketi_is_native | bool }}"
glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_heketi_is_missing | bool }}"
diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml
index 2ae4ea71c..baac52179 100644
--- a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml
+++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml
@@ -13,6 +13,16 @@
glusterfs_block_image: "{{ openshift_storage_glusterfs_registry_block_image }}"
glusterfs_block_version: "{{ openshift_storage_glusterfs_registry_block_version }}"
glusterfs_block_max_host_vol: "{{ openshift_storage_glusterfs_registry_block_max_host_vol }}"
+ glusterfs_s3_deploy: "{{ openshift_storage_glusterfs_registry_s3_deploy | bool }}"
+ glusterfs_s3_image: "{{ openshift_storage_glusterfs_registry_s3_image }}"
+ glusterfs_s3_version: "{{ openshift_storage_glusterfs_registry_s3_version }}"
+ glusterfs_s3_account: "{{ openshift_storage_glusterfs_registry_s3_account }}"
+ glusterfs_s3_user: "{{ openshift_storage_glusterfs_registry_s3_user }}"
+ glusterfs_s3_password: "{{ openshift_storage_glusterfs_registry_s3_password }}"
+ glusterfs_s3_pvc: "{{ openshift_storage_glusterfs_registry_s3_pvc }}"
+ glusterfs_s3_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_pvc_size }}"
+ glusterfs_s3_meta_pvc: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc }}"
+ glusterfs_s3_meta_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc_size }}"
glusterfs_wipe: "{{ openshift_storage_glusterfs_registry_wipe | bool }}"
glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_registry_heketi_is_native | bool }}"
glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_is_missing | bool }}"