Default OpenStack Cinder Storage Class (#2083)

Add possibility to create default OpenStack Cinder Storage Class

Closes: #1609
pull/2097/head
Stanislav Makar 2017-12-19 16:47:00 +02:00 committed by Matthew Mosesohn
parent bfb25fa47b
commit b2cb0725ac
7 changed files with 49 additions and 0 deletions

View File

@ -159,6 +159,9 @@ istio_enabled: false
# Local volume provisioner deployment # Local volume provisioner deployment
local_volumes_enabled: false local_volumes_enabled: false
# Add Persistent Volumes Storage Class for corresponding cloud provider ( OpenStack is only supported now )
persistent_volumes_enabled: false
# Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts # Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts
# kubeconfig_localhost: false # kubeconfig_localhost: false
# Download kubectl onto the host that runs Ansible in GITDIR/artifacts # Download kubectl onto the host that runs Ansible in GITDIR/artifacts

View File

@ -33,3 +33,8 @@ dependencies:
tags: tags:
- apps - apps
- istio - istio
- role: kubernetes-apps/persistent_volumes
when: persistent_volumes_enabled
tags:
- apps
- persistent_volumes

View File

@ -0,0 +1,8 @@
---
dependencies:
- role: kubernetes-apps/persistent_volumes/openstack
when:
- cloud_provider is defined
- cloud_provider in [ 'openstack' ]
tags:
- persistent_volumes_openstack

View File

@ -0,0 +1,2 @@
---
persistent_volumes_enabled: false

View File

@ -0,0 +1,21 @@
---
- name: Kubernetes Persistent Volumes | Lay down OpenStack Cinder Storage Class template
template:
src: "{{item.file}}"
dest: "{{kube_config_dir}}/{{item.file}}"
with_items:
- {file: openstack-storage-class.yml, type: StorageClass, name: storage-class }
register: manifests
when:
- inventory_hostname == groups['kube-master'][0]
- name: Kubernetes Persistent Volumes | Add OpenStack Cinder Storage Class
kube:
name: "{{item.item.name}}"
kubectl: "{{bin_dir}}/kubectl"
resource: "{{item.item.type}}"
filename: "{{kube_config_dir}}/{{item.item.file}}"
state: "latest"
with_items: "{{ manifests.results }}"
when:
- inventory_hostname == groups['kube-master'][0]

View File

@ -0,0 +1,9 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: standard
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/cinder
parameters:
availability: nova

View File

@ -144,6 +144,7 @@ helm_enabled: false
istio_enabled: false istio_enabled: false
enable_network_policy: false enable_network_policy: false
local_volumes_enabled: false local_volumes_enabled: false
persistent_volumes_enabled: false
# Base path for local volume provisioner addon # Base path for local volume provisioner addon
local_volume_base_dir: /mnt/disks local_volume_base_dir: /mnt/disks