Ver Fonte

Install default storageclass in AWS & GCE envs

Hemant Kumar há 7 anos atrás
pai
commit
9e625d4949

+ 2 - 0
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

+ 39 - 0
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

+ 14 - 0
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'] }}"

+ 13 - 0
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

+ 17 - 0
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

+ 1 - 0
roles/openshift_default_storage_class/vars/main.yml

@@ -0,0 +1 @@
+---