From 9e625d4949b1c00644317a04d5ca6dc03eee926c Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Mon, 22 May 2017 11:15:01 -0400 Subject: Install default storageclass in AWS & GCE envs --- .../common/openshift-cluster/openshift_hosted.yml | 2 ++ roles/openshift_default_storage_class/README.md | 39 ++++++++++++++++++++++ .../defaults/main.yml | 14 ++++++++ .../openshift_default_storage_class/meta/main.yml | 13 ++++++++ .../openshift_default_storage_class/tasks/main.yml | 17 ++++++++++ .../openshift_default_storage_class/vars/main.yml | 1 + 6 files changed, 86 insertions(+) create mode 100644 roles/openshift_default_storage_class/README.md create mode 100644 roles/openshift_default_storage_class/defaults/main.yml create mode 100644 roles/openshift_default_storage_class/meta/main.yml create mode 100644 roles/openshift_default_storage_class/tasks/main.yml create mode 100644 roles/openshift_default_storage_class/vars/main.yml diff --git a/playbooks/common/openshift-cluster/openshift_hosted.yml b/playbooks/common/openshift-cluster/openshift_hosted.yml index 5db71b857..8d94b6509 100644 --- a/playbooks/common/openshift-cluster/openshift_hosted.yml +++ b/playbooks/common/openshift-cluster/openshift_hosted.yml @@ -45,6 +45,8 @@ - role: cockpit-ui when: ( openshift.common.version_gte_3_3_or_1_3 | bool ) and ( openshift_hosted_manage_registry | default(true) | bool ) and not (openshift.docker.hosted_registry_insecure | default(false) | bool) + - role: openshift_default_storage_class + when: openshift_cloudprovider_kind is defined and (openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce') - name: Update master-config for publicLoggingURL hosts: oo_masters_to_config:!oo_first_master diff --git a/roles/openshift_default_storage_class/README.md b/roles/openshift_default_storage_class/README.md new file mode 100644 index 000000000..198163127 --- /dev/null +++ b/roles/openshift_default_storage_class/README.md @@ -0,0 +1,39 @@ +openshift_master_storage_class +========= + +A role that deploys configuratons for Openshift StorageClass + +Requirements +------------ + +None + +Role Variables +-------------- + +openshift_storageclass_name: Name of the storage class to create +openshift_storageclass_provisioner: The kubernetes provisioner to use +openshift_storageclass_type: type of storage to use. This is different among clouds/providers + +Dependencies +------------ + + +Example Playbook +---------------- + +- role: openshift_default_storage_class + openshift_storageclass_name: awsEBS + openshift_storageclass_provisioner: kubernetes.io/aws-ebs + openshift_storageclass_type: gp2 + + +License +------- + +Apache + +Author Information +------------------ + +Openshift Operations diff --git a/roles/openshift_default_storage_class/defaults/main.yml b/roles/openshift_default_storage_class/defaults/main.yml new file mode 100644 index 000000000..c8ac8a8c3 --- /dev/null +++ b/roles/openshift_default_storage_class/defaults/main.yml @@ -0,0 +1,14 @@ +--- +openshift_storageclass_defaults: + aws: + name: ebs + provisioner: kubernetes.io/aws-ebs + type: gp2 + gcp: + name: gcppd + provisioner: kubernetes.io/gce-pd + type: pd-standard + +openshift_storageclass_name: "{{ openshift_storageclass_defaults[openshift_cloudprovider_kind]['name'] }}" +openshift_storageclass_provisioner: "{{ openshift_storageclass_defaults[openshift_cloudprovider_kind]['provisioner'] }}" +openshift_storageclass_type: "{{ openshift_storageclass_defaults[openshift_cloudprovider_kind]['type'] }}" diff --git a/roles/openshift_default_storage_class/meta/main.yml b/roles/openshift_default_storage_class/meta/main.yml new file mode 100644 index 000000000..6a394613c --- /dev/null +++ b/roles/openshift_default_storage_class/meta/main.yml @@ -0,0 +1,13 @@ +--- +galaxy_info: + author: Openshift Operations + description: This role configures the StorageClass in Openshift + company: Red Hat + license: Apache + min_ansible_version: 2.2 + platforms: + - name: EL + verisons: + - 7 + categories: + - cloud diff --git a/roles/openshift_default_storage_class/tasks/main.yml b/roles/openshift_default_storage_class/tasks/main.yml new file mode 100644 index 000000000..e1408b5c6 --- /dev/null +++ b/roles/openshift_default_storage_class/tasks/main.yml @@ -0,0 +1,17 @@ +- name: Ensure storageclass object + oc_obj: + kind: storageclass + name: "{{ openshift_storageclass_name }}" + content: + path: /tmp/openshift_storageclass + data: + kind: StorageClass + apiVersion: storage.k8s.io/v1beta1 + metadata: + name: "{{ openshift_storageclass_name }}" + annotations: + storageclass.beta.kubernetes.io/is-default-class: "true" + provisioner: "{{ openshift_storageclass_provisioner }}" + parameters: + type: "{{ openshift_storageclass_type }}" + run_once: true diff --git a/roles/openshift_default_storage_class/vars/main.yml b/roles/openshift_default_storage_class/vars/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/roles/openshift_default_storage_class/vars/main.yml @@ -0,0 +1 @@ +--- -- cgit v1.2.3 From 53f71b2dc05afb0545c1266c792370e2243366a9 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Tue, 23 May 2017 11:57:35 -0400 Subject: Add documentation --- roles/openshift_default_storage_class/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/openshift_default_storage_class/tasks/main.yml b/roles/openshift_default_storage_class/tasks/main.yml index e1408b5c6..408fc17c7 100644 --- a/roles/openshift_default_storage_class/tasks/main.yml +++ b/roles/openshift_default_storage_class/tasks/main.yml @@ -1,3 +1,5 @@ +--- +# Install default storage classes in GCE & AWS - name: Ensure storageclass object oc_obj: kind: storageclass -- cgit v1.2.3 From 40f87058856cb2e1f7c54fd1e6fd5978f6f3caff Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Thu, 25 May 2017 10:10:06 -0400 Subject: Add dependency and use same storageclass name as upstream --- roles/openshift_default_storage_class/defaults/main.yml | 4 ++-- roles/openshift_default_storage_class/meta/main.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/openshift_default_storage_class/defaults/main.yml b/roles/openshift_default_storage_class/defaults/main.yml index c8ac8a8c3..ee095833b 100644 --- a/roles/openshift_default_storage_class/defaults/main.yml +++ b/roles/openshift_default_storage_class/defaults/main.yml @@ -1,11 +1,11 @@ --- openshift_storageclass_defaults: aws: - name: ebs + name: gp2 provisioner: kubernetes.io/aws-ebs type: gp2 gcp: - name: gcppd + name: standard provisioner: kubernetes.io/gce-pd type: pd-standard diff --git a/roles/openshift_default_storage_class/meta/main.yml b/roles/openshift_default_storage_class/meta/main.yml index 6a394613c..d7d57fe39 100644 --- a/roles/openshift_default_storage_class/meta/main.yml +++ b/roles/openshift_default_storage_class/meta/main.yml @@ -11,3 +11,5 @@ galaxy_info: - 7 categories: - cloud +dependencies: +- role: lib_openshift -- cgit v1.2.3