See changelog
This commit is contained in:
		
							parent
							
								
									af39eedea8
								
							
						
					
					
						commit
						74288199f6
					
				
					 13 changed files with 71 additions and 19 deletions
				
			
		
							
								
								
									
										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: 12.1.15
 | 
					  version: 15.5.16
 | 
				
			||||||
- name: redis
 | 
					- name: redis
 | 
				
			||||||
  repository: https://charts.bitnami.com/bitnami
 | 
					  repository: https://charts.bitnami.com/bitnami
 | 
				
			||||||
  version: 17.3.18
 | 
					  version: 19.6.1
 | 
				
			||||||
digest: sha256:51da30e025c538b229b1cfaba062c53dea8bf3f520fca460c6afc294c58bdc76
 | 
					digest: sha256:5e21575062cdcef4e947b4f89741e95138d93207f91d5074d53397d9c414f0a1
 | 
				
			||||||
generated: "2023-02-22T20:26:38.305910383-05: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.3.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: ~12.1.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.3.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.
										
									
								
							| 
						 | 
					@ -62,6 +62,10 @@ spec:
 | 
				
			||||||
            {{- end }}
 | 
					            {{- 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 }}
 | 
				
			||||||
| 
						 | 
					@ -74,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 }}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
{{- if .Values.preInstall.enabled -}}
 | 
					{{- if .Values.migrationJob.enabled -}}
 | 
				
			||||||
apiVersion: batch/v1
 | 
					apiVersion: batch/v1
 | 
				
			||||||
kind: Job
 | 
					kind: Job
 | 
				
			||||||
metadata:
 | 
					metadata:
 | 
				
			||||||
  name: {{ include "django.fullname" . }}
 | 
					  name: {{ include "django.fullname" . }}-migrate
 | 
				
			||||||
  labels:
 | 
					  labels:
 | 
				
			||||||
    {{- include "django.labels" . | nindent 4 }}
 | 
					    {{- include "django.labels" . | nindent 4 }}
 | 
				
			||||||
  annotations:
 | 
					  annotations:
 | 
				
			||||||
| 
						 | 
					@ -13,8 +13,12 @@ metadata:
 | 
				
			||||||
    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 }}"
 | 
				
			||||||
spec:
 | 
					spec:
 | 
				
			||||||
  activeDeadlineSeconds: {{ default 900 .Values.preInstall.activeDeadlineSeconds }}
 | 
					  activeDeadlineSeconds: {{ default 900 .Values.migrationJob.activeDeadlineSeconds }}
 | 
				
			||||||
  template:
 | 
					  template:
 | 
				
			||||||
 | 
					    metadata:
 | 
				
			||||||
 | 
					      labels:
 | 
				
			||||||
 | 
					        app.kubernetes.io/component: migrate-job
 | 
				
			||||||
 | 
					        {{- include "django.selectorLabels" . | nindent 8 }}
 | 
				
			||||||
    spec:
 | 
					    spec:
 | 
				
			||||||
    {{- with .Values.imagePullSecrets }}
 | 
					    {{- with .Values.imagePullSecrets }}
 | 
				
			||||||
      imagePullSecrets:
 | 
					      imagePullSecrets:
 | 
				
			||||||
| 
						 | 
					@ -25,15 +29,15 @@ spec:
 | 
				
			||||||
      securityContext:
 | 
					      securityContext:
 | 
				
			||||||
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
 | 
					        {{- toYaml .Values.podSecurityContext | nindent 8 }}
 | 
				
			||||||
      containers:
 | 
					      containers:
 | 
				
			||||||
      - name: pre-install-job
 | 
					      - name: migrate-job
 | 
				
			||||||
        securityContext:
 | 
					        securityContext:
 | 
				
			||||||
            {{- 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.preInstall.resources }}        
 | 
					        {{- if .Values.migrationJob.resources }}        
 | 
				
			||||||
        resources: {{ toYaml .Values.preInstall.resources | nindent 12 }}
 | 
					        resources: {{ toYaml .Values.migrationJob.resources | nindent 12 }}
 | 
				
			||||||
        {{- end }}
 | 
					        {{- end }}
 | 
				
			||||||
        command: ["./manage.py","migrate"]
 | 
					        command: {{ .Values.migrationJob.command | default (list "./manage.py" "migrate") | toJson }}
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
          - name: DEBUG
 | 
					          - name: DEBUG
 | 
				
			||||||
            value: "False"
 | 
					            value: "False"
 | 
				
			||||||
| 
						 | 
					@ -45,7 +49,7 @@ 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 }}
 | 
				
			||||||
          - name: SECRET_KEY
 | 
					          - name: SECRET_KEY
 | 
				
			||||||
| 
						 | 
					@ -57,4 +61,12 @@ spec:
 | 
				
			||||||
        envFrom:
 | 
					        envFrom:
 | 
				
			||||||
          - configMapRef:
 | 
					          - configMapRef:
 | 
				
			||||||
              name: {{ include "django.fullname" . }}
 | 
					              name: {{ include "django.fullname" . }}
 | 
				
			||||||
 | 
					        {{- with .Values.extraVolumeMounts }}
 | 
				
			||||||
 | 
					        volumeMounts:
 | 
				
			||||||
 | 
					          {{- toYaml . | nindent 8 }}
 | 
				
			||||||
 | 
					        {{- end }}
 | 
				
			||||||
 | 
					      {{- with .Values.extraVolumes }}
 | 
				
			||||||
 | 
					      volumes:
 | 
				
			||||||
 | 
					        {{- toYaml . | nindent 6 }}
 | 
				
			||||||
 | 
					      {{- end }}
 | 
				
			||||||
{{- end }}
 | 
					{{- end }}
 | 
				
			||||||
| 
						 | 
					@ -83,6 +83,10 @@ spec:
 | 
				
			||||||
            {{- end }}
 | 
					            {{- 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 }}
 | 
				
			||||||
| 
						 | 
					@ -95,3 +99,7 @@ spec:
 | 
				
			||||||
      tolerations:
 | 
					      tolerations:
 | 
				
			||||||
        {{- toYaml . | nindent 8 }}
 | 
					        {{- toYaml . | nindent 8 }}
 | 
				
			||||||
    {{- end }}
 | 
					    {{- end }}
 | 
				
			||||||
 | 
					      {{- with .Values.extraVolumes }}
 | 
				
			||||||
 | 
					      volumes:
 | 
				
			||||||
 | 
					        {{- toYaml . | nindent 6 }}
 | 
				
			||||||
 | 
					      {{- end }}
 | 
				
			||||||
| 
						 | 
					@ -66,6 +66,10 @@ spec:
 | 
				
			||||||
            {{- end }}
 | 
					            {{- 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 }}
 | 
				
			||||||
| 
						 | 
					@ -78,4 +82,8 @@ spec:
 | 
				
			||||||
      tolerations:
 | 
					      tolerations:
 | 
				
			||||||
        {{- toYaml . | nindent 8 }}
 | 
					        {{- toYaml . | nindent 8 }}
 | 
				
			||||||
    {{- end }}
 | 
					    {{- end }}
 | 
				
			||||||
 | 
					      {{- with .Values.extraVolumes }}
 | 
				
			||||||
 | 
					      volumes:
 | 
				
			||||||
 | 
					        {{- toYaml . | nindent 6 }}
 | 
				
			||||||
 | 
					      {{- end }}
 | 
				
			||||||
{{- end }}
 | 
					{{- end }}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,14 +11,14 @@ imagePullSecrets: []
 | 
				
			||||||
nameOverride: ""
 | 
					nameOverride: ""
 | 
				
			||||||
fullnameOverride: ""
 | 
					fullnameOverride: ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
preInstall:
 | 
					migrationJob:
 | 
				
			||||||
  enabled: true
 | 
					  enabled: true
 | 
				
			||||||
 | 
					  command: []  # Default ./manage.py migrate
 | 
				
			||||||
  activeDeadlineSeconds: 900
 | 
					  activeDeadlineSeconds: 900
 | 
				
			||||||
  resources:
 | 
					  resources:
 | 
				
			||||||
    limits: {}
 | 
					    limits: {}
 | 
				
			||||||
    requests: {}
 | 
					    requests: {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
env:
 | 
					env:
 | 
				
			||||||
  normal: {}
 | 
					  normal: {}
 | 
				
			||||||
  secret: {}
 | 
					  secret: {}
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,8 @@ env:
 | 
				
			||||||
    # REDIS_URL:
 | 
					    # REDIS_URL:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
existingSecret: ""
 | 
					existingSecret: ""
 | 
				
			||||||
 | 
					extraVolumeMounts: []
 | 
				
			||||||
 | 
					extraVolumes: []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
web:
 | 
					web:
 | 
				
			||||||
  replicaCount: 2
 | 
					  replicaCount: 2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue