This commit is contained in:
Guilhem Lavaux 2024-11-20 18:16:42 +01:00
parent 65db180b05
commit 6879e6baf1
5 changed files with 36 additions and 41 deletions

View file

@ -1,5 +1,6 @@
{{- $releaseNamespace := {{ .Release.Namespace }} }}
{{- $secretName := {{ .Release.Name }}-webhook-secret }}
{{- $releaseNamespace := .Release.Namespace }}
{{- $releaseName := .Release.Name }}
{{- $secretName := printf "%s-webhook-secret" $releaseName }}
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}
@ -9,8 +10,8 @@ APP VERSION: {{ .Chart.AppVersion }}
To get the webhook identification run:
export WEBHOOK_SECRET=$(kubectl get secret --namespace {{ $releaseNamespace }} {{ $secretName }} -o jsonpath="{.data.WEBHOOK_SECRET}" | base64 -d)
export API_USERNAME=$(kubectl get secret --namespace {{ $releaseNamespace }} {{ $secretName }} -o jsonpath="{.data.API_USERNAME}" | base64 -d): {{ $apiUsername | b64enc }}
export API_PASSWORD=$(kubectl get secret --namespace {{ $releaseNamespace }} {{ $secretName }} -o jsonpath="{.data.API_PASSWORD}" | base64 -d): {{ $apiUsername | b64enc }}
export API_USERNAME=$(kubectl get secret --namespace {{ $releaseNamespace }} {{ $secretName }} -o jsonpath="{.data.API_USERNAME}" | base64 -d)
export API_PASSWORD=$(kubectl get secret --namespace {{ $releaseNamespace }} {{ $secretName }} -o jsonpath="{.data.API_PASSWORD}" | base64 -d)
To build the authentication header:

View file

@ -36,7 +36,7 @@ spec:
- name: GIT_URL
value: "{{ .Values.updater.url }}"
containers:
- name: {{ .Chart.Name }}
- name: web
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
@ -45,7 +45,7 @@ spec:
name: http-svc
volumeMounts:
- name: data
mountPath: /var/www/html
mountPath: "/var/www/html"
env:
{{- with .Values.env.plain }}
{{- toYaml . | nindent 12 }}
@ -75,9 +75,10 @@ spec:
name: {{ .name }}
optional: {{ .optional | default false }}
{{- end }}
- name: {{ .Chart.PullName }}
- name: updater
image: "{{ .Values.updater.image.repository }}:{{ .Values.updater.image.tag }}"
imagePullPolicy: {{ .Values.updater.image.pullPolicy }}
command: ["/webhook-runner.sh"]
ports:
- containerPort: 8000
protocol: TCP
@ -124,4 +125,4 @@ spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ .Release.Name }}-pvc
claimName: {{ .Release.Name }}-pvc

View file

@ -1,19 +1,10 @@
{{- $webhook_secret := .Values.updater.webhook_secret }}
{{- $apiUsername := .Values.updater.apiUsername }}
{{- $apiPassword := .Values.updater.apiPassword }}
{{- if and (not $webhook_secret) .Values.updater.webhook_secret }}
{{- $webhook_secret = .Values.updater.webhook_secret }}
{{- end }}
{{- if not $webhook_secret }}
{{- $webhook_secret = randAlphaNum 10 }}
{{- end }}
{{- if and (not $apiUsername) .Values.updater.apiUsername }}
{{- $apiUsername = .Values.updater.apiUsername }}
{{- end }}
{{- if and (not $apiPassword) .Values.updater.apiPassword }}
{{- $apiPassword = .Values.updater.apiPassword }}
{{- end }}
{{- if not $apiUsername}}
{{- $apiUsername = randAlphaNum 10 }}
{{- end }}
@ -31,4 +22,4 @@ data:
WEBHOOK_SECRET: {{ $webhook_secret | b64enc }}
API_USERNAME: {{ $apiUsername | b64enc }}
API_PASSWORD: {{ $apiPassword | b64enc }}
SCRIPT_NAME: "/.webhook"
SCRIPT_NAME: {{ "/.webhook" | b64enc }}

View file

@ -6,7 +6,7 @@ metadata:
labels:
{{- include "basic-app.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
type: ClusterIP
ports:
- port: 80
targetPort: http-svc