Clean Code
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
storage_classes:
|
||||
- name: cinder-csi
|
||||
is_default: false
|
||||
parameters:
|
||||
availability: nova
|
||||
allowVolumeExpansion: false
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Kubernetes Persistent Volumes | Copy Cinder CSI Storage Class template
|
||||
template:
|
||||
src: "cinder-csi-storage-class.yml.j2"
|
||||
dest: "{{ kube_config_dir }}/cinder-csi-storage-class.yml"
|
||||
mode: 0644
|
||||
register: manifests
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
|
||||
- name: Kubernetes Persistent Volumes | Add Cinder CSI Storage Class
|
||||
kube:
|
||||
name: cinder-csi
|
||||
kubectl: "{{ bin_dir }}/kubectl"
|
||||
resource: StorageClass
|
||||
filename: "{{ kube_config_dir }}/cinder-csi-storage-class.yml"
|
||||
state: "latest"
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
- manifests.changed
|
||||
@@ -0,0 +1,25 @@
|
||||
{% 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: cinder.csi.openstack.org
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
parameters:
|
||||
{% for key, value in (class.parameters | default({})).items() %}
|
||||
"{{ key }}": "{{ value }}"
|
||||
{% endfor %}
|
||||
{% if cinder_topology is defined and cinder_topology is sameas true %}
|
||||
allowedTopologies:
|
||||
- matchLabelExpressions:
|
||||
- key: topology.cinder.csi.openstack.org/zone
|
||||
values:
|
||||
{% for zone in cinder_topology_zones %}
|
||||
- "{{ zone }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
allowVolumeExpansion: {{ expand_persistent_volumes }}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user