Skip to content

Commit

Permalink
feat: add custom service and port for routing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Jan 24, 2024
1 parent 40b6889 commit 9b860cb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
{{ if .Values.global.routing.type }}{{ .Values.global.routing.type }}{{ else }}{{ .Values.routing.type }}{{ end }}
{{- end -}}

{{- define "app.routing.service" -}}
{{- if .Values.routing.service.name -}}
{{- .Values.routing.service.name -}}
{{- else if .Values.service.name -}}
{{- .Values.service.name -}}
{{- else -}}
{{- template "app.fullname" $ }}
{{- end -}}
{{- end -}}

{{- define "app.ingress.host" -}}
{{ if .Values.routing.backend }}
{{ template "app.fullname" $ }}-{{ .Release.Namespace }}.{{ .Values.global.default_url | default .Values.routing.default_url }}
Expand Down
4 changes: 2 additions & 2 deletions templates/ingress-traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
{{ end }}
services:
- kind: Service
name: {{ template "app.fullname" $ }}
port: {{ .Values.service.port }}
name: {{ include "app.routing.service" $ }}
port: {{ .Values.routing.service.port | default .Values.service.port }}
{{ end }}
{{ end }}
7 changes: 7 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ routing:
# traefik middleware name
name:

# custom service name and port for the routing
service:
# custom service name only for routing
name:
# custom service port only for routing
port:

# Replicas
replicas: 1

Expand Down

0 comments on commit 9b860cb

Please sign in to comment.