Skip to content

Commit 9ab1255

Browse files
committed
fixup! 🔧(helm) rework chart based on jenny helm chart
1 parent c032dca commit 9ab1255

22 files changed

+186
-118
lines changed

src/helm/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ Ralph is also distributed as a Helm chart. Check out the [Ralph Helm chart READM
106106

107107
### Deploy the dashboard suite: Warren
108108

109-
Let's create secrets needed for Warren deployment with:
109+
Let's create the secrets needed for Warren deployment:
110110
```bash
111-
kubectl create secret generic warren-api-secrets --from-env-file=warren/charts/api/.secret
112-
kubectl create secret generic warren-app-secrets --from-env-file=warren/charts/app/.secret
111+
kubectl apply -f manifests/warren-app-secrets.yaml
112+
kubectl apply -f manifests/warren-api-secrets.yaml
113113
```
114114

115115
We can now deploy Warren along with its dependencies
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: warren-api-db
6+
type: Opaque
7+
stringData:
8+
WARREN_API_DB_PASSWORD: pass
9+
---
10+
apiVersion: v1
11+
kind: Secret
12+
metadata:
13+
name: warren-api-lrs
14+
type: Opaque
15+
stringData:
16+
WARREN_LRS_AUTH_BASIC_PASSWORD: password
17+
---
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: warren-app-db
6+
type: Opaque
7+
stringData:
8+
WARREN_APP_DB_PASSWORD: pass
9+
---
10+
apiVersion: v1
11+
kind: Secret
12+
metadata:
13+
name: warren-app-secret-key
14+
type: Opaque
15+
stringData:
16+
WARREN_APP_SECRET_KEY: change_me_please
17+
---
18+
apiVersion: v1
19+
kind: Secret
20+
metadata:
21+
name: warren-signing-key
22+
type: Opaque
23+
stringData:
24+
WARREN_APP_SIGNING_KEY: change_me
25+
---

src/helm/warren/charts/api/.secret

Lines changed: 0 additions & 3 deletions
This file was deleted.

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.hosts }}
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: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Selector labels
4848
{{- define "api.selectorLabels" -}}
4949
app.kubernetes.io/name: {{ include "api.name" . }}
5050
app.kubernetes.io/instance: {{ .Release.Name }}
51+
app.kubernetes.io/component: api
52+
app.kubernetes.io/part-of: warren
5153
{{- end }}
5254

5355
{{/*
@@ -63,7 +65,7 @@ Environment variables
6365
- name: "WARREN_API_DB_PASSWORD"
6466
valueFrom:
6567
secretKeyRef:
66-
name: warren-api-secrets
68+
name: warren-api-db
6769
key: WARREN_API_DB_PASSWORD
6870
- name: "WARREN_API_DB_ENGINE"
6971
value: "{{ .Values.fastapi.db.engine }}"
@@ -74,20 +76,29 @@ Environment variables
7476
- name: "WARREN_ALLOWED_HOSTS"
7577
value: {{ printf "%q" .Values.fastapi.allowedHosts | replace " " "," | quote }}
7678
- name: "WARREN_LRS_HOSTS"
77-
value: "{{ .Values.fastapi.lrs.hosts }}"
79+
value: "{{ .Values.fastapi.lrs.host }}"
7880
- name: "WARREN_LRS_AUTH_BASIC_USERNAME"
7981
value: "{{ .Values.fastapi.lrs.username }}"
8082
- name: "WARREN_LRS_AUTH_BASIC_PASSWORD"
8183
valueFrom:
8284
secretKeyRef:
83-
name: warren-api-secrets
85+
name: warren-api-lrs
8486
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 }}"
8596
- name: "WARREN_APP_SIGNING_ALGORITHM"
8697
value: "{{ .Values.fastapi.signingAlgorithm }}"
8798
- name: "WARREN_APP_SIGNING_KEY"
8899
valueFrom:
89100
secretKeyRef:
90-
name: warren-api-secrets
101+
name: warren-signing-key
91102
key: WARREN_APP_SIGNING_KEY
92103
{{- range $key, $val := .Values.env.secret }}
93104
- name: {{ $val.envName }}

src/helm/warren/charts/api/templates/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: ConfigMap
33
metadata:
4-
name: "{{ template "api.fullname" . }}-logging-config"
4+
name: "{{ include "api.fullname" . }}-logging-config"
55
labels:
66
{{- include "api.labels" . | nindent 4 }}
77
data:
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: {{ include "api.fullname" $ }}-logging-config
48+
restartPolicy: Never
49+
{{- end }}

src/helm/warren/charts/api/templates/deployment.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ spec:
3131
livenessProbe:
3232
httpGet:
3333
path: /__heartbeat__
34-
port: http
34+
port: {{ .Values.fastapi.port }}
3535
initialDelaySeconds: 15
3636
periodSeconds: 30
3737
readinessProbe:
3838
httpGet:
3939
path: /__lbheartbeat__
40-
port: http
40+
port: {{ .Values.fastapi.port }}
4141
initialDelaySeconds: 5
4242
periodSeconds: 5
4343
startupProbe:
@@ -48,7 +48,7 @@ spec:
4848
- "warren migration check"
4949
initialDelaySeconds: 5
5050
periodSeconds: 5
51-
timeoutSeconds: 120
51+
timeoutSeconds: 30
5252
env:
5353
{{- include "api.envs" . | nindent 12 }}
5454
{{ with .Values.fastapi.command }}
@@ -61,7 +61,7 @@ spec:
6161
volumes:
6262
- name: logging-config
6363
configMap:
64-
name: "warren-api-logging-config"
64+
name: {{ include "api.fullname" . }}-logging-config
6565
{{- with .Values.nodeSelector }}
6666
nodeSelector:
6767
{{- toYaml . | nindent 8 }}

src/helm/warren/charts/api/templates/ingress.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:
5-
name: {{ template "api.fullname" . }}-ingress
5+
name: {{ template "api.fullname" . }}
66
labels: {{- include "api.labels" . | nindent 4 }}
77
{{- if .Values.commonLabels }}
88
{{ toYaml .Values.commonLabels | nindent 4 }}
99
{{- end }}
10-
app.kubernetes.io/component: fastapi
1110
annotations:
1211
{{- if .Values.commonAnnotations }}
1312
{{- toYaml .Values.commonAnnotations | nindent 4 }}
@@ -17,11 +16,11 @@ metadata:
1716
{{- end }}
1817
spec:
1918
ingressClassName: {{ .Values.ingress.className }}
20-
{{- if $.Values.ingress.tls.enable }}
19+
{{- if $.Values.ingress.tls.enabled }}
2120
tls:
2221
- hosts:
2322
- {{ $.Values.ingress.host }}
24-
secretName: {{ $.Values.ingress.tls.certificateSecretName }}
23+
secretName: {{ $.Values.ingress.tls.certificateSecretName }}
2524
{{- end }}
2625
rules:
2726
- host: {{ .Values.ingress.host }}
@@ -31,7 +30,7 @@ spec:
3130
pathType: Prefix
3231
backend:
3332
service:
34-
name: {{ include "api.fullname" . }}-service
33+
name: {{ include "api.fullname" . }}
3534
port:
3635
number: {{ .Values.service.port }}
3736
{{- end }}

0 commit comments

Comments
 (0)