Updated chart naming for subchart compatibility

CHG: Updated naming variable to change based on global values
     subchart_release_name for the following:
       * mariadb
       * rabbitmq
       * memcached

     This is a required change for the chart to be included
     as a subchart. if subchart_release_name is not present the
     yaml will render the same as prior to this change, leaving
     existing deployments unaffected.

Change-Id: Ib7a449f3b21d5169b8003cf4464f3ed95e942c14
This commit is contained in:
Graham Steffaniak 2022-03-29 14:55:10 -05:00
parent 3bd8d916cb
commit 7b93d86fa6
21 changed files with 130 additions and 38 deletions

View File

@ -15,7 +15,7 @@ apiVersion: v1
appVersion: v10.2.31
description: OpenStack-Helm MariaDB
name: mariadb
version: 0.2.17
version: 0.2.18
home: https://mariadb.com/kb/en/
icon: http://badges.mariadb.org/mariadb-badge-180x60.png
sources:

View File

@ -12,12 +12,18 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.deployment_ingress }}
{{- $envAll := . }}
{{- $ingressClass := printf "%s-%s" .Release.Name "mariadb-ingress" }}
{{- $ingressClass := printf "%s-%s" .deployment_name "mariadb-ingress" }}
{{- $serviceAccountName := printf "%s-%s" .Release.Name "ingress" }}
{{- $serviceAccountName := printf "%s-%s" .deployment_name "ingress" }}
{{ tuple $envAll "ingress" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: rbac.authorization.k8s.io/v1
@ -156,7 +162,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- {{ printf "%s-%s" .Release.Name $ingressClass | quote }}
- {{ printf "%s-%s" .deployment_name $ingressClass | quote }}
resources:
- configmaps
verbs:
@ -267,7 +273,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: RELEASE_NAME
value: {{ .Release.Name | quote }}
value: {{ .deployment_name | quote }}
- name: INGRESS_CLASS
value: {{ $ingressClass | quote }}
- name: ERROR_PAGE_SERVICE

View File

@ -12,17 +12,23 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.pod_test }}
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.static.tests }}
{{- $serviceAccountName := print .Release.Name "-test" }}
{{- $serviceAccountName := print .deployment_name "-test" }}
{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{.Release.Name}}-test"
name: "{{.deployment_name}}-test"
labels:
{{ tuple $envAll "mariadb" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
annotations:

View File

@ -18,11 +18,16 @@ exec:
- /tmp/readiness.sh
{{- end }}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.statefulset }}
{{- $envAll := . }}
{{- $serviceAccountName := printf "%s-%s" .Release.Name "mariadb" }}
{{- $serviceAccountName := printf "%s-%s" .deployment_name "mariadb" }}
{{ tuple $envAll "mariadb" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: rbac.authorization.k8s.io/v1
@ -40,7 +45,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- {{ printf "%s-%s" .Release.Name "mariadb-state" | quote }}
- {{ printf "%s-%s" .deployment_name "mariadb-state" | quote }}
resources:
- configmaps
verbs:
@ -154,7 +159,7 @@ spec:
- name: WSREP_PORT
value: {{ tuple "oslo_db" "direct" "wsrep" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
- name: STATE_CONFIGMAP
value: {{ printf "%s-%s" .Release.Name "mariadb-state" | quote }}
value: {{ printf "%s-%s" .deployment_name "mariadb-state" | quote }}
- name: MYSQL_DBADMIN_USERNAME
value: {{ .Values.endpoints.oslo_db.auth.admin.username }}
- name: MYSQL_DBADMIN_PASSWORD

View File

@ -15,6 +15,6 @@ apiVersion: v1
appVersion: v1.5.5
description: OpenStack-Helm Memcached
name: memcached
version: 0.1.9
version: 0.1.10
home: https://github.com/memcached/memcached
...

View File

@ -12,9 +12,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.configmap_bin }}
{{- $envAll := . }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "memcached-bin" }}
{{- $configMapBinName := printf "%s-%s" $envAll.deployment_name "memcached-bin" }}
---
apiVersion: v1
kind: ConfigMap

View File

@ -12,11 +12,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.deployment }}
{{- $envAll := . }}
{{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "memcached" }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "memcached-bin" }}
{{- $rcControllerName := printf "%s-%s" $envAll.deployment_name "memcached" }}
{{- $configMapBinName := printf "%s-%s" $envAll.deployment_name "memcached-bin" }}
{{ tuple $envAll "memcached" $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---

View File

@ -15,6 +15,6 @@ apiVersion: v1
appVersion: v3.9.0
description: OpenStack-Helm RabbitMQ
name: rabbitmq
version: 0.1.20
version: 0.1.21
home: https://github.com/rabbitmq/rabbitmq-server
...

View File

@ -12,13 +12,19 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.configmap_bin }}
{{- $envAll := . }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" .Release.Name "rabbitmq-bin" | quote }}
name: {{ printf "%s-%s" .deployment_name "rabbitmq-bin" | quote }}
data:
{{- if .Values.images.local_registry.active }}
image-repo-sync.sh: |

View File

@ -12,6 +12,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{/*
(aostapenko) rounds cpu limit in any permissible format to integer value (min 1)
"100m" -> 1
@ -49,7 +55,7 @@ limitations under the License.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-etc" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "rabbitmq-etc" | quote }}
data:
enabled_plugins: |
{{ tuple "etc/_enabled_plugins.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}

View File

@ -12,10 +12,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if and .Values.manifests.ingress_management .Values.network.management.ingress.public }}
{{- $envAll := . }}
{{- if empty $envAll.Values.endpoints.oslo_messaging.hosts.public }}
{{- $service_public_name := .Release.Name | trunc 12 }}
{{- $service_public_name := .deployment_name | trunc 12 }}
{{- $_ := set $envAll.Values.endpoints.oslo_messaging.hosts "public" ( printf "%s-%s-%s" $service_public_name "mgr" ( $service_public_name | sha256sum | trunc 6 )) }}
{{- end }}
{{- $ingressOpts := dict "envAll" . "backendService" "management" "backendServiceType" "oslo_messaging" "backendPort" "http" -}}

View File

@ -12,10 +12,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.job_cluster_wait }}
{{- $envAll := . }}
{{- $serviceAccountName := print .Release.Name "-cluster-wait" }}
{{- $serviceAccountName := print .deployment_name "-cluster-wait" }}
{{ tuple $envAll "cluster_wait" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- $protocol := "http" }}
@ -26,7 +32,7 @@ limitations under the License.
apiVersion: batch/v1
kind: Job
metadata:
name: "{{.Release.Name}}-cluster-wait"
name: "{{.deployment_name}}-cluster-wait"
labels:
{{ tuple $envAll "rabbitmq" "cluster-wait" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
annotations:
@ -103,11 +109,11 @@ spec:
emptyDir: {}
- name: rabbitmq-bin
configMap:
name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-bin" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "rabbitmq-bin" | quote }}
defaultMode: 0555
- name: rabbitmq-erlang-cookie
secret:
secretName: {{ printf "%s-%s" $envAll.Release.Name "erlang-cookie" | quote }}
secretName: {{ printf "%s-%s" $envAll.deployment_name "erlang-cookie" | quote }}
defaultMode: 0444
{{ dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.secrets.tls.oslo_messaging.server.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
{{- end }}

View File

@ -12,6 +12,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- define "exporterProbeTemplate" }}
httpGet:
scheme: HTTP
@ -22,7 +28,7 @@ httpGet:
{{- if and .Values.manifests.monitoring.prometheus.deployment_exporter .Values.monitoring.prometheus.enabled }}
{{- $envAll := . }}
{{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "rabbitmq-exporter" }}
{{- $rcControllerName := printf "%s-%s" $envAll.deployment_name "rabbitmq-exporter" }}
{{ tuple $envAll "prometheus_rabbitmq_exporter" $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- $protocol := "http" }}
@ -77,12 +83,12 @@ spec:
- name: RABBIT_USER
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" $envAll.Release.Name "admin-user" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "admin-user" | quote }}
key: RABBITMQ_ADMIN_USERNAME
- name: RABBIT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" $envAll.Release.Name "admin-user" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "admin-user" | quote }}
key: RABBITMQ_ADMIN_PASSWORD
- name: RABBIT_CAPABILITIES
value: {{ include "helm-toolkit.utils.joinListWithComma" $envAll.Values.conf.prometheus_exporter.capabilities | quote }}

View File

@ -12,16 +12,22 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.pod_test }}
{{- $envAll := . }}
{{ if kindIs "string" $envAll.Values.dependencies.static.tests.jobs }}
{{ if eq $envAll.Values.dependencies.static.tests.jobs "cluster_wait" }}
{{ $_ := set $envAll.Values.dependencies.static.tests "jobs" ( list ( print $envAll.Release.Name "-cluster-wait" ) ) }}
{{ $_ := set $envAll.Values.dependencies.static.tests "jobs" ( list ( print $envAll.deployment_name "-cluster-wait" ) ) }}
{{ end }}
{{ end }}
{{- $serviceAccountName := print .Release.Name "-test" }}
{{- $serviceAccountName := print .deployment_name "-test" }}
{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- $protocol := "http" }}
@ -32,7 +38,7 @@ limitations under the License.
apiVersion: v1
kind: Pod
metadata:
name: "{{.Release.Name}}-test"
name: "{{.deployment_name}}-test"
labels:
{{ tuple $envAll "rabbitmq" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
annotations:
@ -74,7 +80,7 @@ spec:
emptyDir: {}
- name: rabbitmq-bin
configMap:
name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-bin" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "rabbitmq-bin" | quote }}
defaultMode: 0555
{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.oslo_messaging.server.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
{{- end }}

View File

@ -12,13 +12,19 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.secret_erlang_cookie }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" $envAll.Release.Name "erlang-cookie" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "erlang-cookie" | quote }}
type: Opaque
data:
erlang_cookie: {{ $envAll.Values.endpoints.oslo_messaging.auth.erlang_cookie | b64enc -}}

View File

@ -12,13 +12,19 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if .Values.manifests.secret_admin_user }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" $envAll.Release.Name "admin-user" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "admin-user" | quote }}
type: Opaque
data:
RABBITMQ_ADMIN_USERNAME: {{ $envAll.Values.endpoints.oslo_messaging.auth.user.username | b64enc }}

View File

@ -12,10 +12,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{- if and .Values.manifests.service_ingress_management .Values.network.management.ingress.public }}
{{- $envAll := . }}
{{- if empty $envAll.Values.endpoints.oslo_messaging.hosts.public }}
{{- $service_public_name := .Release.Name | trunc 12 }}
{{- $service_public_name := .deployment_name | trunc 12 }}
{{- $_ := set $envAll.Values.endpoints.oslo_messaging.hosts "public" ( printf "%s-%s-%s" $service_public_name "mgr" ( $service_public_name | sha256sum | trunc 6 )) }}
{{- end }}
{{- $serviceIngressOpts := dict "envAll" . "backendService" "management" "backendServiceType" "oslo_messaging" "backendPort" "http" -}}

View File

@ -12,6 +12,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if (.Values.global).subchart_release_name }}
{{- $_ := set . "deployment_name" .Chart.Name }}
{{- else }}
{{- $_ := set . "deployment_name" .Release.Name }}
{{- end }}
{{/*
(aostapenko) rounds cpu limit in any permissible format to integer value (min 1)
"100m" -> 1
@ -32,7 +38,7 @@ limitations under the License.
{{- if .Values.manifests.statefulset }}
{{- $envAll := . }}
{{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "rabbitmq" }}
{{- $rcControllerName := printf "%s-%s" $envAll.deployment_name "rabbitmq" }}
{{ tuple $envAll "rabbitmq" $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- $protocol := "http" }}
@ -120,12 +126,12 @@ spec:
- name: RABBITMQ_ADMIN_USERNAME
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" $envAll.Release.Name "admin-user" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "admin-user" | quote }}
key: RABBITMQ_ADMIN_USERNAME
- name: RABBITMQ_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" $envAll.Release.Name "admin-user" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "admin-user" | quote }}
key: RABBITMQ_ADMIN_PASSWORD
- name: RABBITMQ_DEFINITION_FILE
value: "{{ index $envAll.Values.conf.rabbitmq "management.load_definitions" }}"
@ -278,15 +284,15 @@ spec:
emptyDir: {}
- name: rabbitmq-bin
configMap:
name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-bin" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "rabbitmq-bin" | quote }}
defaultMode: 0555
- name: rabbitmq-etc
configMap:
name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-etc" | quote }}
name: {{ printf "%s-%s" $envAll.deployment_name "rabbitmq-etc" | quote }}
defaultMode: 0444
- name: rabbitmq-erlang-cookie
secret:
secretName: {{ printf "%s-%s" $envAll.Release.Name "erlang-cookie" | quote }}
secretName: {{ printf "%s-%s" $envAll.deployment_name "erlang-cookie" | quote }}
defaultMode: 0444
{{ dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.secrets.tls.oslo_messaging.server.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
{{- if not $envAll.Values.volume.enabled }}

View File

@ -33,4 +33,5 @@ mariadb:
- 0.2.15 Updated naming for subchart compatibility
- 0.2.16 Revert naming for subchart compatibility
- 0.2.17 Enable taint toleration for Openstack services jobs
- 0.2.18 Updated naming for subchart compatibility
...

View File

@ -10,4 +10,5 @@ memcached:
- 0.1.7 Updated naming for subchart compatibility
- 0.1.8 Enable taint toleration for Openstack services jobs
- 0.1.9 Revert naming for subchart compatibility
- 0.1.10 Updated naming for subchart compatibility
...

View File

@ -20,4 +20,5 @@ rabbitmq:
- 0.1.18 Revert naming for subchart compatibility
- 0.1.19 Enable taint toleration for Openstack services jobs
- 0.1.20 Bump Rabbitmq version to 3.9.0
- 0.1.21 Updated naming for subchart compatibility
...