added chart

This commit is contained in:
Hendrik Leidinger 2022-01-11 18:23:59 +01:00
parent 537e43a9f4
commit f94c26e29b
17 changed files with 542 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj

View file

@ -0,0 +1,24 @@
apiVersion: v1
name: django-nginx-uwsgi
icon: https://apsl.github.io/kubernetes-charts/images/django-nginx-uwsgi.png
version: 0.4.4
keywords:
- django
- nginx
- uwsgi
- crons
- rq
- celery
- celery-beat
description: >
A Chart for a simple architecture of an app deploying over K8s using nginx and uwsgi in the same pod.
So, it depends of nginx-uwsgi packages for the app, uwsgi for crons, rq or celery and redis package.
mantainers:
- name: Tomeu Canyelles
email: bcanyelles@apsl.net
- name: Pau Rul.lan
email: prullan@apsl.net
- name: Edu Herraiz
email: eherraiz@apsl.net
- name: Marc Tudurí
email: mtuduri@apsl.net

View file

@ -0,0 +1 @@
# In progress...

View file

@ -0,0 +1,3 @@
# Django
Deploy a full Django based application with Nginx and uWSGI stack.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,200 @@
questions:
# Images
- variable: global.image.uwsgi
label: uWSGI image
type: string
group: Images
- variable: global.image.nginx
label: Nginx image
type: string
group: Images
- variable: global.image.tag
label: Image tag
description: The tag for nginx & uwsgi images
type: string
default: "latest"
group: Images
# Databases
- variable: app.databaseController.enabled
label: Automatic database configuration
type: boolean
default: "true"
show_subquestion_if: "false && global.databaseController.secret.shared=false"
group: Database
subquestions:
- variable: app.configMap.databaseName
label: Database name
type: string
- variable: app.configMap.databasePort
label: Database port
type: string
default: "6543"
- variable: app.configMap.databaseUser
label: Database username
type: string
- variable: app.secrets.passwordDB
label: Database password
type: password
- variable: global.databaseController.secret.shared
label: Use common secrets
description: Use secrets generated by database controller
type: boolean
default: "true"
group: Database
- variable: global.cloudSql.host
label: CloudSQL database host
type: string
default: "10.7.0.3"
group: Database
# Main settings
- variable: app.configMap.enableSentry
label: Enable Sentry DSN
type: enum
options:
- "True"
- "False"
default: "True"
group: Main settings
show_subquestion_if: "True"
subquestions:
- variable: app.secrets.sentryDSN
label: Sentry DSN
type: string
- variable: app.configMap.compressEnabled
label: Compress enabled
type: enum
options:
- "True"
- "False"
default: "True"
group: Main settings
- variable: app.configMap.compressOffline
label: Compress offline
type: enum
options:
- "True"
- "False"
default: "True"
group: Main settings
- variable: app.configMap.allowedHosts
label: Allowed hosts
type: string
default: "*"
group: Main settings
- variable: app.configMap.enableBasicAuth
description: Use demo/demo to login
label: Use Basic auth
type: enum
options:
- "True"
- "False"
default: "False"
group: Main settings
- variable: app.configMap.enable3wRedirect
label: Enable www redirect
type: enum
options:
- "True"
- "False"
default: "False"
group: Main settings
- variable: app.configMap.enableHttpsRedirect
label: Enable https redirect
type: enum
options:
- "True"
- "False"
default: "False"
group: Main settings
# Migrations
- variable: migrations.enabled
label: Use pod for migrations
description: "Is recommended choose only one option: pods or cronjob as migration executor"
type: boolean
default: "false"
group: Migrations
- variable: cronjob.enabled
label: Use cron-job for migrations
type: boolean
default: "true"
group: Migrations
- variable: migrations.deployment.probes.readiness.timeout
label: Timeout for readiness probe request
type: int
default: 5
show_if: "migrations.enabled=true"
group: Migrations
- variable: migrations.deployment.probes.readiness.period
label: Time between readiness probe request
type: int
default: 30
show_if: "migrations.enabled=true"
group: Migrations
# Redis
- variable: redis.enabled
description: This value create a new redis pod
label: Use unhosted redis
type: boolean
default: "false"
group: Redis
- variable: app.deployment.redis.host
label: Redis host
type: string
default: "10.0.0.3"
show_if: "redis.enabled=false"
group: Redis
- variable: app.deployment.redis.port
label: Redis port
type: string
default: "6379"
group: Redis
- variable: app.deployment.redis.database
label: Redis database
type: string
default: "1"
show_if: "redis.enabled=false"
group: Redis
# Extra components
- variable: varnish.enabled
label: Use Varnish
type: boolean
default: "false"
group: Extra Components
- variable: crons.enabled
label: Use Crons
type: boolean
default: "false"
group: Extra Components
- variable: celery.enabled
label: Use Celery
type: boolean
default: "false"
group: Extra Components
- variable: rq.enabled
label: Use RQ
type: boolean
default: "false"
group: Extra Components
# Celery settings
- variable: global.celery.brokerUrl
label: Celery broker url
type: string
default: "redis://10.0.0.3:6379/1"
show_if: "celery.enabled=true"
group: Celery settings
- variable: celery-beat.enabled
label: Use Celery Beat
type: boolean
default: "false"
show_if: "celery.enabled=true"
group: Celery settings

View file

@ -0,0 +1,27 @@
dependencies:
- name: nginx-uwsgi
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
version: 0.4.3
- name: uwsgi
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
version: 0.4.4
- name: uwsgi
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
version: 0.4.4
- name: django-celery
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
version: 0.1.2
- name: django-celery
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
version: 0.1.2
- name: varnish
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
version: 0.1.0
- name: redis
repository: https://charts.helm.sh/stable
version: 0.8.0
- name: uwsgi
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
version: 0.4.4
digest: sha256:5178f387e3ab951e49867fa6370e1785f6bc43dbb8dcfc84503305887bf43dd2
generated: "2021-01-11T16:06:56.133014619+01:00"

View file

@ -0,0 +1,45 @@
dependencies:
- name: nginx-uwsgi
version: 0.4.3
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
alias: app
- name: uwsgi
version: 0.4.4
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
alias: crons
condition: crons.enabled
- name: uwsgi
version: 0.4.4
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
alias: rq
condition: rq.enabled
- name: django-celery
version: 0.1.2
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
alias: celery
condition: celery.enabled
- name: django-celery
version: 0.1.2
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
alias: celery-beat
condition: celery-beat.enabled
- name: varnish
version: 0.1.0
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
condition: varnish.enabled
- name: redis
version: 0.8.0
repository: https://charts.helm.sh/stable
condition: redis.enabled
- name: uwsgi
version: 0.4.4
repository: https://raw.githubusercontent.com/APSL/kubernetes-charts/master/packages
alias: migrations
condition: migrations.enabled

View file

@ -0,0 +1,4 @@
This chart "{{ template "name" . }}" details a deploy which contains three pods:
1. Application
2. Nginx container
2. Proxy to SQL instance of GCE

View file

@ -0,0 +1,24 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default release name truncated at 63 chars.
*/}}
{{- define "releasename" -}}
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View file

@ -0,0 +1,67 @@
{{- if .Values.cronjob.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ .Release.Name }}-migrations
namespace: {{ .Release.Namespace }}
spec:
concurrencyPolicy: Forbid
failedJobsHistoryLimit: 1
successfulJobsHistoryLimit: 1
schedule: "{{ .Values.cronjob.schedule }}"
suspend: {{ .Values.cronjob.suspend }}
jobTemplate:
spec:
backoffLimit: 1
template:
spec:
restartPolicy: Never
containers:
- args:
{{- if .Values.cronjob.migrations.enabled }}
- launch-migrations
{{- else }}
- echo
- "Job done"
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}
- secretRef:
name: {{ .Release.Name }}
env:
{{- if .Values.app.deployment.pgBouncer.enabled }}
- name: DATABASE_HOST
value: {{ .Values.global.cloudSql.host }}
- name: DATABASE_PORT
value: "{{ .Values.global.configMap.databasePort }}"
{{- end }}
{{- if .Values.global.databaseController.secret.shared }}
- name: DATABASE_NAME
valueFrom:
secretKeyRef:
name: {{ .Values.global.databaseController.secret.name }}-{{ .Release.Name }}
key: database-name
- name: DATABASE_USER
valueFrom:
secretKeyRef:
name: {{ .Values.global.databaseController.secret.name }}-{{ .Release.Name }}
key: database-user
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.global.databaseController.secret.name }}-{{ .Release.Name }}
key: database-password
{{- end }}
image: {{ .Values.global.image.uwsgi }}:{{ .Values.global.image.tag }}
imagePullPolicy: Always
name: {{ .Release.Name }}-migrations
resources:
limits:
cpu: 250m
memory: 512Mi
requests:
cpu: 25m
memory: 100Mi
{{- end }}

View file

@ -0,0 +1,123 @@
# Default values for django app
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
.commons: &commons
secrets:
enabled: false
service:
enabled: false
configMap:
enabled: false
strategy:
type: Recreate
probes:
liveness:
enabled: false
readiness:
enabled: false
global:
image:
uwsgi: ""
nginx: ""
tag: ""
dataSecrets:
dataConfigMap:
cloudSql:
host: ""
secrets:
passwordDB: ""
sentryDSN: ""
configMap:
databaseHost: "127.0.0.1"
databasePort: "5432"
databaseController:
secret:
shared: false
cronjob:
enabled: true
suspend: true
schedule: "0 6 * * 1-5"
migrations:
enabled: true
app:
deployment:
pgBouncer:
enabled: true
crons:
enabled: true
crons:
enabled: true
<<: *commons
deployment:
probes:
liveness:
enabled: false
readiness:
enabled: true
migrations:
enabled: false
migrations:
enabled: true
<<: *commons
deployment:
probes:
liveness:
enabled: false
readiness:
enabled: true
celery:
enabled: false
<<: *commons
celery-beat:
enabled: false
<<: *commons
deployment:
args:
- run-celery-beat
probes:
liveness:
args: launch-celery-beat-liveness-probe
metrics:
enabled: false
rq:
enabled: false
djangoRQ:
enabled: true
<<: *commons
redis:
enabled: false
image: redis:3.0.7
usePassword: false
persistence:
enabled: false
resources:
limits:
cpu: 50m
memory: 256Mi
requests:
cpu: 50m
memory: 128Mi
# BackendHost takes release name as a prefix: {{ RELEASE_NAME-backendHost }}
varnish:
enabled: true
backendHost: ""

View file

@ -0,0 +1,3 @@
categories:
- generic
icon_url: "https://raw.githubusercontent.com/APSL/kubernetes-charts/master/images/django-nginx-uwsgi.png"