Use more generic name "django" instead of glitchtip for template

variables
This commit is contained in:
David Burke 2021-02-19 20:20:53 +00:00
parent efc58de740
commit 976c6799dd
19 changed files with 233 additions and 201 deletions

View file

@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "django.fullname" . }}-worker
labels:
{{- include "django.labels" . | nindent 4 }}
app.kubernetes.io/component: worker
spec:
replicas: {{ .Values.worker.replicaCount }}
selector:
matchLabels:
{{- include "django.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: worker
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
tag: "{{ .Values.image.tag }}"
labels:
{{- include "django.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: worker
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.worker.resources | nindent 12 }}
env:
- name: SERVER_ROLE
value: "worker"
{{- if .Values.redisURL }}
- name: REDIS_URL
value: {{ .Values.redisURL }}
{{- end }}
{{- if .Values.redis.enabled }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
key: redis-password
name: {{ include "django.fullname" . }}-redis
- name: REDIS_HOST
value: {{ template "django.redis.host" . }}
- name: REDIS_PORT
value: {{ template "django.redis.port" . }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "django.fullname" . }}
- configMapRef:
name: {{ include "django.fullname" . }}
{{- with .Values.worker.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.worker.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.worker.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

28
templates/worker/hpa.yaml Normal file
View file

@ -0,0 +1,28 @@
{{- if .Values.worker.autoscaling.enabled -}}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "django.fullname" . }}-worker
labels:
{{- include "django.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "django.fullname" . }}-worker
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
metrics:
{{- if .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.worker.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.worker.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}