Skip to content

Commit

Permalink
feat: moving GTM to support multiple ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikZed committed Mar 27, 2024
1 parent 5400527 commit 8f46a23
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion charts/gtm-server-container-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.5
version: 0.1.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
33 changes: 10 additions & 23 deletions charts/gtm-server-container-cluster/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "gtm-server-container-cluster.fullname" . -}}
{{- $taggingHost := .Values.ingress.taggingHost -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
Expand All @@ -19,48 +18,36 @@ metadata:
name: {{ $fullName }}
labels:
{{- include "gtm-server-container-cluster.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- toYaml .Values.ingress.annotations | nindent 4 }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
tls:
- hosts:
- {{ lower .Values.ingress.taggingHost | quote }}
{{- range .Values.ingress.rules }}
- {{ lower .taggingHost | quote }}
{{- end }}
secretName: "{{ $fullName }}-tls-secret"
rules:
- host: {{ .Values.ingress.taggingHost }}
{{- range .Values.ingress.rules }}
- host: {{ .taggingHost }}
http:
paths:
- path: /
{{- if and .Values.ingress.pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .Values.ingress.pathType }}
{{- end }}
pathType: {{ .pathType }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
- path: /preview
{{- if and .Values.ingress.pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .Values.ingress.pathType }}
{{- end }}
pathType: {{ .pathType }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: "{{ $fullName }}-preview"
port:
number: {{ $svcPort }}
{{- else }}
serviceName: "{{ $fullName }}-preview"
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
12 changes: 8 additions & 4 deletions charts/gtm-server-container-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ service:
ingress:
enabled: true
className: ""
taggingHost: chart-example.local
pathType: ImplementationSpecific
annotations:
cert-manager.io/acme-challenge-type: http01
cert-manager.io/cluster-issuer: letsencrypt-prod
cert-manager.io/acme-challenge-type: "http01"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
rules:
- taggingHost: "chart-example1.local"
pathType: "ImplementationSpecific"
- taggingHost: "chart-example2.local"
pathType: "ImplementationSpecific"


resources:
# We usually recommend not to specify default resources and to leave this as a conscious
Expand Down

0 comments on commit 8f46a23

Please sign in to comment.