diff --git a/k8s/helm/templates/_helpers.tpl b/k8s/helm/templates/_helpers.tpl index 1066202..d03ae41 100644 --- a/k8s/helm/templates/_helpers.tpl +++ b/k8s/helm/templates/_helpers.tpl @@ -1,11 +1,14 @@ {{- define "k8s-ces-setup.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} {{- end }} {{- define "k8s-ces-setup-finisher.name" -}} -{{- "k8s-ces-setup-finisher"}} +{{ include "k8s-ces-setup.name" . }}{{- "k8s-ces-setup-finisher"}} {{- end }} +{{- define "k8s-ces-loadbalancer.name" -}} +{{ include "k8s-ces-setup.name" . }}-ces-loadbalancer +{{- end }} {{/* All-in-one labels */}} diff --git a/k8s/helm/templates/cleanup.yaml b/k8s/helm/templates/cleanup.yaml index 6e5d646..06a9004 100644 --- a/k8s/helm/templates/cleanup.yaml +++ b/k8s/helm/templates/cleanup.yaml @@ -5,6 +5,7 @@ metadata: labels: {{- include "k8s-ces-setup.labels" .| nindent 4 }} data: + # TODO: we need to change this too, if we change names of resources or labels entrypoint.sh: "#!/bin/bash\nSTATE=$(kubectl get configmap k8s-setup-config -o jsonpath='{.data.state}');\nif [[ ${STATE} == \"installed\" ]]; then \n kubectl delete configmap k8s-ces-setup-json || true\n kubectl delete configmap k8s-setup-config || true\n kubectl delete deployments,services,configmaps,secrets,roles,rolebindings,clusterroles,clusterrolebindings,serviceaccounts -l app.kubernetes.io/name=k8s-ces-setup || true\n kubectl patch cronjob cleanup -p '{\"spec\" : {\"suspend\" : true }}'\n kubectl delete configmap k8s-ces-setup-cleanup-script\n kubectl delete cronjob k8s-ces-setup-finisher\n kubectl delete serviceaccount k8s-ces-setup-finisher\n kubectl delete rolebinding k8s-ces-setup-finisher\nelse \n echo \"setup seems not to be installed or successfully executed\";\nfi" --- apiVersion: rbac.authorization.k8s.io/v1 diff --git a/k8s/helm/templates/deployment.yaml b/k8s/helm/templates/deployment.yaml index ce9027f..f7f976b 100644 --- a/k8s/helm/templates/deployment.yaml +++ b/k8s/helm/templates/deployment.yaml @@ -7,7 +7,7 @@ metadata: spec: selector: matchLabels: - app.kubernetes.io/name: k8s-ces-setup + app.kubernetes.io/name: {{ include "k8s-ces-setup.name" . }} template: metadata: labels: @@ -73,10 +73,10 @@ spec: readOnly: true volumes: - configMap: - name: {{ include "k8s-ces-setup.name" . }}-config + name: k8s-ces-setup-config name: k8s-ces-setup-config - configMap: - name: {{ include "k8s-ces-setup.name" . }}-json + name: k8s-ces-setup-json optional: true name: k8s-ces-setup-json - name: dogu-registry-cert diff --git a/k8s/helm/templates/setup-config.yaml b/k8s/helm/templates/setup-config.yaml index 40822d6..05edfcb 100644 --- a/k8s/helm/templates/setup-config.yaml +++ b/k8s/helm/templates/setup-config.yaml @@ -1,13 +1,14 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "k8s-ces-setup.name" . }}-config + name: k8s-ces-setup-config labels: {{- include "k8s-ces-setup.labels" .| nindent 4 }} data: k8s-ces-setup.yaml: | component_operator_chart: "{{ .Values.component_operator_chart }}" component_operator_crd_chart: "{{ .Values.component_operator_crd_chart }}" + loadbalancer_name: "{{ include "k8s-ces-loadbalancer.name" . }}" {{- if .Values.components }} components: {{- toYaml .Values.components | nindent 6}} diff --git a/k8s/helm/templates/setup-json.yaml b/k8s/helm/templates/setup-json.yaml index b33a145..698d603 100644 --- a/k8s/helm/templates/setup-json.yaml +++ b/k8s/helm/templates/setup-json.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "k8s-ces-setup.name" . }}-json + name: k8s-ces-setup-json labels: {{- include "k8s-ces-setup.labels" .| nindent 4 }} data: