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 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ include "glitchtip.fullname" . }}-web name: {{ include "glitchtip.fullname" . }}-beat
labels: labels:
{{- include "glitchtip.labels" . | nindent 4 }} {{- include "glitchtip.labels" . | nindent 4 }}
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: 1
selector: selector:
matchLabels: matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }} {{- include "glitchtip.selectorLabels" . | nindent 6 }}
role: web
template: template:
metadata: metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
labels: labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }} {{- include "glitchtip.selectorLabels" . | nindent 8 }}
role: web
annotations:
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
spec: spec:
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
serviceAccountName: {{ include "glitchtip.serviceAccountName" . }}
securityContext: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml .Values.podSecurityContext | nindent 8 }}
containers: containers:
@ -31,31 +28,35 @@ spec:
{{- 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 }}
ports:
- name: http
containerPort: 8080
protocol: TCP
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} limits:
cpu: 50m
memory: 96Mi
requests:
cpu: 1m
memory: 32Mi
env: env:
- name: DEBUG - name: DEBUG
value: "False" value: "False"
- name: STATIC_URL - name: STATIC_URL
value: / value: /
- name: ENABLE_SOCIAL_AUTH - name: SERVER_ROLE
value: {{ .Values.enableSocialAuth | quote }} 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: envFrom:
- secretRef: - secretRef:
name: {{ include "glitchtip.fullname" . }} 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: labels:
{{- include "glitchtip.labels" . | nindent 4 }} {{- include "glitchtip.labels" . | nindent 4 }}
spec: spec:
replicas: {{ .Values.image.replicaCount }} replicas: {{ .Values.worker.replicaCount }}
selector: selector:
matchLabels: matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }} {{- include "glitchtip.selectorLabels" . | nindent 6 }}
template: template:
metadata: metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
labels: labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }} {{- include "glitchtip.selectorLabels" . | nindent 8 }}
annotations:
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
spec: spec:
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
@ -37,6 +37,21 @@ spec:
value: / value: /
- name: SERVER_ROLE - name: SERVER_ROLE
value: "worker" 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: envFrom:
- secretRef: - secretRef:
name: {{ include "glitchtip.fullname" . }} name: {{ include "glitchtip.fullname" . }}
@ -51,4 +66,4 @@ spec:
{{- with .Values.tolerations }} {{- with .Values.tolerations }}
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- 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 apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
metadata: metadata:
name: {{ template "glitchtip.fullname" . }}-web name: {{ template "glitchtip.fullname" . }}
labels: labels:
app: {{ template "glitchtip.fullname" . }} app: {{ template "glitchtip.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
@ -12,8 +12,8 @@ spec:
scaleTargetRef: scaleTargetRef:
kind: Deployment kind: Deployment
apiVersion: apps/v1 apiVersion: apps/v1
name: {{ template "glitchtip.fullname" . }}-web name: {{ template "glitchtip.fullname" . }}
minReplicas: {{ .Values.web.hpa.minpods }} minReplicas: {{ .Values.web.hpa.minpods }}
maxReplicas: {{ .Values.web.hpa.maxpods }} maxReplicas: {{ .Values.web.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.web.hpa.cputhreshold }} targetCPUUtilizationPercentage: {{ .Values.web.hpa.cputhreshold }}
{{- end }} {{- end }}

View file

@ -16,4 +16,4 @@ spec:
minReplicas: {{ .Values.worker.hpa.minpods }} minReplicas: {{ .Values.worker.hpa.minpods }}
maxReplicas: {{ .Values.worker.hpa.maxpods }} maxReplicas: {{ .Values.worker.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.worker.hpa.cputhreshold }} 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: "" fullnameOverride: ""
databaseURL: databaseURL:
secretKey: secretKey:
# redisURL: redisURL:
enableSocialAuth: false enableSocialAuth: false
web: web:
@ -20,18 +20,26 @@ web:
hpa: hpa:
enabled: false enabled: false
cputhreshold: 60 cputhreshold: 60
minpods: 1 minpods: 2
maxpods: 10 maxpods: 5
resources: {} resources: {}
# limits: # limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 100m # cpu: 100m
# memory: 256Mi
# requests:
# cpu: 50m
# memory: 128Mi # memory: 128Mi
nodeSelector: {} nodeSelector: {}
tolerations: [] tolerations: []
affinity: {} affinity: {}
livenessProbe:
failureThreshold: 5
initialDelaySeconds: 5
timeoutSeconds: 2
readinessProbe:
failureThreshold: 10
initialDelaySeconds: 5
timeoutSeconds: 2
worker: worker:
replicaCount: 1 replicaCount: 1