Skip to content

Commit bb89b4f

Browse files
committed
fixup! 🔧(helm) rework chart based on jenny helm chart
1 parent 3ebc99b commit bb89b4f

5 files changed

Lines changed: 100 additions & 13 deletions

File tree

src/helm/warren/charts/api/templates/NOTES.txt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
1. Get the application URL by running these commands:
1+
CHART NAME: {{ .Chart.Name }}
2+
CHART VERSION: {{ .Chart.Version }}
3+
APP VERSION: {{ .Chart.AppVersion }}
4+
5+
** Please be patient while the chart is being deployed **
6+
7+
1. Access your Warren api installation:
28
{{- if .Values.ingress.enabled }}
3-
{{- range $host := .Values.ingress.host }}
4-
{{- range .paths }}
5-
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
9+
Connect to one of the following hosts:
10+
{{ if .Values.ingress.tls }}
11+
https://{{ .Values.ingress.host }}
12+
{{- else }}
13+
http://{{ .Values.ingress.host }}
614
{{- end }}
7-
{{- end }}
815
{{- else if contains "NodePort" .Values.service.type }}
916
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "api.fullname" . }})
1017
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11-
echo http://$NODE_IP:$NODE_PORT
18+
echo "Warren API URL: http://$NODE_IP:$NODE_PORT"
1219
{{- else if contains "LoadBalancer" .Values.service.type }}
1320
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
1421
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "api.fullname" . }}'
1522
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "api.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
1623
echo http://$SERVICE_IP:{{ .Values.service.port }}
1724
{{- else if contains "ClusterIP" .Values.service.type }}
18-
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "api.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
25+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "api.name" . }},api.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
1926
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
2027
echo "Visit http://127.0.0.1:8080 to use your application"
2128
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT

src/helm/warren/charts/api/templates/_helpers.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ Environment variables
8484
secretKeyRef:
8585
name: warren-api-lrs
8686
key: WARREN_LRS_AUTH_BASIC_PASSWORD
87+
- name: "WARREN_XI_LMS_BASE_URL"
88+
value: "{{ .Values.fastapi.xi.lmsBaseUrl }}"
89+
- name: "WARREN_XI_LMS_API_TOKEN"
90+
valueFrom:
91+
secretKeyRef:
92+
name: warren-api-lms
93+
key: WARREN_XI_LMS_API_TOKEN
94+
- name: "WARREN_XI_DEFAULT_LANG"
95+
value: "{{ .Values.fastapi.xi.defaultLang }}"
8796
- name: "WARREN_APP_SIGNING_ALGORITHM"
8897
value: "{{ .Values.fastapi.signingAlgorithm }}"
8998
- name: "WARREN_APP_SIGNING_KEY"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{{- range .Values.fastapi.cronjobs }}
2+
---
3+
apiVersion: batch/v1
4+
kind: CronJob
5+
metadata:
6+
name: {{ include "api.fullname" $ }}-{{ .name }}
7+
namespace: {{ $.Release.Namespace | quote }}
8+
labels: {{- include "api.labels" $ | nindent 4 }}
9+
{{- if $.Values.commonLabels }}
10+
{{ toYaml $.Values.commonLabels | nindent 4 }}
11+
{{- end }}
12+
{{- if $.Values.commonAnnotations }}
13+
annotations:
14+
{{- toYaml $.Values.commonAnnotations | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
schedule: {{ .schedule | quote }}
18+
successfulJobsHistoryLimit: 2
19+
concurrencyPolicy: Forbid
20+
failedJobsHistoryLimit: 1
21+
suspend: {{ .suspend }}
22+
jobTemplate:
23+
spec:
24+
template:
25+
metadata:
26+
labels: {{- include "api.selectorLabels" $ | nindent 12 }}
27+
spec:
28+
{{- include "fastapi.imagePullSecrets" $ | nindent 10 }}
29+
containers:
30+
- name: "{{ $.Chart.Name }}-{{ .name }}"
31+
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
32+
imagePullPolicy: {{ $.Values.image.pullPolicy }}
33+
env:
34+
- name: "WARREN_SERVER_HOST"
35+
value: {{ include "api.fullname" $ }}
36+
{{- include "api.envs" $ | nindent 16 }}
37+
command: {{ .command | toJson }}
38+
{{- if $.Values.resources }}
39+
resources: {{ toYaml $.Values.resources | nindent 16 }}
40+
{{- end }}
41+
volumeMounts:
42+
- name: logging-config
43+
mountPath: "/etc/warren/api"
44+
volumes:
45+
- name: logging-config
46+
configMap:
47+
name: "warren-api-logging-config"
48+
restartPolicy: Never
49+
{{- end }}

src/helm/warren/charts/api/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ fastapi:
8989
lrs:
9090
host: "http://lrs-ralph:8080"
9191
username: "admin"
92+
xi:
93+
lmsBaseUrl: "http://my-moodle-instance"
94+
defaultLang: "fr"
9295
command:
9396
- "uvicorn"
9497
- "warren.api:app"
@@ -102,6 +105,18 @@ fastapi:
102105
jobs:
103106
- name: dbmigrate
104107
command: ["warren", "migration", "upgrade", "head"]
108+
cronjobs: []
109+
# Cronjobs should define a name, a schedule, the schedule suspension
110+
# and a command to execute, e.g.
111+
# - name: "index-moodle"
112+
# schedule: "0 1 * * *"
113+
# suspend: false
114+
# command:
115+
# - "warren"
116+
# - "xi"
117+
# - "index"
118+
# - "all"
119+
# - "--ignore-errors"
105120
resources: {}
106121

107122
loggingConfig:

src/helm/warren/charts/app/templates/NOTES.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
1. Get the application URL by running these commands:
1+
CHART NAME: {{ .Chart.Name }}
2+
CHART VERSION: {{ .Chart.Version }}
3+
APP VERSION: {{ .Chart.AppVersion }}
4+
5+
** Please be patient while the chart is being deployed **
6+
7+
1. Access your Warren app installation:
28
{{- if .Values.ingress.enabled }}
3-
{{- range $host := .Values.ingress.host }}
4-
{{- range .paths }}
5-
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
9+
Connect to one of the following hosts:
10+
{{ if .Values.ingress.tls }}
11+
https://{{ .Values.ingress.host }}
12+
{{- else }}
13+
http://{{ .Values.ingress.host }}
614
{{- end }}
7-
{{- end }}
815
{{- else if contains "NodePort" .Values.service.type }}
916
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "app.fullname" . }})
1017
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11-
echo http://$NODE_IP:$NODE_PORT
18+
echo "Warren APP URL: http://$NODE_IP:$NODE_PORT"
1219
{{- else if contains "LoadBalancer" .Values.service.type }}
1320
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
1421
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "app.fullname" . }}'

0 commit comments

Comments
 (0)