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 # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. # incremented each time you make changes to the application.
appVersion: 1.0.0 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 type: Opaque
data: data:
DATABASE_URL: {{ required "databaseURL is a required value." .Values.databaseURL | b64enc | quote }} 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 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ include "glitchtip.fullname" . }} name: {{ include "glitchtip.fullname" . }}-web
labels: labels:
{{- include "glitchtip.labels" . | nindent 4 }} {{- include "glitchtip.labels" . | nindent 4 }}
lol: "yes"
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
selector: selector:
@ -14,6 +13,8 @@ spec:
metadata: metadata:
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:
@ -39,12 +40,11 @@ spec:
value: "False" value: "False"
- name: STATIC_URL - name: STATIC_URL
value: / 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 - name: ENABLE_SOCIAL_AUTH
value: {{ .Values.enableSocialAuth | quote }} value: {{ .Values.enableSocialAuth | quote }}
envFrom:
- secretRef:
name: {{ include "glitchtip.fullname" . }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- 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. # This is a YAML-formatted file.
# Declare variables to be passed into your templates. # Declare variables to be passed into your templates.
replicaCount: 1
image: image:
repository: registry.gitlab.com/glitchtip/glitchtip-frontend repository: registry.gitlab.com/glitchtip/glitchtip-frontend
tag: master tag: master
@ -16,6 +14,42 @@ databaseURL:
secretKey: secretKey:
enableSocialAuth: false 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: serviceAccount:
# Specifies whether a service account should be created # Specifies whether a service account should be created
create: true create: true
@ -23,17 +57,6 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template # If not set and create is true, a name is generated using the fullname template
name: name:
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service: service:
type: ClusterIP type: ClusterIP
port: 80 port: 80
@ -51,20 +74,18 @@ ingress:
# hosts: # hosts:
# - chart-example.local # - chart-example.local
resources: {} redis:
# We usually recommend not to specify default resources and to leave this as a conscious enabled: true
# choice for the user. This also increases chances charts run on environments with little master:
# resources, such as Minikube. If you do want to specify resources, uncomment the following persistence:
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. enabled: false
# limits: slave:
# cpu: 100m persistence:
# memory: 128Mi enabled: false
# requests: cluster:
# cpu: 100m enabled: false
# memory: 128Mi slaveCount: 1
nodeSelector: {} # Default to disabled, use a managed database service. But can be enabled here.
postgresql:
tolerations: [] enabled: false
affinity: {}