Skip to content

The Unified and Autonomous Development Platform

feat(chart): spilit HTTP and SSH services and add many settings

Nex Zhu5851bcf5c3df
diff --git a/server-product/helm/templates/ingress.yaml b/server-product/helm/templates/ingress.yaml
index 804c3256ff..77d8073ce1 100644
--- a/server-product/helm/templates/ingress.yaml
+++ b/server-product/helm/templates/ingress.yaml
@@ -2,7 +2,7 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: {{ include "onedev.fullname" . }}
+ name: {{ include "onedev.fullname" . }}-http
{{- with .Values.ingress.annotations }}
annotations:
{{- if and $.Values.ingress.enableDefaultIssuer $.Values.letsencrypt.email }}
@@ -26,7 +26,7 @@ spec:
pathType: Prefix
backend:
service:
- name: {{ include "onedev.fullname" . }}
+ name: {{ include "onedev.fullname" . }}-http
port:
number: 80
{{- end }}
diff --git a/server-product/helm/templates/service.yaml b/server-product/helm/templates/service.yaml
index 28df21ab7d..89814f4f0f 100644
--- a/server-product/helm/templates/service.yaml
+++ b/server-product/helm/templates/service.yaml
@@ -1,21 +1,91 @@
+{{ $http := .Values.service.http }}
apiVersion: v1
kind: Service
metadata:
- name: {{ include "onedev.fullname" . }}
+ name: {{ include "onedev.fullname" . }}-http
labels:
{{- include "onedev.labels" . | nindent 4 }}
tier: onedev
+ annotations:
+ {{- toYaml $http.annotations | nindent 4 }}
spec:
- {{- if not .Values.ingress.host }}
- type: LoadBalancer
+ {{ $type := $http.type | default (ternary "ClusterIP" "LoadBalancer" (not .Values.ingress.host)) }}
+ type: {{ $type }}
+ {{- if eq $type "LoadBalancer" }}
+ {{- if $http.loadBalancerIP }}
+ loadBalancerIP: {{ $http.loadBalancerIP }}
+ {{- end }}
+ {{- if $http.loadBalancerSourceRanges }}
+ loadBalancerSourceRanges:
+ {{- range $http.loadBalancerSourceRanges }}
+ - {{ . }}
+ {{- end }}
+ {{- end }}
+ {{- else if eq $type "ClusterIP" }}
+ {{- if $http.clusterIP }}
+ clusterIP: {{ $http.clusterIP }}
+ {{- end }}
+ {{- end }}
+ {{- if $http.externalIPs }}
+ externalIPs:
+ {{- toYaml $http.externalIPs | nindent 4 }}
+ {{- end }}
+ {{- if $http.externalTrafficPolicy }}
+ externalTrafficPolicy: {{ $http.externalTrafficPolicy }}
{{- end }}
ports:
- name: http
- port: 80
+ port: {{ $http.port }}
+ {{- if $http.nodePort }}
+ nodePort: {{ $http.nodePort }}
+ {{- end }}
targetPort: 6610
protocol: TCP
+ selector:
+ {{- include "onedev.selectorLabels" . | nindent 4 }}
+ tier: onedev
+---
+{{ $ssh := .Values.service.ssh }}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "onedev.fullname" . }}-ssh
+ labels:
+ {{- include "onedev.labels" . | nindent 4 }}
+ tier: onedev
+ annotations:
+ {{- toYaml $ssh.annotations | nindent 4 }}
+spec:
+ {{ $type := $ssh.type | default (ternary "ClusterIP" "LoadBalancer" (not .Values.ingress.host)) }}
+ type: {{ $type }}
+ {{- if eq $type "LoadBalancer" }}
+ {{ if $ssh.loadBalancerIP }}
+ loadBalancerIP: {{ $ssh.loadBalancerIP }}
+ {{- end }}
+ {{- if $ssh.loadBalancerSourceRanges }}
+ loadBalancerSourceRanges:
+ {{- range $ssh.loadBalancerSourceRanges }}
+ - {{ . }}
+ {{- end }}
+ {{- end }}
+ {{- else if eq $type "ClusterIP" }}
+ {{- if $ssh.clusterIP }}
+ clusterIP: {{ $ssh.clusterIP }}
+ {{- end }}
+ {{- end }}
+ {{- if $ssh.externalIPs }}
+ externalIPs:
+ {{- toYaml $ssh.externalIPs | nindent 4 }}
+ {{- end }}
+ {{- if $ssh.externalTrafficPolicy }}
+ externalTrafficPolicy: {{ $ssh.externalTrafficPolicy }}
+ {{- end }}
+ ports:
- name: ssh
- port: 22
+ port: {{ $ssh.port }}
+ {{- if $ssh.nodePort }}
+ nodePort: {{ $ssh.nodePort }}
+ {{- end }}
targetPort: 6611
protocol: TCP
selector:
diff --git a/server-product/helm/values.yaml b/server-product/helm/values.yaml
index dd058577fb..f0c6905084 100644
--- a/server-product/helm/values.yaml
+++ b/server-product/helm/values.yaml
@@ -8,6 +8,28 @@ nodeSelector:
mysql:
kubernetes.io/os: linux
+service:
+ http:
+ # type: ClusterIP
+ port: 80
+ # clusterIP: None
+ #loadBalancerIP:
+ #nodePort:
+ #externalTrafficPolicy:
+ #externalIPs:
+ loadBalancerSourceRanges: []
+ annotations:
+ ssh:
+ # type: LoadBalancer
+ port: 22
+ # clusterIP: None
+ #loadBalancerIP:
+ #nodePort:
+ #externalTrafficPolicy:
+ #externalIPs:
+ loadBalancerSourceRanges: []
+ annotations:
+
## Ingress support, check below for more info.
## Check https://code.onedev.io/projects/162/blob/main/pages/deploy-into-k8s-with-helm.md#ingress-setup for details
ingress: