The Unified and Autonomous Development Platform
chore: simplify trust certs setting
Robin Shend7f1b40897dc
diff --git a/server-product/helm/build.sh b/server-product/helm/build.shindex 5ed416fac9..c0a19708ef 100755--- a/server-product/helm/build.sh+++ b/server-product/helm/build.sh@@ -6,7 +6,8 @@ cd ../targetbuildVersion=`ls onedev-*.zip|sed -e 's/onedev-\(.*\).zip/\1/'`-rm -rf helm-chart+rm -rf helm-chart/onedev/*+rm -rf helm-chart/*.tgzmkdir -p helm-chart/onedevcp -r ../helm/* helm-chart/onedevrm helm-chart/onedev/build.shdiff --git a/server-product/helm/templates/_pod.tpl b/server-product/helm/templates/_pod.tplindex 881f725fe2..d57026e79a 100644--- a/server-product/helm/templates/_pod.tpl+++ b/server-product/helm/templates/_pod.tpl@@ -95,12 +95,10 @@ containers:lifecycle: {{ toYaml .Values.lifecycle | nindent 6 }}{{- end }}volumeMounts:- - name: data- mountPath: "/opt/onedev"-{{- if .Values.onedev.trustCerts.enabled }}- - name: trust-certs- mountPath: "/opt/onedev/conf/trust-certs"-{{- end }}+ - name: data+ mountPath: "/opt/onedev"+ - name: trust-certs+ mountPath: "/opt/onedev/conf/trust-certs"{{- if .Values.extraVolumeMounts }}{{ toYaml .Values.extraVolumeMounts | indent 6 }}{{- end }}@@ -121,20 +119,19 @@ tolerations: {{ toYaml .Values.tolerations | nindent 2 }}topologySpreadConstraints: {{ toYaml .Values.topologySpreadConstraints | nindent 2 }}{{- end }}volumes:-{{- if .Values.onedev.trustCerts.enabled }}- - name: trust-certs- secret:- secretName: {{ if .Values.onedev.trustCerts.existingSecret }}{{ .Values.onedev.trustCerts.existingSecret }}{{- else }}{{ include "ods.fullname" . }}-certs{{- end }}-{{- end }}+- name: trust-certs+ secret:+ secretName: {{ .Values.onedev.trustCerts.secretName }}+ optional: true{{- if .Values.persistence.enabled }}{{- if .Values.persistence.existingClaim }}- - name: data- persistentVolumeClaim:- claimName: {{ .Values.persistence.existingClaim }}+- name: data+ persistentVolumeClaim:+ claimName: {{ .Values.persistence.existingClaim }}{{- end }}{{- else }}- - name: data- emptyDir: {}+- name: data+ emptyDir: {}{{- end }}{{- if .Values.extraVolumes }}{{ toYaml .Values.extraVolumes | indent 2 }}diff --git a/server-product/helm/templates/cert-secret.yaml b/server-product/helm/templates/cert-secret.yamldeleted file mode 100644index 97f07e1d93..0000000000--- a/server-product/helm/templates/cert-secret.yaml+++ /dev/null@@ -1,13 +0,0 @@-{{- if and .Values.onedev.trustCerts.enabled (not .Values.onedev.trustCerts.existingConfigmapName) }}-apiVersion: v1-kind: Secret-type: Opaque-metadata:- name: {{ include "ods.fullname" . }}-certs- namespace: {{ .Release.Namespace }}- labels: {{ include "ods.labels" . | nindent 4 }}- annotations:- checksum/secret: {{ tpl (toYaml .Values.onedev.trustCerts.path) . | sha256sum }}-data:- cert.pem: {{ .Values.onedev.trustCerts.path | b64enc }}-{{- end }}diff --git a/server-product/helm/templates/dep-sts.yaml b/server-product/helm/templates/dep-sts.yamlindex 5c7ec03efa..475d2f69e3 100644--- a/server-product/helm/templates/dep-sts.yaml+++ b/server-product/helm/templates/dep-sts.yaml@@ -26,13 +26,9 @@ spec:{{- if .Values.podLabels }}{{ toYaml .Values.podLabels | indent 8 }}{{- end }}-{{- if .Values.onedev.trustCerts.enabled }}- annotations:- checksum/secret: {{ tpl (toYaml .Values.onedev.trustCerts.path) . | sha256sum }}- {{- end }}- {{- if .Values.podAnnotations }}-{{ tpl (toYaml .Values.podAnnotations) . | indent 8 }}- {{- end }}+ {{- if .Values.podAnnotations }}+ annotations: {{ toYaml .Values.podAnnotations | nindent 8 }}+ {{- end }}spec: {{ include "ods.pod" . | nindent 6 }}{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) (not .Values.onedev.useStatefulSet) }}- name: datadiff --git a/server-product/helm/values.yaml b/server-product/helm/values.yamlindex 212a4df8a0..d9802aec6a 100644--- a/server-product/helm/values.yaml+++ b/server-product/helm/values.yaml@@ -14,15 +14,12 @@ onedev:# onedev.updateStrategy -- valid options for statefulset `RollingUpdate`, `OnDelete` / Deployment: `RollingUpdate`, `Recreate`updateStrategy:type: RollingUpdate- # trustCerts -- Specify a local directory containing certificates to be trusted in PEM format.trustCerts:- # onedev.trustCerts.enabled -- Set to **true** to provide trust certs- enabled: false- # onedev.trustCerts.path -- Path of cert file on disk- path: ""- # onedev.trustCerts.existingSecret -- Existing secret name containing the cert file- ## - can be created with `kubectl create secret generic trustCerts --from-file=_local/cert.pem`- existingSecret: ""+ # onedev.trustCerts.secretName -- Name of an existing secret containing trusted certificates. You may create the+ # secret with "kubectl create secret generic onedev-trustcerts -n onedev --from-file=/path/to/trust-certs",+ # where /path/to/trust-certs is a directory contains all certificates to be trusted. Certificate should begin with+ # "-----BEGIN CERTIFICATE-----" and ending with "-----END CERTIFICATE-----"+ secretName: "onedev-trustcerts"# onedev.maintenance -- Set this as **true** to stop OneDev server and perform various maintenance tasks such as backup, restore.# [Check Docs](https://code.onedev.io/onedev/manual/~files/main/pages/backup-restore.md) for more details@@ -37,7 +34,7 @@ onedev:# onedev.initSettings.password -- admin Password, if not specified a random password will be generated automaticallypassword: "password"# onedev.initSettings.email -- admin Email address- email: "[email protected]"+ email: "[email protected]"# onedev.initSettings.serverUrl -- Server url will be ignored if ingress.host is specifiedserverUrl: ""sshRootUrl: ""