Compare commits
28 commits
Author | SHA1 | Date | |
---|---|---|---|
|
4c7256e5c9 | ||
![]() |
74288199f6 | ||
![]() |
af39eedea8 | ||
![]() |
8f7dcc0a74 | ||
![]() |
8358d4a9f6 | ||
![]() |
c025d66347 | ||
![]() |
e07bd0e7ce | ||
![]() |
85fa6fb881 | ||
![]() |
0d5921af5e | ||
![]() |
0198481d94 | ||
![]() |
78eb71eb37 | ||
![]() |
3099e678fc | ||
![]() |
466648631f | ||
![]() |
ab1ff087d2 | ||
![]() |
01748f59da | ||
![]() |
95717ec228 | ||
![]() |
98f6e139ee | ||
![]() |
72573d978c | ||
![]() |
82b457b9da | ||
![]() |
bad619b441 | ||
![]() |
0e92508ac3 | ||
![]() |
7144d26954 | ||
![]() |
788906385b | ||
![]() |
ccfcb1bc23 | ||
![]() |
ae6a678c8e | ||
![]() |
2fc2751d75 | ||
![]() |
9960f52561 | ||
![]() |
44ed6ba81f |
9
CHANGELOG.md
Normal file
9
CHANGELOG.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
No release is stable. Do not use in production.
|
||||||
|
|
||||||
|
# Unreleased
|
||||||
|
|
||||||
|
# 1.0.0
|
||||||
|
|
||||||
|
- Add volume mounts
|
||||||
|
- Latest major postgres/redis versions
|
||||||
|
- Rename preInstall to migrateJob
|
|
@ -1,9 +1,9 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: postgresql
|
- name: postgresql
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 11.7.3
|
version: 15.5.16
|
||||||
- name: redis
|
- name: redis
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 17.0.11
|
version: 19.6.1
|
||||||
digest: sha256:3f28c6b57295af8d15bde8ddb31795f63e4da411c8d0dae232d0dc6b0e232f23
|
digest: sha256:5e21575062cdcef4e947b4f89741e95138d93207f91d5074d53397d9c414f0a1
|
||||||
generated: "2022-08-19T11:06:28.600412225-04:00"
|
generated: "2024-07-15T13:58:06.767935373-04:00"
|
||||||
|
|
|
@ -14,7 +14,7 @@ type: application
|
||||||
|
|
||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
version: 0.2.1
|
version: 1.0.0
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application.
|
# incremented each time you make changes to the application.
|
||||||
|
@ -22,10 +22,10 @@ appVersion: 1.0.0
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: postgresql
|
- name: postgresql
|
||||||
version: ~11.7.2
|
version: ^15.5.16
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
condition: postgresql.enabled
|
condition: postgresql.enabled
|
||||||
- name: redis
|
- name: redis
|
||||||
version: ~17.0.11
|
version: ^19.6.1
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
condition: redis.enabled
|
condition: redis.enabled
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Django Helm Chart
|
# Django Helm Chart
|
||||||
|
|
||||||
A generic Django (plus Celery) Helm chart.
|
A generic Django (plus Celery) Helm chart demonstration. Do not use directly in production.
|
||||||
|
|
||||||
Contributions are welcome as merge requests. Please only open issues that you'd like to implement yourself or fund. Do not open support or feature requests. This chart is **not** intended to cover every use case with Django and Helm. It's a personal project that you are welcome to view and fork. Breaking changes to your workflow may happen at any time and without warning.
|
Contributions may be accepted as merge requests. Be respectful of my time. I will not review if I do not have time. Fork the project instead. Please only open issues that you'd like to implement yourself or fund. Do not open support or feature requests. This chart is **not** intended to cover every use case with Django and Helm. It's a personal project that you are welcome to view and fork. Breaking changes to your workflow may happen at any time and without warning.
|
||||||
|
|
||||||
# Preparing your Django app
|
# Preparing your Django app
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ Remember that Kubernetes "args" are Docker's CMD (or command). Pretty confusing!
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
|
Use only for demonstration purposes. Fork the repo for production.
|
||||||
|
|
||||||
1. Add our Helm chart repo `helm repo add django https://gitlab.com/api/v4/projects/26807467/packages/helm/stable`
|
1. Add our Helm chart repo `helm repo add django https://gitlab.com/api/v4/projects/26807467/packages/helm/stable`
|
||||||
2. Review our values.yaml. At a minimum you'll need to set env.secret.SECRET_KEY and env.secret.DATABASE_URL.
|
2. Review our values.yaml. At a minimum you'll need to set env.secret.SECRET_KEY and env.secret.DATABASE_URL.
|
||||||
3. Install the chart `helm install your-app django/django -f your-values.yml`
|
3. Install the chart `helm install your-app django/django -f your-values.yml`
|
||||||
|
@ -56,6 +58,7 @@ I suggest either
|
||||||
- Keep them in a values.yml file in a private repo
|
- Keep them in a values.yml file in a private repo
|
||||||
- Make use of --reuse-values and --set
|
- Make use of --reuse-values and --set
|
||||||
- Keep them in a non helm chart managed service
|
- Keep them in a non helm chart managed service
|
||||||
|
- Use the opentofu helm provider, with a secure state backend or encrypted state.
|
||||||
|
|
||||||
## Deploying in CI
|
## Deploying in CI
|
||||||
|
|
||||||
|
@ -69,3 +72,5 @@ Maintaining this chart takes time. Considering supporting it by
|
||||||
- Check out [GlitchTip](https://glitchtip.com) error tracking, which is where this project started
|
- Check out [GlitchTip](https://glitchtip.com) error tracking, which is where this project started
|
||||||
|
|
||||||
Commercial support is available - email info@burkesoftware.com
|
Commercial support is available - email info@burkesoftware.com
|
||||||
|
|
||||||
|
If you want the scope of this project to include more, such as better merge request review or stable releases. You should consider forking it, talk to me about being a maintainer, or fund it.
|
||||||
|
|
Binary file not shown.
BIN
charts/postgresql-15.5.16.tgz
Normal file
BIN
charts/postgresql-15.5.16.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
charts/redis-19.6.1.tgz
Normal file
BIN
charts/redis-19.6.1.tgz
Normal file
Binary file not shown.
12
templates/_tplvalues.tpl
Normal file
12
templates/_tplvalues.tpl
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{{/*
|
||||||
|
Renders a value that contains template.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.tplvalues.render" -}}
|
||||||
|
{{- if typeIs "string" .value }}
|
||||||
|
{{- tpl .value .context }}
|
||||||
|
{{- else }}
|
||||||
|
{{- tpl (.value | toYaml) .context }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
|
@ -19,6 +19,9 @@ spec:
|
||||||
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||||
tag: "{{ .Values.image.tag }}"
|
tag: "{{ .Values.image.tag }}"
|
||||||
|
{{- if .Values.beat.podAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.beat.podAnnotations "context" $ ) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "django.selectorLabels" . | nindent 8 }}
|
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||||
app.kubernetes.io/component: beat
|
app.kubernetes.io/component: beat
|
||||||
|
@ -39,12 +42,7 @@ spec:
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
resources:
|
resources:
|
||||||
limits:
|
{{- toYaml .Values.beat.resources | nindent 12 }}
|
||||||
cpu: 50m
|
|
||||||
memory: 96Mi
|
|
||||||
requests:
|
|
||||||
cpu: 1m
|
|
||||||
memory: 32Mi
|
|
||||||
env:
|
env:
|
||||||
- name: SERVER_ROLE
|
- name: SERVER_ROLE
|
||||||
value: "beat"
|
value: "beat"
|
||||||
|
@ -52,14 +50,22 @@ spec:
|
||||||
- name: DATABASE_PASSWORD
|
- name: DATABASE_PASSWORD
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ include "django.postgresql.fullname" . }}
|
name: {{ default (include "django.postgresql.fullname" .) .Values.postgresql.auth.existingSecret }}
|
||||||
key: postgres-password
|
key: postgres-password
|
||||||
{{- end }}
|
{{- end }}
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: {{ include "django.fullname" . }}
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: {{ include "django.fullname" . }}
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- with .Values.extraVolumeMounts }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
{{- with .Values.beat.nodeSelector }}
|
{{- with .Values.beat.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
|
@ -72,5 +78,9 @@ spec:
|
||||||
tolerations:
|
tolerations:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.extraVolumes }}
|
||||||
|
volumes:
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
72
templates/flower/deployment.yaml
Normal file
72
templates/flower/deployment.yaml
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
{{- if .Values.flower.enabled -}}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "django.fullname" . }}-flower
|
||||||
|
labels:
|
||||||
|
{{- include "django.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: flower
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "django.selectorLabels" . | nindent 6 }}
|
||||||
|
app.kubernetes.io/component: flower
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||||
|
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||||
|
{{- if .Values.flower.podAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.flower.podAnnotations "context" $ ) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||||
|
app.kubernetes.io/component: flower
|
||||||
|
spec:
|
||||||
|
{{- with .Values.flower.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
{{- if .Values.flower.args }}
|
||||||
|
args: {{- toYaml .Values.flower.args | nindent 10}}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.flower.image.repository }}:{{ .Values.flower.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.flower.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- containerPort: 5555
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.flower.resources | nindent 12 }}
|
||||||
|
env:
|
||||||
|
- name: SERVER_ROLE
|
||||||
|
value: "flower"
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- with .Values.flower.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.flower.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.flower.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
66
templates/flower/ingress.yaml
Normal file
66
templates/flower/ingress.yaml
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{{- if .Values.flower.ingress.enabled -}}
|
||||||
|
{{- $fullName := include "django.fullname" . -}}
|
||||||
|
{{- $svcPort := .Values.flower.service.port -}}
|
||||||
|
{{- if and .Values.flower.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||||
|
{{- if not (hasKey .Values.flower.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||||
|
{{- $_ := set .Values.flower.ingress.annotations "kubernetes.io/ingress.class" .Values.flower.ingress.className}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
apiVersion: networking.k8s.io/v1beta1
|
||||||
|
{{- else -}}
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
{{- end }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $fullName }}-flower
|
||||||
|
labels:
|
||||||
|
{{- include "django.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.flower.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if and .Values.flower.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||||
|
ingressClassName: {{ .Values.flower.ingress.className }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.flower.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.flower.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.flower.ingress.hosts }}
|
||||||
|
- host: {{ .host | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ .path }}
|
||||||
|
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||||
|
pathType: {{ .pathType }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .backend }}
|
||||||
|
backend:
|
||||||
|
{{- toYaml .backend | nindent 14 }}
|
||||||
|
{{- else }}
|
||||||
|
backend:
|
||||||
|
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||||
|
service:
|
||||||
|
name: {{ $fullName }}-flower
|
||||||
|
port:
|
||||||
|
number: {{ $svcPort }}
|
||||||
|
{{- else }}
|
||||||
|
serviceName: {{ $fullName }}
|
||||||
|
servicePort: {{ $svcPort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
18
templates/flower/service.yaml
Normal file
18
templates/flower/service.yaml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{{- if .Values.flower.enabled -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "django.fullname" . }}-flower
|
||||||
|
labels:
|
||||||
|
{{- include "django.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.flower.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.flower.service.port }}
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
{{- include "django.selectorLabels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: flower
|
||||||
|
{{- end }}
|
66
templates/migrate-job.yaml
Normal file
66
templates/migrate-job.yaml
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{{- if .Values.migrationJob.enabled -}}
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: {{ include "django.fullname" . }}-migrate
|
||||||
|
labels:
|
||||||
|
{{- include "django.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": post-install,pre-upgrade
|
||||||
|
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||||
|
"helm.sh/hook-weight": "0"
|
||||||
|
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||||
|
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||||
|
tag: "{{ .Values.image.tag }}"
|
||||||
|
spec:
|
||||||
|
activeDeadlineSeconds: {{ default 900 .Values.migrationJob.activeDeadlineSeconds }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: migrate-job
|
||||||
|
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "django.serviceAccountName" . }}
|
||||||
|
restartPolicy: Never
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: migrate-job
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
{{- if .Values.migrationJob.resources }}
|
||||||
|
resources: {{ toYaml .Values.migrationJob.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
command: {{ .Values.migrationJob.command | default (list "./manage.py" "migrate") | toJson }}
|
||||||
|
env:
|
||||||
|
{{- if .Values.postgresql.enabled }}
|
||||||
|
- name: DATABASE_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ default (include "django.postgresql.fullname" .) .Values.postgresql.auth.existingSecret }}
|
||||||
|
key: postgres-password
|
||||||
|
{{- end }}
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- with .Values.extraVolumeMounts }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.extraVolumes }}
|
||||||
|
volumes:
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -1,50 +0,0 @@
|
||||||
apiVersion: batch/v1
|
|
||||||
kind: Job
|
|
||||||
metadata:
|
|
||||||
name: {{ include "django.fullname" . }}
|
|
||||||
labels:
|
|
||||||
{{- include "django.labels" . | nindent 4 }}
|
|
||||||
annotations:
|
|
||||||
"helm.sh/hook": post-install,pre-upgrade
|
|
||||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
|
||||||
"helm.sh/hook-weight": "0"
|
|
||||||
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
|
||||||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
||||||
tag: "{{ .Values.image.tag }}"
|
|
||||||
spec:
|
|
||||||
activeDeadlineSeconds: 600
|
|
||||||
template:
|
|
||||||
spec:
|
|
||||||
{{- with .Values.imagePullSecrets }}
|
|
||||||
imagePullSecrets:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
restartPolicy: Never
|
|
||||||
containers:
|
|
||||||
- name: pre-install-job
|
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
||||||
command: ["./manage.py","migrate"]
|
|
||||||
env:
|
|
||||||
- name: DEBUG
|
|
||||||
value: "False"
|
|
||||||
{{- if .Values.env.secret.DATABASE_URL }}
|
|
||||||
- name: DATABASE_URL
|
|
||||||
value: {{ .Values.env.secret.DATABASE_URL }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.postgresql.enabled }}
|
|
||||||
- name: DATABASE_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ include "django.postgresql.fullname" . }}
|
|
||||||
key: postgres-password
|
|
||||||
{{- end }}
|
|
||||||
- name: SECRET_KEY
|
|
||||||
value: {{ required "env.secret.SECRET_KEY is a required value." .Values.env.secret.SECRET_KEY }}
|
|
||||||
{{- range $k, $v := .Values.env.normal }}
|
|
||||||
- name: {{ $k }}
|
|
||||||
value: {{ $v | quote }}
|
|
||||||
{{- end }}
|
|
||||||
envFrom:
|
|
||||||
- configMapRef:
|
|
||||||
name: {{ include "django.fullname" . }}
|
|
|
@ -19,6 +19,9 @@ spec:
|
||||||
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||||
tag: "{{ .Values.image.tag }}"
|
tag: "{{ .Values.image.tag }}"
|
||||||
|
{{- if .Values.web.podAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.web.podAnnotations "context" $ ) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "django.selectorLabels" . | nindent 8 }}
|
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||||
app.kubernetes.io/component: web
|
app.kubernetes.io/component: web
|
||||||
|
@ -74,8 +77,16 @@ spec:
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: {{ include "django.fullname" . }}
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: {{ include "django.fullname" . }}
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- with .Values.extraVolumeMounts }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
{{- with .Values.web.nodeSelector }}
|
{{- with .Values.web.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
|
@ -88,3 +99,7 @@ spec:
|
||||||
tolerations:
|
tolerations:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.extraVolumes }}
|
||||||
|
volumes:
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
|
@ -1,5 +1,5 @@
|
||||||
{{- if .Values.web.autoscaling.enabled -}}
|
{{- if .Values.web.autoscaling.enabled -}}
|
||||||
apiVersion: autoscaling/v2beta1
|
apiVersion: autoscaling/v2
|
||||||
kind: HorizontalPodAutoscaler
|
kind: HorizontalPodAutoscaler
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "django.fullname" . }}-web
|
name: {{ template "django.fullname" . }}-web
|
||||||
|
@ -13,16 +13,20 @@ spec:
|
||||||
minReplicas: {{ .Values.web.autoscaling.minReplicas }}
|
minReplicas: {{ .Values.web.autoscaling.minReplicas }}
|
||||||
maxReplicas: {{ .Values.web.autoscaling.maxReplicas }}
|
maxReplicas: {{ .Values.web.autoscaling.maxReplicas }}
|
||||||
metrics:
|
metrics:
|
||||||
{{- if .Values.web.autoscaling.targetCPUUtilizationPercentage }}
|
{{- if .Values.web.autoscaling.targetCPU }}
|
||||||
- type: Resource
|
- type: Resource
|
||||||
resource:
|
resource:
|
||||||
name: cpu
|
name: cpu
|
||||||
targetAverageUtilization: {{ .Values.web.autoscaling.targetCPUUtilizationPercentage }}
|
target:
|
||||||
|
type: "Utilization"
|
||||||
|
averageUtilization: {{ .Values.web.autoscaling.targetCPU }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.web.autoscaling.targetMemoryUtilizationPercentage }}
|
{{- if .Values.web.autoscaling.targetMemory }}
|
||||||
- type: Resource
|
- type: Resource
|
||||||
resource:
|
resource:
|
||||||
name: memory
|
name: memory
|
||||||
targetAverageUtilization: {{ .Values.web.autoscaling.targetMemoryUtilizationPercentage }}
|
target:
|
||||||
|
type: "Utilization"
|
||||||
|
averageUtilization: {{ .Values.web.autoscaling.targetMemory }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -18,6 +18,9 @@ spec:
|
||||||
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||||
tag: "{{ .Values.image.tag }}"
|
tag: "{{ .Values.image.tag }}"
|
||||||
|
{{- if .Values.worker.podAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.worker.podAnnotations "context" $ ) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "django.selectorLabels" . | nindent 8 }}
|
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||||
app.kubernetes.io/component: worker
|
app.kubernetes.io/component: worker
|
||||||
|
@ -26,6 +29,7 @@ spec:
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "django.serviceAccountName" . }}
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
containers:
|
containers:
|
||||||
|
@ -37,6 +41,10 @@ spec:
|
||||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
{{- if .Values.worker.livenessProbe }}
|
||||||
|
livenessProbe:
|
||||||
|
{{- .Values.worker.livenessProbe | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.worker.resources | nindent 12 }}
|
{{- toYaml .Values.worker.resources | nindent 12 }}
|
||||||
env:
|
env:
|
||||||
|
@ -46,14 +54,22 @@ spec:
|
||||||
- name: DATABASE_PASSWORD
|
- name: DATABASE_PASSWORD
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ include "django.postgresql.fullname" . }}
|
name: {{ default (include "django.postgresql.fullname" .) .Values.postgresql.auth.existingSecret }}
|
||||||
key: postgres-password
|
key: postgres-password
|
||||||
{{- end }}
|
{{- end }}
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: {{ include "django.fullname" . }}
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: {{ include "django.fullname" . }}
|
name: {{ include "django.fullname" . }}
|
||||||
|
{{- with .Values.extraVolumeMounts }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
{{- with .Values.worker.nodeSelector }}
|
{{- with .Values.worker.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
|
@ -66,4 +82,8 @@ spec:
|
||||||
tolerations:
|
tolerations:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.extraVolumes }}
|
||||||
|
volumes:
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{- if .Values.worker.autoscaling.enabled -}}
|
{{- if .Values.worker.autoscaling.enabled -}}
|
||||||
apiVersion: autoscaling/v2beta1
|
apiVersion: autoscaling/v2
|
||||||
kind: HorizontalPodAutoscaler
|
kind: HorizontalPodAutoscaler
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "django.fullname" . }}-worker
|
name: {{ template "django.fullname" . }}-worker
|
||||||
|
@ -13,16 +13,20 @@ spec:
|
||||||
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
|
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
|
||||||
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
|
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
|
||||||
metrics:
|
metrics:
|
||||||
{{- if .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
|
{{- if .Values.worker.autoscaling.targetCPU }}
|
||||||
- type: Resource
|
- type: Resource
|
||||||
resource:
|
resource:
|
||||||
name: cpu
|
name: cpu
|
||||||
targetAverageUtilization: {{ .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
|
target:
|
||||||
|
type: "Utilization"
|
||||||
|
averageUtilization: {{ .Values.worker.autoscaling.targetCPU }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.worker.autoscaling.targetMemoryUtilizationPercentage }}
|
{{- if .Values.worker.autoscaling.targetMemory }}
|
||||||
- type: Resource
|
- type: Resource
|
||||||
resource:
|
resource:
|
||||||
name: memory
|
name: memory
|
||||||
targetAverageUtilization: {{ .Values.worker.autoscaling.targetMemoryUtilizationPercentage }}
|
target:
|
||||||
|
type: "Utilization"
|
||||||
|
averageUtilization: {{ .Values.worker.autoscaling.targetMemory }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
68
values.yaml
68
values.yaml
|
@ -11,6 +11,14 @@ imagePullSecrets: []
|
||||||
nameOverride: ""
|
nameOverride: ""
|
||||||
fullnameOverride: ""
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
migrationJob:
|
||||||
|
enabled: true
|
||||||
|
command: [] # Default ./manage.py migrate
|
||||||
|
activeDeadlineSeconds: 900
|
||||||
|
resources:
|
||||||
|
limits: {}
|
||||||
|
requests: {}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
normal: {}
|
normal: {}
|
||||||
secret: {}
|
secret: {}
|
||||||
|
@ -18,6 +26,10 @@ env:
|
||||||
# DATABASE_URL:
|
# DATABASE_URL:
|
||||||
# REDIS_URL:
|
# REDIS_URL:
|
||||||
|
|
||||||
|
existingSecret: ""
|
||||||
|
extraVolumeMounts: []
|
||||||
|
extraVolumes: []
|
||||||
|
|
||||||
web:
|
web:
|
||||||
replicaCount: 2
|
replicaCount: 2
|
||||||
port: 8080
|
port: 8080
|
||||||
|
@ -39,6 +51,7 @@ web:
|
||||||
memory: 128Mi
|
memory: 128Mi
|
||||||
nodeSelector: {}
|
nodeSelector: {}
|
||||||
tolerations: []
|
tolerations: []
|
||||||
|
podAnnotations: {}
|
||||||
affinity: {}
|
affinity: {}
|
||||||
# podAntiAffinity:
|
# podAntiAffinity:
|
||||||
# preferredDuringSchedulingIgnoredDuringExecution:
|
# preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
@ -90,6 +103,15 @@ worker:
|
||||||
maxReplicas: 100
|
maxReplicas: 100
|
||||||
targetCPUUtilizationPercentage: 90
|
targetCPUUtilizationPercentage: 90
|
||||||
# targetMemoryUtilizationPercentage: 80
|
# targetMemoryUtilizationPercentage: 80
|
||||||
|
livenessProbe: {}
|
||||||
|
# initialDelaySeconds: 10
|
||||||
|
# periodSeconds: 60
|
||||||
|
# timeoutSeconds: 30
|
||||||
|
# exec:
|
||||||
|
# command:
|
||||||
|
# - "bash"
|
||||||
|
# - "-c"
|
||||||
|
# - "celery -A django inspect ping -d celery@$HOSTNAME | grep -q OK"
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 900m
|
cpu: 900m
|
||||||
|
@ -99,14 +121,59 @@ worker:
|
||||||
memory: 128Mi
|
memory: 128Mi
|
||||||
nodeSelector: {}
|
nodeSelector: {}
|
||||||
tolerations: []
|
tolerations: []
|
||||||
|
podAnnotations: {}
|
||||||
affinity: {}
|
affinity: {}
|
||||||
|
|
||||||
beat:
|
beat:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 120Mi
|
||||||
|
requests:
|
||||||
|
cpu: 1m
|
||||||
|
memory: 90Mi
|
||||||
nodeSelector: {}
|
nodeSelector: {}
|
||||||
tolerations: []
|
tolerations: []
|
||||||
|
podAnnotations: {}
|
||||||
affinity: {}
|
affinity: {}
|
||||||
|
|
||||||
|
flower:
|
||||||
|
enabled: false
|
||||||
|
image:
|
||||||
|
repository: mher/flower
|
||||||
|
tag: latest
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 256Mi
|
||||||
|
nodeSelector: {}
|
||||||
|
tolerations: []
|
||||||
|
podAnnotations: {}
|
||||||
|
affinity: {}
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 80
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
annotations:
|
||||||
|
{}
|
||||||
|
# kubernetes.io/ingress.class: nginx
|
||||||
|
# kubernetes.io/tls-acme: "true"
|
||||||
|
hosts:
|
||||||
|
- host: chart-example.local
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
|
tls: []
|
||||||
|
# - secretName: chart-example-tls
|
||||||
|
# hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
|
||||||
serviceAccount:
|
serviceAccount:
|
||||||
# Specifies whether a service account should be created
|
# Specifies whether a service account should be created
|
||||||
create: false
|
create: false
|
||||||
|
@ -129,3 +196,4 @@ postgresql:
|
||||||
enabled: false
|
enabled: false
|
||||||
#auth:
|
#auth:
|
||||||
# postgresqlPassword: # Must be set
|
# postgresqlPassword: # Must be set
|
||||||
|
|
Loading…
Reference in a new issue