Skip to content

Commit

Permalink
fix: removed chart name from template names (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitzanmorr authored Sep 10, 2023
1 parent c0fe33f commit 1815cae
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
7 changes: 7 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/}}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $releaseName }}-{{ $chartName }}
name: {{ $releaseName }}-deployment
labels:
app: {{ $chartName }}
component: {{ $chartName }}
Expand Down Expand Up @@ -43,7 +43,7 @@ spec:
- name: {{ $cloudProviderImagePullSecretName | quote }}
{{- end }}
containers:
- name: {{ $releaseName }}-{{ $chartName }}-deployment
- name: {{ $releaseName }}
{{- with .Values.image }}
image: {{ $cloudProviderDockerRegistryUrl }}{{ .repository }}:{{ $imageTag }}
{{- end }}
Expand All @@ -54,7 +54,7 @@ spec:
value: {{ $gpkgPath }}
envFrom:
- configMapRef:
name: {{ $releaseName }}-{{ $chartName }}-configmap
name: {{ $releaseName }}-configmap
ports:
- name: http
containerPort: {{ .Values.env.targetPort }}
Expand Down
7 changes: 4 additions & 3 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -32,7 +33,7 @@ spec:
pathType: Prefix
backend:
service:
name: {{ $releaseName }}-{{ $chartName }}
name: {{ $serviceName }}-
port:
number: {{ .Values.env.port }}
host: {{ .Values.ingress.host | quote }}
Expand Down
6 changes: 3 additions & 3 deletions helm/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down

0 comments on commit 1815cae

Please sign in to comment.