From fd9fa03191806fd42482e6e1136302a4f50ab7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Apeland?= Date: Tue, 3 Aug 2021 13:35:34 +0200 Subject: [PATCH] Add support for custom scripts This change adds support for putting custom scripts in `/etc/sftp.d` with the `sftpConfig.customScripts` Helm value. Upstream looks for executables in `/etc/sftp.d` on startup and runs them. --- templates/custom-scripts.yaml | 10 ++++++++++ templates/deployment.yaml | 10 ++++++++++ values.yaml | 1 + 3 files changed, 21 insertions(+) create mode 100644 templates/custom-scripts.yaml diff --git a/templates/custom-scripts.yaml b/templates/custom-scripts.yaml new file mode 100644 index 0000000..befd59b --- /dev/null +++ b/templates/custom-scripts.yaml @@ -0,0 +1,10 @@ +{{- if .Values.sftpConfig.customScripts }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "sftp-server.fullname" . }}-custom-scripts +data: + {{- range $k, $v := .Values.sftpConfig.customScripts }} + {{ $k }}: {{ $v | toYaml | indent 2 }} + {{- end }} +{{- end }} diff --git a/templates/deployment.yaml b/templates/deployment.yaml index bf44fd4..5fefd78 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -87,6 +87,10 @@ spec: subPath: {{ . }} {{- end }} {{- end }} + {{- if .Values.sftpConfig.customScripts }} + - name: custom-scripts + mountPath: /etc/sftp.d + {{- end }} livenessProbe: tcpSocket: port: 22 @@ -120,6 +124,12 @@ spec: secretName: {{ .Values.sftpConfig.hostKeys.secret }} defaultMode: 384 {{- end }} + {{- if .Values.sftpConfig.customScripts }} + - name: custom-scripts + configMap: + name: {{ include "sftp-server.fullname" . }}-custom-scripts + defaultMode: 0755 + {{- end }} {{- if .Values.persistentVolume.enabled }} - name: data persistentVolumeClaim: diff --git a/values.yaml b/values.yaml index da4fc60..e623363 100644 --- a/values.yaml +++ b/values.yaml @@ -27,6 +27,7 @@ sftpConfig: #- ssh_host_rsa_key #- ssh_host_ed25519_key authorizedKeys: {} + #customScripts: {} debug: enabled: false