Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(helm): keep install port aligned with service port

Herrtianab236f2d6a27
diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml
index e71aa836..f1b9d186 100644
--- a/charts/templates/deployment.yaml
+++ b/charts/templates/deployment.yaml
@@ -64,8 +64,23 @@ spec:
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
- {{- if .Values.env }}
+ {{- $envNames := list }}
+ {{- range .Values.env }}
+ {{- $envNames = append $envNames .name }}
+ {{- end }}
env:
+ {{- if not (has "INSTALL_PORT" $envNames) }}
+ - name: INSTALL_PORT
+ value: {{ .Values.service.port | quote }}
+ {{- end }}
+ {{- if not (has "SITE_ADDR" $envNames) }}
+ - name: SITE_ADDR
+ value: {{ printf "0.0.0.0:%v" .Values.service.port | quote }}
+ {{- end }}
+ {{- if not (has "SWAGGER_ADDRESS_PORT" $envNames) }}
+ - name: SWAGGER_ADDRESS_PORT
+ value: {{ printf ":%v" .Values.service.port | quote }}
+ {{- end }}
{{- range .Values.env }}
- name: {{ .name }}
{{- if .value | quote }}
@@ -76,7 +91,6 @@ spec:
{{- toYaml .valueFrom | nindent 16 }}
{{- end }}
{{- end }}
- {{- end }}
volumeMounts:
- name: data
mountPath: "/data"
@@ -102,4 +116,4 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
- {{- end }}
\ No newline at end of file
+ {{- end }}