Skip to content

The Unified and Autonomous Development Platform

fix: ingress supports only one host

Khaliqbd109d10b307
diff --git a/server-product/helm/templates/NOTES.txt b/server-product/helm/templates/NOTES.txt
index 0cc0b167b7..1c84fdb03f 100644
--- a/server-product/helm/templates/NOTES.txt
+++ b/server-product/helm/templates/NOTES.txt
@@ -10,7 +10,7 @@ APP VERSION: {{ .Chart.AppVersion }}
1. You can access OneDev at:
- http://{{ index .Values.ingress.hosts 0 "host" }}
+ http://{{ .Values.ingress.host }}
{{- else }}
diff --git a/server-product/helm/templates/_helpers.tpl b/server-product/helm/templates/_helpers.tpl
index a197e0ef78..91332a9721 100644
--- a/server-product/helm/templates/_helpers.tpl
+++ b/server-product/helm/templates/_helpers.tpl
@@ -95,11 +95,6 @@ Return the appropriate apiVersion for statefulset.
{{- end -}}
{{- end -}}
-{{/* Get value of host from Ingress */}}
-{{- define "ingressHost" -}}
-{{- $host := index .Values.ingress.hosts 0 }}
-{{- $host.host }}
-{{- end -}}
{{/*
Generate URL string based on the database type
diff --git a/server-product/helm/templates/_pod.tpl b/server-product/helm/templates/_pod.tpl
index 9a34cea1ac..44c4f249e8 100644
--- a/server-product/helm/templates/_pod.tpl
+++ b/server-product/helm/templates/_pod.tpl
@@ -52,7 +52,7 @@ containers:
value: {{ .Values.onedev.enableSSL | quote }}
{{- if .Values.ingress.enabled }}
- name: ingress_host
- value: {{ include "ingressHost" . }}
+ value: {{ .Values.ingress.host }}
{{- end }}
{{- if .Values.database.external }}
{{- include "setDatabaseEnvVars" . | indent 2 }}
diff --git a/server-product/helm/templates/ingress.yaml b/server-product/helm/templates/ingress.yaml
index 7567e8ed8c..0ccec1334a 100644
--- a/server-product/helm/templates/ingress.yaml
+++ b/server-product/helm/templates/ingress.yaml
@@ -11,7 +11,6 @@ apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
-
kind: Ingress
metadata:
name: {{ include "ods.fullname" . }}
@@ -28,20 +27,14 @@ spec:
{{- end }}
{{- if .Values.ingress.tls }}
tls:
- {{- range .Values.ingress.tls }}
- - hosts:
- {{- range .hosts }}
- - {{ . | quote }}
- {{- end }}
- secretName: {{ .secretName }}
- {{- end }}
+ - hosts:
+ - {{ .Values.ingress.tls.host }}
+ secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
rules:
- {{- range .Values.ingress.hosts }}
- - host: {{ .host | quote }}
+ - host: {{ .Values.ingress.host | quote }}
http:
paths:
- {{- range .paths }}
- path: "/"
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: ImplementationSpecific
@@ -51,15 +44,13 @@ spec:
service:
name: {{ include "ods.fullname" $ }}
port:
- {{- if .port.name }}
- name: {{ .port.name }}
+ {{- if .Values.ingress.port.name }}
+ name: {{ .Values.ingress.port.name }}
{{- else }}
- number: {{ .port.number }}
+ number: {{ .Values.ingress.port.number }}
{{- end }}
{{- else }}
serviceName: {{ include "ods.fullname" $ }}
- servicePort: {{ .port.number }}
+ servicePort: {{ .Values.ingress.port.number }}
{{- end }}
- {{- end }}
- {{- end }}
{{- end }}
diff --git a/server-product/helm/values.yaml b/server-product/helm/values.yaml
index aea824ce27..7b43d5fcb3 100644
--- a/server-product/helm/values.yaml
+++ b/server-product/helm/values.yaml
@@ -228,20 +228,17 @@ ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
- hosts:
- # ingress.hosts.host -- Set the host name
- - host: onedev.example.com
- paths:
- # Specify the port name or number on the Service
- # Using name requires Kubernetes >=1.19
- - port:
- name: "http"
- number: ""
+ # ingress.host -- Set the host name
+ host: onedev.example.com
+ # ingress.port.name -- Specify the port name or number on the Service
+ # Using name requires Kubernetes >=1.19
+ port:
+ name: "http"
+ number: ""
# ingress.tls -- Configure TLS for the Ingress.
- tls: []
- # - secretName: wildcard-tls
- # hosts:
- # - onedev.example.com
+ tls: {}
+ # secretName: wildcard-tls
+ # host: onedev.example.com
# extraVolumes -- Specify additional Volumes to use.
extraVolumes: []