diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f305358..81d3111 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,12 @@ image: - name: alpine/helm:3.2.4 + name: alpine/helm:3.5.4 entrypoint: ["/bin/sh", "-c"] +lint: + stage: test + script: + - helm lint + pages: stage: deploy script: diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1ad4fb4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "django-helm-chart"] + path = django-helm-chart + url = https://gitlab.com/burke-software/django-helm-chart.git diff --git a/Chart.lock b/Chart.lock index c28449f..f8204ef 100644 --- a/Chart.lock +++ b/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami - version: 10.3.17 + version: 10.3.18 - name: redis repository: https://charts.bitnami.com/bitnami version: 14.2.1 -digest: sha256:c5651d0fd8c10cf2abbb22bbc1f6f118ea2d6171110919e66ec5e76740beb1f2 -generated: "2021-05-29T11:58:09.458243021-04:00" +digest: sha256:659bf9e0d61fd9cd5aba565660a7cbb9e877a85b0a7f2d14d41b4ed52a0623a2 +generated: "2021-06-02T19:30:50.105366356-04:00" diff --git a/Chart.yaml b/Chart.yaml index 966ae68..0e702da 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -22,7 +22,7 @@ appVersion: 1.0.0 dependencies: - name: postgresql - version: 10.3.17 + version: ~10.3.17 repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled - name: redis diff --git a/README.md b/README.md index 7e5b512..a58110f 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,16 @@ We use this chart internally. However it's not fully documented yet nor tested in a wide range of scenarios. If you are a helm and kubernetes expert - feel free to use this and help contribute to this repo. +Based on https://gitlab.com/burke-software/django-helm-chart/ + # Usage 1. Add our Helm chart repo `helm repo add glitchtip https://glitchtip.gitlab.io/glitchtip-helm-chart/` -2. Review our values.yaml. At a minimum you'll need to set databaseURL and secretKey. -3. Install the chart `helm install glitchtip/glitchtip --set databaseURL=your_db --set secretKey=random_string` +2. Review our values.yaml. At a minimum you'll need to set env.secret.DATABASE_URL and SECRET_KEY. +3. Install the chart `helm install glitchtip/glitchtip` + +# Tips + +- Use [helm diff](https://github.com/databus23/helm-diff) to preview changes +- We don't version this chart at this time +- Set image.tag to the GlitchTip version you wish to install diff --git a/charts/postgresql-10.3.17.tgz b/charts/postgresql-10.3.17.tgz deleted file mode 100644 index 2f71763..0000000 Binary files a/charts/postgresql-10.3.17.tgz and /dev/null differ diff --git a/charts/postgresql-10.3.18.tgz b/charts/postgresql-10.3.18.tgz new file mode 100644 index 0000000..1794214 Binary files /dev/null and b/charts/postgresql-10.3.18.tgz differ diff --git a/django-helm-chart b/django-helm-chart new file mode 160000 index 0000000..51a5f0e --- /dev/null +++ b/django-helm-chart @@ -0,0 +1 @@ +Subproject commit 51a5f0e2761bfbfe24f0c0dd16fc6dbdff9e0547 diff --git a/templates b/templates new file mode 120000 index 0000000..c88d416 --- /dev/null +++ b/templates @@ -0,0 +1 @@ +django-helm-chart/templates/ \ No newline at end of file diff --git a/templates/NOTES.txt b/templates/NOTES.txt deleted file mode 100644 index 2fddc9e..0000000 --- a/templates/NOTES.txt +++ /dev/null @@ -1,21 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.web.ingress.enabled }} -{{- range $host := .Values.web.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.web.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.web.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "django.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.web.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "django.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "django.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.web.service.port }} -{{- else if contains "ClusterIP" .Values.web.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "django.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 -{{- end }} diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl deleted file mode 100644 index 2734712..0000000 --- a/templates/_helpers.tpl +++ /dev/null @@ -1,123 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "django.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "django.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "django.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "django.labels" -}} -helm.sh/chart: {{ include "django.chart" . }} -{{ include "django.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} - -{{/* -Selector labels -*/}} -{{- define "django.selectorLabels" -}} -app.kubernetes.io/name: {{ include "django.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end -}} - -{{/* -Create the name of the service account to use -*/}} -{{- define "django.serviceAccountName" -}} -{{- if .Values.serviceAccount.create -}} - {{ default (include "django.fullname" .) .Values.serviceAccount.name }} -{{- else -}} - {{ default "default" .Values.serviceAccount.name }} -{{- end -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -*/}} -{{- define "django.postgresql.fullname" -}} -{{- if .Values.postgresql.fullnameOverride -}} -{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.postgresql.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name "django-postgresql" | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} -{{- define "django.redis.fullname" -}} -{{- if .Values.redis.fullnameOverride -}} -{{- .Values.redis.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.redis.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name "django-redis" | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Set redis host -*/}} -{{- define "django.redis.host" -}} -{{- if .Values.redis.enabled -}} -{{- template "django.redis.fullname" . -}}-redis-master -{{- else -}} -{{- .Values.redis.host | quote -}} -{{- end -}} -{{- end -}} - -{{/* -Set redis url -*/}} -{{- define "django.redis.url" -}} -{{- if .Values.redis.enabled -}} -redis://{{- template "django.redis.password" -}}{{- template "django.redis.fullname" . -}}-master -{{- end -}} -{{- end -}} - -{{/* -Set redis port -*/}} -{{- define "django.redis.port" -}} -{{- if .Values.redis.enabled -}} - "6379" -{{- else -}} -{{- default "6379" .Values.redis.port | quote -}} -{{- end -}} -{{- end -}} diff --git a/templates/beat/deployment.yaml b/templates/beat/deployment.yaml deleted file mode 100644 index 5a15e24..0000000 --- a/templates/beat/deployment.yaml +++ /dev/null @@ -1,65 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "django.fullname" . }}-beat - labels: - {{- include "django.labels" . | nindent 4 }} - app.kubernetes.io/component: beat -spec: - replicas: 1 - selector: - matchLabels: - {{- include "django.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: beat - template: - metadata: - annotations: - checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - tag: "{{ .Values.image.tag }}" - labels: - {{- include "django.selectorLabels" . | nindent 8 }} - app.kubernetes.io/component: beat - 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: - limits: - cpu: 50m - memory: 96Mi - requests: - cpu: 1m - memory: 32Mi - env: - - 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 "django.fullname" . }}-redis - - name: REDIS_HOST - value: {{ template "django.redis.host" . }} - - name: REDIS_PORT - value: {{ template "django.redis.port" . }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "django.fullname" . }} - - configMapRef: - name: {{ include "django.fullname" . }} diff --git a/templates/configmap.yaml b/templates/configmap.yaml deleted file mode 100644 index 6b57ab6..0000000 --- a/templates/configmap.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "django.fullname" . }} - labels: - {{- include "django.labels" . | nindent 4 }} - annotations: - "helm.sh/hook-weight": "-1" -data: -{{- range $k, $v := .Values.environmentVariables }} - {{ $k }}: {{ $v | quote }} -{{- end }} diff --git a/templates/pre-install-job.yaml b/templates/pre-install-job.yaml deleted file mode 100644 index e539a9e..0000000 --- a/templates/pre-install-job.yaml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ include "django.fullname" . }} - labels: - {{- include "django.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-install,pre-upgrade - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - "helm.sh/hook-weight": "0" - checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - tag: "{{ .Values.image.tag }}" -spec: - activeDeadlineSeconds: 600 - template: - spec: - restartPolicy: Never - containers: - - name: pre-install-job - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ["./manage.py","migrate"] - env: - - name: DEBUG - value: "False" - - name: STATIC_URL - value: / - - name: DATABASE_URL - value: {{ required "databaseURL is a required value." .Values.databaseURL }} - - name: SECRET_KEY - value: {{ required "secretKey is a required value." .Values.secretKey }} diff --git a/templates/secrets.yaml b/templates/secrets.yaml deleted file mode 100644 index 505738f..0000000 --- a/templates/secrets.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "django.fullname" . }} - labels: - {{- include "django.labels" . | nindent 4 }} -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 }} - REDIS_URL: {{ printf "redis://:@glitchtip-staging-redis-master:6379/0" | b64enc | quote }} -{{- if .Values.stripeLiveSecretKey }} - STRIPE_LIVE_SECRET_KEY: {{ .Values.stripeLiveSecretKey | b64enc | quote }} -{{- end }} -{{- if .Values.djstripeWebhookSecret }} - DJSTRIPE_WEBHOOK_SECRET: {{ .Values.djstripeWebhookSecret | b64enc | quote }} -{{- end }} diff --git a/templates/serviceaccount.yaml b/templates/serviceaccount.yaml deleted file mode 100644 index c686c91..0000000 --- a/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "django.serviceAccountName" . }} - labels: - {{- include "django.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/templates/tests/test-connection.yaml b/templates/tests/test-connection.yaml deleted file mode 100644 index e3023e4..0000000 --- a/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "django.fullname" . }}-test-connection" - labels: -{{ include "django.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "django.fullname" . }}:{{ .Values.web.service.port }}'] - restartPolicy: Never diff --git a/templates/web/deployment.yaml b/templates/web/deployment.yaml deleted file mode 100644 index 8d109d3..0000000 --- a/templates/web/deployment.yaml +++ /dev/null @@ -1,95 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "django.fullname" . }}-web - labels: - {{- include "django.labels" . | nindent 4 }} - app.kubernetes.io/component: web -spec: - {{- if not .Values.web.autoscaling.enabled }} - replicas: {{ .Values.web.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "django.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: web - template: - metadata: - annotations: - checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - tag: "{{ .Values.image.tag }}" - labels: - {{- include "django.selectorLabels" . | nindent 8 }} - app.kubernetes.io/component: web - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "django.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - 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: - {{- if .Values.redisURL }} - - name: REDIS_URL - value: {{ .Values.redisURL }} - {{- end }} - {{- if .Values.redis.enabled }} - - name: REDIS_PASSWORD - valueFrom: - secretKeyRef: - key: redis-password - name: {{ include "django.fullname" . }}-redis - - name: REDIS_HOST - value: {{ template "django.redis.host" . }} - - name: REDIS_PORT - value: {{ template "django.redis.port" . }} - {{- end }} - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - envFrom: - - secretRef: - name: {{ include "django.fullname" . }} - - configMapRef: - name: {{ include "django.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 }} diff --git a/templates/web/hpa.yaml b/templates/web/hpa.yaml deleted file mode 100644 index a3cfffe..0000000 --- a/templates/web/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.web.autoscaling.enabled -}} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ template "django.fullname" . }}-web - labels: - {{- include "django.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ template "django.fullname" . }}-web - minReplicas: {{ .Values.web.autoscaling.minReplicas }} - maxReplicas: {{ .Values.web.autoscaling.maxReplicas }} - metrics: - {{- if .Values.web.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.web.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.web.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.web.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/templates/web/ingress.yaml b/templates/web/ingress.yaml deleted file mode 100644 index 3f9860d..0000000 --- a/templates/web/ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.web.ingress.enabled -}} -{{- $fullName := include "django.fullname" . -}} -{{- $svcPort := .Values.web.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "django.labels" . | nindent 4 }} - {{- with .Values.web.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if .Values.web.ingress.tls }} - tls: - {{- range .Values.web.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.web.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - backend: - serviceName: {{ $fullName }}-web - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} diff --git a/templates/web/pdb.yaml b/templates/web/pdb.yaml deleted file mode 100644 index e0376b2..0000000 --- a/templates/web/pdb.yaml +++ /dev/null @@ -1,16 +0,0 @@ -{{- if .Values.web.budget -}} -{{- if .Values.web.budget.minAvailable -}} -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: {{ include "django.fullname" . }}-web - labels: - {{- include "django.labels" . | nindent 4 }} -spec: - minAvailable: {{ .Values.web.budget.minAvailable }} - selector: - matchLabels: - {{- include "django.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: web -{{- end -}} -{{- end -}} diff --git a/templates/web/service.yaml b/templates/web/service.yaml deleted file mode 100644 index 8eb3fc5..0000000 --- a/templates/web/service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "django.fullname" . }}-web - labels: - {{- include "django.labels" . | nindent 4 }} -spec: - type: {{ .Values.web.service.type }} - ports: - - port: {{ .Values.web.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "django.selectorLabels" . | nindent 4 }} - app.kubernetes.io/component: web \ No newline at end of file diff --git a/templates/worker/deployment.yaml b/templates/worker/deployment.yaml deleted file mode 100644 index f114446..0000000 --- a/templates/worker/deployment.yaml +++ /dev/null @@ -1,72 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "django.fullname" . }}-worker - labels: - {{- include "django.labels" . | nindent 4 }} - app.kubernetes.io/component: worker -spec: - replicas: {{ .Values.worker.replicaCount }} - selector: - matchLabels: - {{- include "django.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: worker - template: - metadata: - annotations: - checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - tag: "{{ .Values.image.tag }}" - labels: - {{- include "django.selectorLabels" . | nindent 8 }} - app.kubernetes.io/component: worker - 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: 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 "django.fullname" . }}-redis - - name: REDIS_HOST - value: {{ template "django.redis.host" . }} - - name: REDIS_PORT - value: {{ template "django.redis.port" . }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "django.fullname" . }} - - configMapRef: - name: {{ include "django.fullname" . }} - {{- with .Values.worker.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.worker.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.worker.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/templates/worker/hpa.yaml b/templates/worker/hpa.yaml deleted file mode 100644 index 878c6f6..0000000 --- a/templates/worker/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.worker.autoscaling.enabled -}} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ template "django.fullname" . }}-worker - labels: - {{- include "django.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ template "django.fullname" . }}-worker - minReplicas: {{ .Values.worker.autoscaling.minReplicas }} - maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }} - metrics: - {{- if .Values.worker.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.worker.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.worker.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.worker.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} \ No newline at end of file diff --git a/values-sample.yaml b/values-sample.yaml deleted file mode 100644 index df6c311..0000000 --- a/values-sample.yaml +++ /dev/null @@ -1,18 +0,0 @@ -web: - hpa: - enabled: true - resources: - limits: - cpu: 1000m - memory: 512Mi - requests: - cpu: 100m - memory: 128Mi - -worker: - hpa: - enabled: true - -environmentVariables: - ENABLE_SOCIAL_AUTH: true - GLITCHTIP_DOMAIN: https://staging.glitchtip.com diff --git a/values.yaml b/values.yaml index 43733a2..931763f 100644 --- a/values.yaml +++ b/values.yaml @@ -1,7 +1,4 @@ # Default values for glitchtip. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - image: repository: glitchtip/glitchtip tag: latest @@ -10,16 +7,15 @@ image: imagePullSecrets: [] nameOverride: "" fullnameOverride: "" -databaseURL: -secretKey: -redisURL: -# Only needed when using stripe for saas environment -stripeLiveSecretKey: -djstripeWebhookSecret: -environmentVariables: - ENABLE_SOCIAL_AUTH: false - GLITCHTIP_DOMAIN: https://example.com +env: + normal: + DATABASE_URL: + ENABLE_SOCIAL_AUTH: false + GLITCHTIP_DOMAIN: https://example.com + secret: + SECRET_KEY: + REDIS_URL: web: replicaCount: 2 @@ -51,7 +47,7 @@ web: - key: app.kubernetes.io/instance operator: In values: - - glitchtip-prod-web + - glitchtip-web # Change this as needed topologyKey: kubernetes.io/hostname livenessProbe: failureThreshold: 5 @@ -73,13 +69,16 @@ web: # kubernetes.io/tls-acme: "true" hosts: - host: chart-example.local - paths: [] + paths: + - path: / + pathType: ImplementationSpecific tls: [] # - secretName: chart-example-tls # hosts: # - chart-example.local worker: + enabled: true replicaCount: 1 autoscaling: enabled: false @@ -105,18 +104,18 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: + redis: enabled: true master: persistence: enabled: false - slave: + replica: + replicaCount: 1 persistence: enabled: false - cluster: - enabled: false - slaveCount: 1 # Default to disabled, use a managed database service. But can be enabled here. postgresql: enabled: false + postgresqlPassword: # Must be set