Add ssh flag

This commit is contained in:
Guilhem Lavaux 2024-12-04 22:07:01 +01:00
parent d8e86f17cf
commit 1317be06c9
3 changed files with 31 additions and 5 deletions

View File

@ -4,8 +4,8 @@ name: basic-web-app
PullName: basic-app-puller PullName: basic-app-puller
description: A basic Helm chart to have PHP webapps in Kubernetes. It supports webhook for pulling from gitea description: A basic Helm chart to have PHP webapps in Kubernetes. It supports webhook for pulling from gitea
type: application type: application
version: 2.0.0 version: 2.1.0
appVersion: "2.0.0" appVersion: "2.1.0"
dependencies: dependencies:
- name: postgresql - name: postgresql

View File

@ -22,14 +22,22 @@ spec:
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: "/web" mountPath: "/web"
{{- if .Values.updater.ssh.enabled }}
- name: ssh-key
mountPath: "/ssh-key"
readOnly: true
{{- end}}
command: command:
- /bin/sh - /bin/sh
- -ec - -ec
- | - |
cd /web cd /web
test -d .git && exit 0 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} . git clone ${GIT_URL} .
mkdir lib/config {{- end}}
git lfs install git lfs install
git lfs pull git lfs pull
env: env:
@ -78,7 +86,11 @@ spec:
- name: updater - name: updater
image: "{{ .Values.updater.image.repository }}:{{ .Values.updater.image.tag }}" image: "{{ .Values.updater.image.repository }}:{{ .Values.updater.image.tag }}"
imagePullPolicy: {{ .Values.updater.image.pullPolicy }} 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: ports:
- containerPort: 8000 - containerPort: 8000
protocol: TCP protocol: TCP
@ -86,6 +98,11 @@ spec:
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: /web mountPath: /web
{{- if .Values.updater.ssh.enabled }}
- name: ssh-key
mountPath: "/ssh-key"
readOnly: true
{{- end}}
env: env:
- name: "DATA_DIR" - name: "DATA_DIR"
value: "/web" value: "/web"
@ -126,3 +143,8 @@ spec:
- name: data - name: data
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ .Release.Name }}-pvc claimName: {{ .Release.Name }}-pvc
{{- if .Values.updater.ssh.enabled }}
- name: ssh-key
secret:
secretName: {{ .Values.updater.ssh.secretName }}
{{- end }}

View File

@ -15,8 +15,12 @@ updater:
image: image:
repository: glvx/web-updater repository: glvx/web-updater
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
tag: "241120-1" tag: "241204"
url: "https://git.aquila-consortium.org/guilhem_lavaux/gl-website-deployer" url: "https://git.aquila-consortium.org/guilhem_lavaux/gl-website-deployer"
ssh:
enabled: false
secretName: ""
webhook-secret: "" webhook-secret: ""
apiUsername: "" apiUsername: ""
apiPassword: "" apiPassword: ""