Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jenny's Helm chart #5

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Add Jenny's Helm chart #5

wants to merge 14 commits into from

Conversation

claudusd
Copy link

This PR add the Helm chart from Jenny. A Django base app.

@claudusd claudusd requested a review from wilbrdt May 15, 2024 12:38
@claudusd claudusd changed the title Improve jenny chart Add Jenny's Helm chart May 15, 2024
Copy link

@wilbrdt wilbrdt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, really good model!
A few general remarks:

  • some files are missing an EOF newline
  • labels and annotations seem a bit inconsistent, which makes them harder to use

{{- include "jenny.envs" . | nindent 12 }}
- name: "UWSGI_PORT"
value: "{{ .Values.django.port }}"
{{- if .Values.persistence.enabled }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would align this with its closing {{- end }}, for readability. WDYT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove this part.

port: {{ .Values.django.port }}
httpHeaders:
- name: "Host"
value: "{{ .Values.ingress.host}}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ingress should have a default host value

service: app
{{- end }}

{{- define "jenny.envs" -}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
{{- define "jenny.envs" -}}
{{/*
Environment variables
*/}}
{{- define "jenny.envs" -}}

{{- end }}
{{- end }}

{{- define "django.imagePullSecrets" -}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
{{- define "django.imagePullSecrets" -}}
{{/*
ImagePullSecrets
*/}}
{{- define "django.imagePullSecrets" -}}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇 nice work, thanks! 🙏

{{- if $.Values.commonLabels }}
{{ toYaml $.Values.commonLabels | nindent 4 }}
{{- end }}
app.kubernetes.io/component: jenny
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this label used for?
If useful, could we use a helper definition to specify it?

- "jenny-app"
topologyKey: kubernetes.io/hostname

autoscaling:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we provide a HorizontalPodAutoscaler?

value: "{{ .Values.django.db.host }}"
- name: "DB_PORT"
value: "{{ .Values.django.db.port }}"
{{- range $key, $val := .Values.env.secret }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When linting this chart, a warning seems to be raised because of this line. It is resolved when adding an empty default value as so:

env:
  secret: []

podAnnotations: {}

service:
port: 8080
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This service port isn't used by any template, should it be removed?

Comment on lines +3 to +4
metadata:
name: "{{ template "jenny.fullname" . }}-nginx"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're missing common labels and annotations here. Is that OK?

wilbrdt added a commit to openfun/warren that referenced this pull request May 17, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
wilbrdt added a commit to openfun/warren that referenced this pull request May 17, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
wilbrdt added a commit to openfun/warren that referenced this pull request May 17, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
wilbrdt added a commit to openfun/warren that referenced this pull request May 21, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
items:
- key: config
path: nginx.conf
name: "{{ .Chart.Name }}-nginx"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "{{ .Chart.Name }}-nginx"
name: "{{ template "jenny.fullname" . }}-nginx"

Comment on lines 30 to 34
command:
- "python"
- "manage.py"
- "collectstatic"
- "--no-input"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the Django SECRET_KEY is needed to execute this command.
We should probably add the env variables to the initContainer. WDYT?

{{- end }}
spec:
ingressClassName: {{ .Values.ingress.class_name }}
{{- if $.Values.ingress.tls.enable }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{- if $.Values.ingress.tls.enable }}
{{- if $.Values.ingress.tls.enabled }}

claudusd added 10 commits May 22, 2024 11:21
Ingore the tgz build with the command helm package.
This annotations need to be add to use the
cert-manager for certificate request.
The host is not mandatory in the ingress definition
but for an HTTP app it's a best pratice to use an
host instead of an IP. And the host is mandatory for
HTTPS.
Add the possibility to enable the HTTPS
and to set the certificate name.
The Jenny image is build to ensure the user
cannot write in the app dir. Allow to change the
running user is not required.
Django required to collect the static and
service with a HTTP server. We add an Nginx
container in the pods and add an init container
to collect this statics. And use an ephemeral
volume for static instead of a persistent one.
Fix when create a list of job in the same template and
ensure to run the job after the install to avoid missing
resource.
This allow from the values to add environment
variable from secret to configure Jenny's app.
Ensure to ingore previous helm package
in the next helm package.
For the Django app we use the hearbeat add by the
lib dockerflow for the liveness and readiness probes
Use Nginx status page for liveness probe.
And check migration for the startup probe.
wilbrdt added a commit to openfun/warren that referenced this pull request May 29, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
Comment on lines 48 to 49
allow 127.0.0.1;
deny all;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allow 127.0.0.1;
deny all;

wilbrdt added a commit to openfun/warren that referenced this pull request Jun 7, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
wilbrdt added a commit to openfun/warren that referenced this pull request Jul 4, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
wilbrdt added a commit to openfun/warren that referenced this pull request Aug 22, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
wilbrdt added a commit to openfun/warren that referenced this pull request Sep 26, 2024
Rework Warren Helm chart based on the work done on Jenny Helm chart in PR
openfun/charts#5
Changes done in this commit:
- Jobs for database migration or static collection are abstracted into a single
  job template
- Env variables are now processed in the helper template
- Removed unused HorizontalPodAutoscaler
- Add startup probes for migration checks
- Migration jobs are now executed post helm installation/upgrade
- Removed unnecessary security context variables
- Add a nginx container alongside warren-app to serve static files
- Rework postgresql values to have a functional Helm chart on a local cluster
- Update Helm chart README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants