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

9
Chart.lock Normal file
View file

@ -0,0 +1,9 @@
dependencies:
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com/
version: 8.2.1
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com/
version: 10.4.0
digest: sha256:6dab63cfbf6a2f363b12ff9cbf683697352acfaa438962ef827418e5e9e7af22
generated: "2020-02-01T17:08:07.30147224-05:00"

View file

@ -19,3 +19,13 @@ version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 1.0.0
dependencies:
- name: postgresql
version: 8.2.1
repository: https://kubernetes-charts.storage.googleapis.com/
condition: postgresql.enabled
- name: redis
version: 10.4.0
repository: https://kubernetes-charts.storage.googleapis.com/
condition: redis.enabled

BIN
charts/postgresql-8.2.1.tgz Normal file

Binary file not shown.

BIN
charts/redis-10.4.0.tgz Normal file

Binary file not shown.

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 }}

View file

@ -2,8 +2,6 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: registry.gitlab.com/glitchtip/glitchtip-frontend
tag: master
@ -16,6 +14,42 @@ databaseURL:
secretKey:
enableSocialAuth: false
web:
hpa:
enabled: false
cputhreshold: 60
minpods: 1
maxpods: 10
replicaCount: 1
resources: {}
# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
worker:
replicaCount: 1
hpa:
enabled: false
cputhreshold: 60
minpods: 1
maxpods: 10
resources: {}
# limits:
# cpu: 500m
# memory: 256Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
serviceAccount:
# Specifies whether a service account should be created
create: true
@ -23,17 +57,6 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name:
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
@ -51,20 +74,18 @@ ingress:
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
redis:
enabled: true
master:
persistence:
enabled: false
slave:
persistence:
enabled: false
cluster:
enabled: false
slaveCount: 1
nodeSelector: {}
tolerations: []
affinity: {}
# Default to disabled, use a managed database service. But can be enabled here.
postgresql:
enabled: false