Browse Source

Default OpenStack Cinder Storage Class (#2083)

Add possibility to create default OpenStack Cinder Storage Class

Closes: #1609
pull/2097/head
Stanislav Makar 7 years ago
committed by Matthew Mosesohn
parent
commit
b2cb0725ac
7 changed files with 49 additions and 0 deletions
  1. 3
      inventory/group_vars/k8s-cluster.yml
  2. 5
      roles/kubernetes-apps/meta/main.yml
  3. 8
      roles/kubernetes-apps/persistent_volumes/meta/main.yml
  4. 2
      roles/kubernetes-apps/persistent_volumes/openstack/defaults/main.yml
  5. 21
      roles/kubernetes-apps/persistent_volumes/openstack/tasks/main.yml
  6. 9
      roles/kubernetes-apps/persistent_volumes/openstack/templates/openstack-storage-class.yml
  7. 1
      roles/kubespray-defaults/defaults/main.yaml

3
inventory/group_vars/k8s-cluster.yml

@ -159,6 +159,9 @@ istio_enabled: false
# Local volume provisioner deployment
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
# kubeconfig_localhost: false
# Download kubectl onto the host that runs Ansible in GITDIR/artifacts

5
roles/kubernetes-apps/meta/main.yml

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

8
roles/kubernetes-apps/persistent_volumes/meta/main.yml

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

2
roles/kubernetes-apps/persistent_volumes/openstack/defaults/main.yml

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

21
roles/kubernetes-apps/persistent_volumes/openstack/tasks/main.yml

@ -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]

9
roles/kubernetes-apps/persistent_volumes/openstack/templates/openstack-storage-class.yml

@ -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

1
roles/kubespray-defaults/defaults/main.yaml

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

Loading…
Cancel
Save