Merge pull request #2338 from southquist/template-openstack-storage-class

allow for configurable openstack storage class
pull/2549/merge
Rong Zhang 2018-06-24 18:42:29 +08:00 committed by GitHub
commit e06d02365e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 18 deletions

View File

@ -1,2 +1,7 @@
--- ---
persistent_volumes_enabled: false persistent_volumes_enabled: false
storage_classes:
- name: standard
is_default: true
parameters:
availability: nova

View File

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

View File

@ -1,10 +0,0 @@
---
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

@ -0,0 +1,14 @@
{% for class in storage_classes %}
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: "{{ class.name }}"
annotations:
storageclass.kubernetes.io/is-default-class: "{{ class.is_default | default(false) | ternary("true","false") }}"
provisioner: kubernetes.io/cinder
parameters:
{% for key, value in (class.parameters | default({})).items() %}
"{{ key }}": "{{ value }}"
{% endfor %}
{% endfor %}