diff --git a/Chart.yaml b/Chart.yaml index c429f9e..2f20b39 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -4,8 +4,8 @@ name: basic-web-app PullName: basic-app-puller description: A basic Helm chart to have PHP webapps in Kubernetes. It supports webhook for pulling from gitea type: application -version: 2.0.0 -appVersion: "2.0.0" +version: 2.1.0 +appVersion: "2.1.0" dependencies: - name: postgresql diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 7b7895d..408aec0 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -22,14 +22,22 @@ spec: volumeMounts: - name: data mountPath: "/web" + {{- if .Values.updater.ssh.enabled }} + - name: ssh-key + mountPath: "/ssh-key" + readOnly: true + {{- end}} command: - /bin/sh - -ec - | cd /web test -d .git && exit 0 + {{- if .Values.updater.ssh.enabled }} + git clone ${GIT_URL} . --config core.sshCommand="ssh -i /ssh-key" + {{- else }} git clone ${GIT_URL} . - mkdir lib/config + {{- end}} git lfs install git lfs pull env: @@ -78,7 +86,11 @@ spec: - name: updater image: "{{ .Values.updater.image.repository }}:{{ .Values.updater.image.tag }}" imagePullPolicy: {{ .Values.updater.image.pullPolicy }} - command: ["/webhook-runner.sh"] + {{- if .Values.updater.ssh.enabled }} + command: ["/webhook-runner.sh ssh"] + {{- else }} + command: ["/webhook-runner.sh http"] + {{- end }} ports: - containerPort: 8000 protocol: TCP @@ -86,6 +98,11 @@ spec: volumeMounts: - name: data mountPath: /web + {{- if .Values.updater.ssh.enabled }} + - name: ssh-key + mountPath: "/ssh-key" + readOnly: true + {{- end}} env: - name: "DATA_DIR" value: "/web" @@ -126,3 +143,8 @@ spec: - name: data persistentVolumeClaim: claimName: {{ .Release.Name }}-pvc + {{- if .Values.updater.ssh.enabled }} + - name: ssh-key + secret: + secretName: {{ .Values.updater.ssh.secretName }} + {{- end }} diff --git a/values.yaml b/values.yaml index 2273866..65bbf6b 100644 --- a/values.yaml +++ b/values.yaml @@ -15,8 +15,12 @@ updater: image: repository: glvx/web-updater pullPolicy: IfNotPresent - tag: "241120-1" + tag: "241204" url: "https://git.aquila-consortium.org/guilhem_lavaux/gl-website-deployer" + ssh: + enabled: false + secretName: "" + webhook-secret: "" apiUsername: "" apiPassword: ""