This commit is contained in:
David Burke 2020-02-09 16:56:26 -05:00
parent e935541b40
commit 308366ca60
7 changed files with 168 additions and 40 deletions

View file

@ -1,28 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "glitchtip.fullname" . }}-web
name: {{ include "glitchtip.fullname" . }}-beat
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
replicas: 1
selector:
matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
role: web
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
role: web
annotations:
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "glitchtip.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
@ -31,31 +28,35 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
limits:
cpu: 50m
memory: 96Mi
requests:
cpu: 1m
memory: 32Mi
env:
- name: DEBUG
value: "False"
- name: STATIC_URL
value: /
- name: ENABLE_SOCIAL_AUTH
value: {{ .Values.enableSocialAuth | quote }}
- name: SERVER_ROLE
value: "beat"
{{- if .Values.redisURL }}
- name: REDIS_URL
value: {{ .Values.redisURL }}
{{- end }}
{{- if .Values.redis.enabled }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
key: redis-password
name: {{ include "glitchtip.fullname" . }}-glitchtip-redis
- name: REDIS_HOST
value: {{ template "glitchtip.redis.host" . }}
- name: REDIS_PORT
value: {{ template "glitchtip.redis.port" . }}
{{- end }}
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 }}

View file

@ -5,16 +5,16 @@ metadata:
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.image.replicaCount }}
replicas: {{ .Values.worker.replicaCount }}
selector:
matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
annotations:
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
@ -37,6 +37,21 @@ spec:
value: /
- 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 "glitchtip.fullname" . }}-glitchtip-redis
- name: REDIS_HOST
value: {{ template "glitchtip.redis.host" . }}
- name: REDIS_PORT
value: {{ template "glitchtip.redis.port" . }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "glitchtip.fullname" . }}
@ -51,4 +66,4 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

90
templates/deployment.yaml Normal file
View file

@ -0,0 +1,90 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "glitchtip.fullname" . }}
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.web.replicaCount }}
selector:
matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
role: web
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
role: web
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "glitchtip.serviceAccountName" . }}
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 }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
failureThreshold: {{ .Values.web.livenessProbe.failureThreshold }}
httpGet:
path: /_health/
port: 8080
initialDelaySeconds: {{ .Values.web.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.web.livenessProbe.timeoutSeconds }}
readinessProbe:
failureThreshold: {{ .Values.web.readinessProbe.failureThreshold }}
httpGet:
path: /_health/
port: 8080
initialDelaySeconds: {{ .Values.web.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.web.readinessProbe.timeoutSeconds }}
resources:
{{- toYaml .Values.web.resources | nindent 12 }}
env:
- name: DEBUG
value: "False"
- name: STATIC_URL
value: /
- name: ENABLE_SOCIAL_AUTH
value: {{ .Values.enableSocialAuth | quote }}
{{- if .Values.redisURL }}
- name: REDIS_URL
value: {{ .Values.redisURL }}
{{- end }}
{{- if .Values.redis.enabled }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
key: redis-password
name: {{ include "glitchtip.fullname" . }}-glitchtip-redis
- name: REDIS_HOST
value: {{ template "glitchtip.redis.host" . }}
- name: REDIS_PORT
value: {{ template "glitchtip.redis.port" . }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "glitchtip.fullname" . }}
{{- with .Values.web.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.web.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.web.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View file

@ -2,7 +2,7 @@
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "glitchtip.fullname" . }}-web
name: {{ template "glitchtip.fullname" . }}
labels:
app: {{ template "glitchtip.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
@ -12,8 +12,8 @@ spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
name: {{ template "glitchtip.fullname" . }}-web
name: {{ template "glitchtip.fullname" . }}
minReplicas: {{ .Values.web.hpa.minpods }}
maxReplicas: {{ .Values.web.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.web.hpa.cputhreshold }}
{{- end }}
{{- end }}

View file

@ -16,4 +16,4 @@ spec:
minReplicas: {{ .Values.worker.hpa.minpods }}
maxReplicas: {{ .Values.worker.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.worker.hpa.cputhreshold }}
{{- end }}
{{- end }}

14
values-sample.yaml Normal file
View file

@ -0,0 +1,14 @@
web:
hpa:
enabled: true
resources:
limits:
cpu: 1000m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
worker:
hpa:
enabled: true

View file

@ -12,7 +12,7 @@ nameOverride: ""
fullnameOverride: ""
databaseURL:
secretKey:
# redisURL:
redisURL:
enableSocialAuth: false
web:
@ -20,18 +20,26 @@ web:
hpa:
enabled: false
cputhreshold: 60
minpods: 1
maxpods: 10
minpods: 2
maxpods: 5
resources: {}
# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 256Mi
# requests:
# cpu: 50m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
livenessProbe:
failureThreshold: 5
initialDelaySeconds: 5
timeoutSeconds: 2
readinessProbe:
failureThreshold: 10
initialDelaySeconds: 5
timeoutSeconds: 2
worker:
replicaCount: 1