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

View File

@ -36,7 +36,7 @@ spec:
- name: GIT_URL - name: GIT_URL
value: "{{ .Values.updater.url }}" value: "{{ .Values.updater.url }}"
containers: containers:
- name: {{ .Chart.Name }} - name: web
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
@ -45,7 +45,7 @@ spec:
name: http-svc name: http-svc
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: /var/www/html mountPath: "/var/www/html"
env: env:
{{- with .Values.env.plain }} {{- with .Values.env.plain }}
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}
@ -75,9 +75,10 @@ spec:
name: {{ .name }} name: {{ .name }}
optional: {{ .optional | default false }} optional: {{ .optional | default false }}
{{- end }} {{- end }}
- name: {{ .Chart.PullName }} - 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"]
ports: ports:
- containerPort: 8000 - containerPort: 8000
protocol: TCP protocol: TCP

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 }} {{- if not $webhook_secret }}
{{- $webhook_secret = randAlphaNum 10 }} {{- $webhook_secret = randAlphaNum 10 }}
{{- end }} {{- 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}} {{- if not $apiUsername}}
{{- $apiUsername = randAlphaNum 10 }} {{- $apiUsername = randAlphaNum 10 }}
{{- end }} {{- end }}
@ -31,4 +22,4 @@ data:
WEBHOOK_SECRET: {{ $webhook_secret | b64enc }} WEBHOOK_SECRET: {{ $webhook_secret | b64enc }}
API_USERNAME: {{ $apiUsername | b64enc }} API_USERNAME: {{ $apiUsername | b64enc }}
API_PASSWORD: {{ $apiPassword | b64enc }} API_PASSWORD: {{ $apiPassword | b64enc }}
SCRIPT_NAME: "/.webhook" SCRIPT_NAME: {{ "/.webhook" | b64enc }}

View File

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

View File

@ -16,10 +16,12 @@ updater:
repository: glvx/web-updater repository: glvx/web-updater
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
tag: "241120-1" tag: "241120-1"
url: "" url: "https://git.aquila-consortium.org/guilhem_lavaux/gl-website-deployer"
webhook-secret: "" webhook-secret: ""
apiUsername: "" apiUsername: ""
apiPassword: "" apiPassword: ""
env:
plain: {}
ingress: ingress:
enabled: true enabled: true
@ -59,21 +61,21 @@ env:
value: "8080" value: "8080"
# Environment variables from ConfigMaps # Environment variables from ConfigMaps
configMapRefs: # configMapRefs:
- name: app-config # Reference an existing ConfigMap # - name: app-config # Reference an existing ConfigMap
optional: true # Make it optional # optional: true # Make it optional
#
configMapKeys: # configMapKeys:
- name: CONFIG_KEY # - name: CONFIG_KEY
configMapName: app-config # configMapName: app-config
key: config.key # key: config.key
#
# Environment variables from Secrets # # Environment variables from Secrets
secretRefs: # secretRefs:
- name: app-secrets # Reference an existing Secret # - name: app-secrets # Reference an existing Secret
optional: true # Make it optional # optional: true # Make it optional
#
secretKeys: # secretKeys:
- name: API_KEY # - name: API_KEY
secretName: app-secrets # secretName: app-secrets
key: api.key # key: api.key