Skip to content

Commit

Permalink
fixup! 🔧(helm) rework chart based on jenny helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
wilbrdt committed Jun 7, 2024
1 parent 5167a9a commit a9661b3
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 13 deletions.
21 changes: 14 additions & 7 deletions src/helm/warren/charts/api/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
1. Get the application URL by running these commands:
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

1. Access your Warren api installation:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.host }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
Connect to one of the following hosts:
{{ if .Values.ingress.tls }}
https://{{ .Values.ingress.host }}
{{- else }}
http://{{ .Values.ingress.host }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "api.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
echo "Warren API URL: http://$NODE_IP:$NODE_PORT"
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "api.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "api.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
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}")
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}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
9 changes: 9 additions & 0 deletions src/helm/warren/charts/api/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ Environment variables
secretKeyRef:
name: warren-api-lrs
key: WARREN_LRS_AUTH_BASIC_PASSWORD
- name: "WARREN_XI_LMS_BASE_URL"
value: "{{ .Values.fastapi.xi.lmsBaseUrl }}"
- name: "WARREN_XI_LMS_API_TOKEN"
valueFrom:
secretKeyRef:
name: warren-api-lms
key: WARREN_XI_LMS_API_TOKEN
- name: "WARREN_XI_DEFAULT_LANG"
value: "{{ .Values.fastapi.xi.defaultLang }}"
- name: "WARREN_APP_SIGNING_ALGORITHM"
value: "{{ .Values.fastapi.signingAlgorithm }}"
- name: "WARREN_APP_SIGNING_KEY"
Expand Down
49 changes: 49 additions & 0 deletions src/helm/warren/charts/api/templates/cronjobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{- range .Values.fastapi.cronjobs }}
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "api.fullname" $ }}-{{ .name }}
namespace: {{ $.Release.Namespace | quote }}
labels: {{- include "api.labels" $ | nindent 4 }}
{{- if $.Values.commonLabels }}
{{ toYaml $.Values.commonLabels | nindent 4 }}
{{- end }}
{{- if $.Values.commonAnnotations }}
annotations:
{{- toYaml $.Values.commonAnnotations | nindent 4 }}
{{- end }}
spec:
schedule: {{ .schedule | quote }}
successfulJobsHistoryLimit: 2
concurrencyPolicy: Forbid
failedJobsHistoryLimit: 1
suspend: {{ .suspend }}
jobTemplate:
spec:
template:
metadata:
labels: {{- include "api.selectorLabels" $ | nindent 12 }}
spec:
{{- include "fastapi.imagePullSecrets" $ | nindent 10 }}
containers:
- name: "{{ $.Chart.Name }}-{{ .name }}"
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
imagePullPolicy: {{ $.Values.image.pullPolicy }}
env:
- name: "WARREN_SERVER_HOST"
value: {{ include "api.fullname" $ }}
{{- include "api.envs" $ | nindent 16 }}
command: {{ .command | toJson }}
{{- if $.Values.resources }}
resources: {{ toYaml $.Values.resources | nindent 16 }}
{{- end }}
volumeMounts:
- name: logging-config
mountPath: "/etc/warren/api"
volumes:
- name: logging-config
configMap:
name: "warren-api-logging-config"
restartPolicy: Never
{{- end }}
15 changes: 15 additions & 0 deletions src/helm/warren/charts/api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ fastapi:
lrs:
host: "http://lrs-ralph:8080"
username: "admin"
xi:
lmsBaseUrl: "http://my-moodle-instance"
defaultLang: "fr"
command:
- "uvicorn"
- "warren.api:app"
Expand All @@ -102,6 +105,18 @@ fastapi:
jobs:
- name: dbmigrate
command: ["warren", "migration", "upgrade", "head"]
cronjobs: []
# Cronjobs should define a name, a schedule, the schedule suspension
# and a command to execute, e.g.
# - name: "index-moodle"
# schedule: "0 1 * * *"
# suspend: false
# command:
# - "warren"
# - "xi"
# - "index"
# - "all"
# - "--ignore-errors"
resources: {}

loggingConfig:
Expand Down
19 changes: 13 additions & 6 deletions src/helm/warren/charts/app/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
1. Get the application URL by running these commands:
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

1. Access your Warren app installation:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.host }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
Connect to one of the following hosts:
{{ if .Values.ingress.tls }}
https://{{ .Values.ingress.host }}
{{- else }}
http://{{ .Values.ingress.host }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "app.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
echo "Warren APP URL: http://$NODE_IP:$NODE_PORT"
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "app.fullname" . }}'
Expand Down

0 comments on commit a9661b3

Please sign in to comment.