From 0c6bbe3b5e9cbfc2fbcbbfeff568d154b6a9240f Mon Sep 17 00:00:00 2001 From: Peter <61582128+MuriukiPM@users.noreply.github.com> Date: Wed, 6 Nov 2024 19:48:47 +0300 Subject: [PATCH] allow chart to set paths for each ingress host if required (#41) * allow chart to set paths for each ingress host if required * bump chart version --- standard-app/Chart.yaml | 2 +- standard-app/example.values.yaml | 14 ++++++++++++++ standard-app/templates/network/ingress.yaml | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/standard-app/Chart.yaml b/standard-app/Chart.yaml index e7b6f5c..9434b66 100644 --- a/standard-app/Chart.yaml +++ b/standard-app/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: standard-app description: A Helm chart library by Cloudkite type: application -version: 0.4.8 +version: 0.4.9 maintainters: - email: hello@cloudkite.io name: cloudkite diff --git a/standard-app/example.values.yaml b/standard-app/example.values.yaml index 3a0c982..e4cb156 100644 --- a/standard-app/example.values.yaml +++ b/standard-app/example.values.yaml @@ -12,6 +12,20 @@ ingress: cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/configuration-snippet: | rewrite ^(/api)(.*) $2 break; + # hostPaths: + # - host: "my.domain.name.com" + # servicePort: 3000 + # serviceName: cloudkite-app-1 + # path: "/" + # - host: "my-other.domain.name.com" + # servicePort: 3000 + # serviceName: cloudkite-app-1 + # path: "/someprefix" + # tls: + # - secretName: my-domain-name-com-tls + # hosts: + # - "my.domain.name.com" + # - "my-other.domain.name.com" hosts: - test.dev.someorg.com - other.domain.name.com diff --git a/standard-app/templates/network/ingress.yaml b/standard-app/templates/network/ingress.yaml index 58b4f2f..5189d52 100644 --- a/standard-app/templates/network/ingress.yaml +++ b/standard-app/templates/network/ingress.yaml @@ -16,6 +16,20 @@ metadata: spec: ingressClassName: {{ .Values.ingress.className | default "nginx" }} rules: + {{- if .Values.ingress.hostPaths }} + {{- range .Values.ingress.hostPaths }} + - host: {{ .host | quote }} + http: + paths: + - path: {{ .path }} + pathType: Prefix + backend: + service: + name: {{ .serviceName }} + port: + number: {{ .servicePort }} + {{- end }} + {{- else if .Values.ingress.hosts }} {{- range .Values.ingress.hosts }} - host: {{ . | quote }} http: @@ -30,6 +44,7 @@ spec: number: {{ .servicePort }} {{- end }} {{- end }} + {{- end }} tls: {{- if .Values.ingress.tls }} {{- toYaml .Values.ingress.tls | nindent 4 }}