diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index bc02f56..d56e8a4 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -26,6 +26,13 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} +{{/* +Create service name as used by the service name label. +*/}} +{{- define "service.fullname" -}} +{{- printf "%s-%s" .Release.Name "service" }} +{{- end }} + {{/* Common labels */}} diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 0fb02f1..cc5dfc2 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -5,7 +5,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-{{ $chartName }}-configmap + name: {{ .Release.Name }}-configmap data: REQUEST_PAYLOAD_LIMIT: {{ .Values.env.requestPayloadLimit | quote }} RESPONSE_COMPRESSION_ENABLED: {{ .Values.env.responseCompressionEnabled | quote }} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 5916045..ac508e5 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -11,7 +11,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ $releaseName }}-{{ $chartName }} + name: {{ $releaseName }}-deployment labels: app: {{ $chartName }} component: {{ $chartName }} @@ -43,7 +43,7 @@ spec: - name: {{ $cloudProviderImagePullSecretName | quote }} {{- end }} containers: - - name: {{ $releaseName }}-{{ $chartName }}-deployment + - name: {{ $releaseName }} {{- with .Values.image }} image: {{ $cloudProviderDockerRegistryUrl }}{{ .repository }}:{{ $imageTag }} {{- end }} @@ -54,7 +54,7 @@ spec: value: {{ $gpkgPath }} envFrom: - configMapRef: - name: {{ $releaseName }}-{{ $chartName }}-configmap + name: {{ $releaseName }}-configmap ports: - name: http containerPort: {{ .Values.env.targetPort }} diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml index dc4890e..5612859 100644 --- a/helm/templates/ingress.yaml +++ b/helm/templates/ingress.yaml @@ -1,15 +1,16 @@ {{- $releaseName := .Release.Name -}} {{- $chartName := include "exporter-trigger.name" . -}} +{{- $serviceName := include "service.fullname" . -}} {{- if and (.Values.enabled) (.Values.ingress.enabled) -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ $releaseName }}-{{ $chartName }}-ingress + name: {{ $releaseName }}-ingress annotations: kubernetes.io/ingress.class: "nginx" {{- if eq .Values.ingress.type "nginx-org" }} nginx.org/mergeable-ingress-type: "minion" - nginx.org/rewrites: 'serviceName={{ $releaseName }}-{{ $chartName }} rewrite=/' + nginx.org/rewrites: 'serviceName={{ $serviceName }} rewrite=/' {{- end }} {{- if eq .Values.ingress.type "nginx-kubernetes" }} nginx.ingress.kubernetes.io/rewrite-target: /$1 @@ -32,7 +33,7 @@ spec: pathType: Prefix backend: service: - name: {{ $releaseName }}-{{ $chartName }} + name: {{ $serviceName }}- port: number: {{ .Values.env.port }} host: {{ .Values.ingress.host | quote }} diff --git a/helm/templates/route.yaml b/helm/templates/route.yaml index 9a1ac89..70281d4 100644 --- a/helm/templates/route.yaml +++ b/helm/templates/route.yaml @@ -1,12 +1,12 @@ {{- $releaseName := .Release.Name -}} {{- $chartName := include "exporter-trigger.name" . -}} {{- $cloudProviderFlavor := include "exporter-trigger.cloudProviderFlavor" . -}} - +{{- $serviceName := include "service.fullname" . -}} {{- if and (and (.Values.enabled) (eq $cloudProviderFlavor "openshift")) (.Values.route.enabled) -}} apiVersion: route.openshift.io/v1 kind: Route metadata: - name: {{ $releaseName }}-{{ $chartName }}-route + name: {{ $releaseName }}-route annotations: haproxy.router.openshift.io/rewrite-target: / {{- if .Values.route.timeout.enabled }} @@ -19,7 +19,7 @@ spec: path: {{ .Values.route.path | default "/" }} to: kind: Service - name: {{ $releaseName }}-{{ $chartName }} + name: {{ $serviceName }} {{- if .Values.route.https }} tls: termination: edge diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml index 59d5e9f..8a70c5f 100644 --- a/helm/templates/service.yaml +++ b/helm/templates/service.yaml @@ -1,12 +1,12 @@ {{- $releaseName := .Release.Name -}} {{- $chartName := include "exporter-trigger.name" . -}} {{- $cloudProviderFlavor := include "exporter-trigger.cloudProviderFlavor" . -}} - +{{- $serviceName := include "service.fullname" . -}} {{- if .Values.enabled -}} apiVersion: v1 kind: Service metadata: - name: {{ $releaseName }}-{{ $chartName }} + name: {{ $serviceName }} labels: app: {{ $chartName }} component: {{ $chartName }}