From f6e153fd3d88f35beb56ecbfa11dc5220166016a Mon Sep 17 00:00:00 2001 From: "Huang, Sophie (sh879n)" Date: Mon, 1 Mar 2021 17:58:54 +0000 Subject: [PATCH] Update volume type creation bootstrap logic Verification is added to Cinder volume type creation logic under Values.bootstrap to make sure the volume_backend_name is configured in Values.conf.backends. Change-Id: I1b9b1eaac8df861d28d4121477de148dba6a2dbf --- cinder/Chart.yaml | 2 +- cinder/templates/bin/_bootstrap.sh.tpl | 14 +++++++++++--- cinder/values_overrides/backend_pure.yaml | 6 ++++++ releasenotes/notes/cinder.yaml | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/cinder/Chart.yaml b/cinder/Chart.yaml index 23274680fe..1ef776a1bd 100644 --- a/cinder/Chart.yaml +++ b/cinder/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Cinder name: cinder -version: 0.1.11 +version: 0.1.12 home: https://docs.openstack.org/cinder/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Cinder/OpenStack_Project_Cinder_vertical.png sources: diff --git a/cinder/templates/bin/_bootstrap.sh.tpl b/cinder/templates/bin/_bootstrap.sh.tpl index d0da471a04..456b4ae2d3 100644 --- a/cinder/templates/bin/_bootstrap.sh.tpl +++ b/cinder/templates/bin/_bootstrap.sh.tpl @@ -19,9 +19,14 @@ export HOME=/tmp {{- if .Values.bootstrap.enabled | default "echo 'Not Enabled'" }} - {{- /* Create volumes defined in Values.bootstrap */}} - {{- range $name, $properties := .Values.bootstrap.volume_types }} - {{- if $properties.volume_backend_name }} + {{- /* Create volume types defined in Values.bootstrap */}} + {{- /* Types can only be created for backends defined in Values.conf */}} + {{- $volumeTypes := .Values.bootstrap.volume_types }} + {{- range $backend_name, $backend_properties := .Values.conf.backends }} + {{- if $backend_properties }} + {{- range $name, $properties := $volumeTypes }} + {{- if $properties.volume_backend_name }} + {{- if (eq $properties.volume_backend_name $backend_properties.volume_backend_name) }} openstack volume type show {{ $name }} || \ openstack volume type create \ --public \ @@ -29,6 +34,9 @@ openstack volume type show {{ $name }} || \ --property {{ $key }}={{ $value }} \ {{- end }} {{ $name }} + {{- end }} + {{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/cinder/values_overrides/backend_pure.yaml b/cinder/values_overrides/backend_pure.yaml index fb90168153..9e0aaa2a67 100644 --- a/cinder/values_overrides/backend_pure.yaml +++ b/cinder/values_overrides/backend_pure.yaml @@ -16,6 +16,12 @@ pod: container: cinder_backup: privileged: true +bootstrap: + volume_types: + # volume type for PURE with multiattach on + PURE-MULTIATTACH: + multiattach: "\" True\"" + volume_backend_name: "PURE_BE" conf: cinder: DEFAULT: diff --git a/releasenotes/notes/cinder.yaml b/releasenotes/notes/cinder.yaml index 332e6d5688..4a628ab7c0 100644 --- a/releasenotes/notes/cinder.yaml +++ b/releasenotes/notes/cinder.yaml @@ -12,3 +12,4 @@ cinder: - 0.1.9 Use HostToContainer mount propagation - 0.1.10 Change Issuer to ClusterIssuer - 0.1.11 Update RBAC apiVersion from /v1beta1 to /v1 + - 0.1.12 Update volume type creation bootstrap logic