openstack-helm/cinder/templates/job-ks-service.yaml
Phil Sphicas 3e63be0682 Allow cinder v1/v2 endpoint creation if needed
An earlier change [0] removed the older cinder v1 and v2 endpoint
definitions from values.yaml. If older APIs are required, they can be
enabled using overrides, but the ks-service job only creates a volumev3
endpoint.

This change updates the ks-service job to create all endpoints defined
in .Values.endpoints that have "volume" in their name. Note that several
settings are hardcoded to use volumev3, so this change would mostly
useful in enabling v2 in addition to v3.

0: https://review.opendev.org/c/openstack/openstack-helm/+/817310

Change-Id: I26594668ff26ed3f28e207f341b28a139b514e1c
2022-05-04 10:03:20 -07:00

39 lines
1.4 KiB
YAML

{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- define "metadata.annotations.job.ks_service" }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-3"
{{- end }}
{{- if .Values.manifests.job_ks_service }}
{{- $serviceTypes := list }}
{{- range $_, $v := keys .Values.endpoints | sortAlpha }}
{{- if $v | hasPrefix "volume" }}
{{- $serviceTypes = append $serviceTypes $v }}
{{- end }}
{{- end }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "cinder" "serviceTypes" $serviceTypes -}}
{{- if .Values.manifests.certificates -}}
{{- $_ := set $ksServiceJob "tlsSecret" .Values.secrets.tls.volumev3.api.internal -}}
{{- end -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml) }}
{{- end }}
{{- if .Values.pod.tolerations.cinder.enabled -}}
{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}}
{{- end -}}
{{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }}
{{- end }}