From 9c9654f2198dfc18c4bf41899f8859248f136ba4 Mon Sep 17 00:00:00 2001 From: ZhangNing10 <135692613+ZhangNing10@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:07:32 +0800 Subject: [PATCH] Update ingress (#234) * adjust ingress * adjust chart version --- HelmSetup.md | 19 +++++++++++-------- charts/devlake/Chart.yaml | 2 +- charts/devlake/templates/ingresses.yaml | 21 ++++++++++++--------- charts/devlake/values.yaml | 15 +++++++++++++-- 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/HelmSetup.md b/HelmSetup.md index 04f33bf..18dd322 100644 --- a/HelmSetup.md +++ b/HelmSetup.md @@ -197,14 +197,17 @@ Some useful parameters for the chart, you could also check them in values.yaml | ui.deployment.extraLabels | extra labels for ui's deployment metadata | {} | | service.type | Service type for exposed service | NodePort | | service.uiPort | Node port for config ui | 32001 | -| service.ingress.enabled | If enable ingress | false | -| service.ingress.enableHttps | If enable https | false | -| service.ingress.className | Name for ingressClass. leave empty for using default | "" | -| service.ingress.hostname | The hostname/domainname for ingress | localhost | -| service.ingress.prefix | The prefix for endpoints, currently not used | / | -| service.ingress.tlsSecretName | The secret name for tls's certificate for https | "" | -| service.ingress.httpPort | The http port for ingress | 80 | -| service.ingress.httpsPort | The https port for ingress | 443 | +| ingress.enabled | If enable ingress | false | +| ingress.enableHttps | If enable https | false | +| ingress.useDefaultNginx | If use nginx ingress controller | true | +| ingress.className | Name for ingressClass. leave empty for using default | "" | +| ingress.annotations | The ingress annotations | {} | +| ingress.hostname | The hostname/domainname for ingress | localhost | +| ingress.prefix | The prefix for endpoints, currently not used | / | +| ingress.tlsSecretName | The secret name for tls's certificate for https | "" | +| ingress.httpPort | The http port for ingress | 80 | +| ingress.httpsPort | The https port for ingress | 443 | +| ingress.extraPaths | The extra paths for ingress | [] | | option.database | The database type, valids: mysql | mysql | | option.connectionSecretName | The database connection details secret name | devlake-mysql-auth | | option.autoCreateSecret | If let the helm chart create the secret | true | diff --git a/charts/devlake/Chart.yaml b/charts/devlake/Chart.yaml index cd38805..2b70805 100644 --- a/charts/devlake/Chart.yaml +++ b/charts/devlake/Chart.yaml @@ -28,7 +28,7 @@ keywords: type: application # Chart version -version: 0.20.0-beta7 +version: 0.20.0-beta7.1 # devlake version appVersion: v0.20.0-beta7 diff --git a/charts/devlake/templates/ingresses.yaml b/charts/devlake/templates/ingresses.yaml index 5a82ea4..72b08aa 100644 --- a/charts/devlake/templates/ingresses.yaml +++ b/charts/devlake/templates/ingresses.yaml @@ -16,6 +16,7 @@ # {{- if .Values.ingress.enabled -}} {{- $fullName := include "devlake.fullname" . -}} +{{- $uiServiceName := printf "%s-%s" $fullName "ui" -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} @@ -67,12 +68,12 @@ spec: backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) }} + name: {{ .Values.grafana.ingressServiceName | default ( include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) ) }} port: - number: {{ .Values.grafana.service.port }} + number: {{ .Values.grafana.ingressServicePort | default .Values.grafana.service.port }} {{- else }} - serviceName: {{ include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) }} - servicePort: {{ .Values.grafana.service.port }} + serviceName: {{ .Values.grafana.ingressServiceName | default ( include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) ) }} + servicePort: {{ .Values.grafana.ingressServicePort | default .Values.grafana.service.port }} {{- end }} {{- end }} {{- if .Values.ingress.useDefaultNginx }} @@ -86,14 +87,16 @@ spec: backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ include "devlake.fullname" . }}-ui + name: {{ $uiServiceName }} port: number: 4000 {{- else }} - serviceName: {{ include "devlake.fullname" . }}-ui + serviceName: {{ $uiServiceName }} servicePort: 4000 {{- end }} - + {{- if .Values.ingress.extraPaths }} + {{- toYaml .Values.ingress.extraPaths | nindent 10 }} + {{- end }} {{- if and .Values.ingress.useDefaultNginx (not .Values.grafana.enabled) }} --- {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} @@ -135,11 +138,11 @@ spec: backend: # dummy to config-ui, actual 302 forearding for external grafana {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ include "devlake.fullname" . }}-ui + name: {{ $uiServiceName }} port: number: 4000 {{- else }} - serviceName: {{ include "devlake.fullname" . }}-ui + serviceName: {{ $uiServiceName }} servicePort: 4000 {{- end }} {{- end }} diff --git a/charts/devlake/values.yaml b/charts/devlake/values.yaml index 1da2d79..6a649a2 100644 --- a/charts/devlake/values.yaml +++ b/charts/devlake/values.yaml @@ -161,6 +161,8 @@ grafana: persistence: enabled: true size: 4Gi + ingressServiceName: "" + ingressServicePort: "" lake: image: @@ -327,8 +329,7 @@ ingress: # annotations required for your ingress controller; see the examples below # for nginx, use the first two lines of annotations # for alb (w/ external-dns), use the last 5 (6) lines of annotations - annotations: - {} + annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" # @@ -348,6 +349,16 @@ ingress: # ingress https port httpsPort: 443 + extraPaths: [] +# extraPaths: +# - path: /* +# pathType: ImplementationSpecific +# backend: +# service: +# name: ssl-redirect +# port: +# name: use-annotation + option: # database type, supported: [mysql] database: mysql