{{- include "seaweedfs.compat" . -}} {{- /* Render a chart-managed Secret carrying the SSH user CA public key(s) for certificate-based SFTP authentication, but only when: - SFTP (standalone or all-in-one) is enabled, - "certificate" is in the relevant authMethods list, - the user provided inline CA keys via sftp.trustedUserCAKeys, and - no existingCAKeysSecret is set (which would supersede this Secret). */}} {{- $sftpEnabled := or .Values.sftp.enabled (and .Values.allInOne.enabled .Values.allInOne.sftp.enabled) -}} {{- $authMethods := .Values.sftp.authMethods -}} {{- if and .Values.allInOne.enabled .Values.allInOne.sftp.authMethods -}} {{- $authMethods = .Values.allInOne.sftp.authMethods -}} {{- end -}} {{- $certInMethods := and $authMethods (contains "certificate" $authMethods) -}} {{- $inlineCAKeys := .Values.sftp.trustedUserCAKeys -}} {{- if and .Values.allInOne.enabled .Values.allInOne.sftp.trustedUserCAKeys -}} {{- $inlineCAKeys = .Values.allInOne.sftp.trustedUserCAKeys -}} {{- end -}} {{- $existingSecret := .Values.sftp.existingCAKeysSecret -}} {{- if and .Values.allInOne.enabled .Values.allInOne.sftp.existingCAKeysSecret -}} {{- $existingSecret = .Values.allInOne.sftp.existingCAKeysSecret -}} {{- end -}} {{- if and $sftpEnabled $certInMethods $inlineCAKeys (not $existingSecret) }} apiVersion: v1 kind: Secret type: Opaque metadata: name: {{ include "seaweedfs.fullname" . }}-sftp-ca-secret namespace: {{ .Release.Namespace }} labels: app.kubernetes.io/name: {{ template "seaweedfs.name" . }} helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: sftp stringData: ca_user.pub: | {{ $inlineCAKeys | indent 4 }} {{- end }}