chart work

This commit is contained in:
David Burke 2020-02-02 13:12:55 -05:00
parent 4a6cbc58ac
commit bd25ca649c
10 changed files with 169 additions and 36 deletions

View file

@ -7,4 +7,5 @@ metadata:
type: Opaque
data:
DATABASE_URL: {{ required "databaseURL is a required value." .Values.databaseURL | b64enc | quote }}
SECRET_KEY: {{ required "secretKey is a required value." .Values.secretKey | b64enc | quote }}
SECRET_KEY: {{ required "secretKey is a required value." .Values.secretKey | b64enc | quote }}
REDIS_URL: "redis"

View file

@ -1,10 +1,9 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "glitchtip.fullname" . }}
name: {{ include "glitchtip.fullname" . }}-web
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
lol: "yes"
spec:
replicas: {{ .Values.replicaCount }}
selector:
@ -14,6 +13,8 @@ spec:
metadata:
labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
annotations:
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
@ -39,12 +40,11 @@ spec:
value: "False"
- name: STATIC_URL
value: /
- name: DATABASE_URL
value: {{ required "databaseURL is a required value." .Values.databaseURL | quote }}
- name: SECRET_KEY
value: {{ required "secretKey is a required value." .Values.secretKey | quote }}
- name: ENABLE_SOCIAL_AUTH
value: {{ .Values.enableSocialAuth | quote }}
envFrom:
- secretRef:
name: {{ include "glitchtip.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}

19
templates/web-hpa.yaml Normal file
View file

@ -0,0 +1,19 @@
{{- if .Values.web.hpa.enabled -}}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "glitchtip.fullname" . }}-web
labels:
app: {{ template "glitchtip.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
name: {{ template "glitchtip.fullname" . }}-web
minReplicas: {{ .Values.web.hpa.minpods }}
maxReplicas: {{ .Values.web.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.web.hpa.cputhreshold }}
{{- end }}

View file

@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "glitchtip.fullname" . }}-worker
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.image.replicaCount }}
selector:
matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
annotations:
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
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: DEBUG
value: "False"
- name: STATIC_URL
value: /
- name: SERVER_ROLE
value: "worker"
envFrom:
- secretRef:
name: {{ include "glitchtip.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

19
templates/worker-hpa.yaml Normal file
View file

@ -0,0 +1,19 @@
{{- if .Values.worker.hpa.enabled -}}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "glitchtip.fullname" . }}-worker
labels:
app: {{ template "glitchtip.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
name: {{ template "glitchtip.fullname" . }}-worker
minReplicas: {{ .Values.worker.hpa.minpods }}
maxReplicas: {{ .Values.worker.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.worker.hpa.cputhreshold }}
{{- end }}