Use more generic name "django" instead of glitchtip for template
variables
This commit is contained in:
parent
efc58de740
commit
976c6799dd
|
@ -1,21 +1,21 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- if .Values.web.ingress.enabled }}
|
||||
{{- range $host := .Values.web.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
|
||||
http{{ if $.Values.web.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "glitchtip.fullname" . }})
|
||||
{{- 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.service.type }}
|
||||
{{- 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 "glitchtip.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "glitchtip.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "glitchtip.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
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 }}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "glitchtip.name" -}}
|
||||
{{- define "django.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
@ -11,7 +11,7 @@ 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 "glitchtip.fullname" -}}
|
||||
{{- define "django.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
|
@ -27,16 +27,16 @@ If release name contains chart name it will be used as a full name.
|
|||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "glitchtip.chart" -}}
|
||||
{{- define "django.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "glitchtip.labels" -}}
|
||||
helm.sh/chart: {{ include "glitchtip.chart" . }}
|
||||
{{ include "glitchtip.selectorLabels" . }}
|
||||
{{- define "django.labels" -}}
|
||||
helm.sh/chart: {{ include "django.chart" . }}
|
||||
{{ include "django.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
|
@ -46,17 +46,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "glitchtip.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "glitchtip.name" . }}
|
||||
{{- 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 "glitchtip.serviceAccountName" -}}
|
||||
{{- define "django.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "glitchtip.fullname" .) .Values.serviceAccount.name }}
|
||||
{{ default (include "django.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
|
@ -66,7 +66,7 @@ Create the name of the service account to use
|
|||
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 "glitchtip.postgresql.fullname" -}}
|
||||
{{- define "django.postgresql.fullname" -}}
|
||||
{{- if .Values.postgresql.fullnameOverride -}}
|
||||
{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
|
@ -74,11 +74,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
|
|||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name "glitchtip-postgresql" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- printf "%s-%s" .Release.Name "django-postgresql" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- define "glitchtip.redis.fullname" -}}
|
||||
{{- define "django.redis.fullname" -}}
|
||||
{{- if .Values.redis.fullnameOverride -}}
|
||||
{{- .Values.redis.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
|
@ -86,7 +86,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
|
|||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name "glitchtip-redis" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- printf "%s-%s" .Release.Name "django-redis" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
@ -94,9 +94,9 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
|
|||
{{/*
|
||||
Set redis host
|
||||
*/}}
|
||||
{{- define "glitchtip.redis.host" -}}
|
||||
{{- define "django.redis.host" -}}
|
||||
{{- if .Values.redis.enabled -}}
|
||||
{{- template "glitchtip.redis.fullname" . -}}-redis-master
|
||||
{{- template "django.redis.fullname" . -}}-redis-master
|
||||
{{- else -}}
|
||||
{{- .Values.redis.host | quote -}}
|
||||
{{- end -}}
|
||||
|
@ -105,16 +105,16 @@ Set redis host
|
|||
{{/*
|
||||
Set redis url
|
||||
*/}}
|
||||
{{- define "glitchtip.redis.url" -}}
|
||||
{{- define "django.redis.url" -}}
|
||||
{{- if .Values.redis.enabled -}}
|
||||
redis://{{- template "glitchtip.redis.password" -}}{{- template "glitchtip.redis.fullname" . -}}-master
|
||||
redis://{{- template "django.redis.password" -}}{{- template "django.redis.fullname" . -}}-master
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Set redis port
|
||||
*/}}
|
||||
{{- define "glitchtip.redis.port" -}}
|
||||
{{- define "django.redis.port" -}}
|
||||
{{- if .Values.redis.enabled -}}
|
||||
"6379"
|
||||
{{- else -}}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}-beat
|
||||
name: {{ include "django.fullname" . }}-beat
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: beat
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
|
||||
{{- include "django.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: beat
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
|
@ -16,7 +18,8 @@ spec:
|
|||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
tag: "{{ .Values.image.tag }}"
|
||||
labels:
|
||||
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
|
||||
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: beat
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
|
@ -38,10 +41,6 @@ spec:
|
|||
cpu: 1m
|
||||
memory: 32Mi
|
||||
env:
|
||||
- name: DEBUG
|
||||
value: "False"
|
||||
- name: STATIC_URL
|
||||
value: /
|
||||
- name: SERVER_ROLE
|
||||
value: "beat"
|
||||
{{- if .Values.redisURL }}
|
||||
|
@ -53,14 +52,14 @@ spec:
|
|||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: redis-password
|
||||
name: {{ include "glitchtip.fullname" . }}-redis
|
||||
name: {{ include "django.fullname" . }}-redis
|
||||
- name: REDIS_HOST
|
||||
value: {{ template "glitchtip.redis.host" . }}
|
||||
value: {{ template "django.redis.host" . }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ template "glitchtip.redis.port" . }}
|
||||
value: {{ template "django.redis.port" . }}
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
- configMapRef:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
|
@ -1,9 +1,9 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook-weight": "-1"
|
||||
data:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,pre-upgrade
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
DATABASE_URL: {{ required "databaseURL is a required value." .Values.databaseURL | b64enc | quote }}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "glitchtip.selectorLabels" . | nindent 4 }}
|
||||
role: web
|
|
@ -2,7 +2,11 @@
|
|||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "glitchtip.serviceAccountName" . }}
|
||||
name: {{ include "django.serviceAccountName" . }}
|
||||
labels:
|
||||
{{ include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "glitchtip.fullname" . }}-test-connection"
|
||||
name: "{{ include "django.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{ include "glitchtip.labels" . | nindent 4 }}
|
||||
{{ include "django.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test-success
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "glitchtip.fullname" . }}:{{ .Values.service.port }}']
|
||||
args: ['{{ include "django.fullname" . }}:{{ .Values.web.service.port }}']
|
||||
restartPolicy: Never
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
{{- if .Values.web.hpa.enabled -}}
|
||||
apiVersion: autoscaling/v1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ template "glitchtip.fullname" . }}
|
||||
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" . }}
|
||||
minReplicas: {{ .Values.web.hpa.minpods }}
|
||||
maxReplicas: {{ .Values.web.hpa.maxpods }}
|
||||
targetCPUUtilizationPercentage: {{ .Values.web.hpa.cputhreshold }}
|
||||
{{- end }}
|
|
@ -1,15 +1,18 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}-web
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- 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 "glitchtip.selectorLabels" . | nindent 6 }}
|
||||
role: web
|
||||
{{- include "django.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: web
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
|
@ -17,21 +20,21 @@ spec:
|
|||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
tag: "{{ .Values.image.tag }}"
|
||||
labels:
|
||||
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
|
||||
role: web
|
||||
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: web
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "glitchtip.serviceAccountName" . }}
|
||||
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 }}"
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
|
@ -54,10 +57,6 @@ spec:
|
|||
resources:
|
||||
{{- toYaml .Values.web.resources | nindent 12 }}
|
||||
env:
|
||||
- name: DEBUG
|
||||
value: "False"
|
||||
- name: STATIC_URL
|
||||
value: /
|
||||
{{- if .Values.redisURL }}
|
||||
- name: REDIS_URL
|
||||
value: {{ .Values.redisURL }}
|
||||
|
@ -67,11 +66,11 @@ spec:
|
|||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: redis-password
|
||||
name: {{ include "glitchtip.fullname" . }}-redis
|
||||
name: {{ include "django.fullname" . }}-redis
|
||||
- name: REDIS_HOST
|
||||
value: {{ template "glitchtip.redis.host" . }}
|
||||
value: {{ template "django.redis.host" . }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ template "glitchtip.redis.port" . }}
|
||||
value: {{ template "django.redis.port" . }}
|
||||
{{- end }}
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
|
@ -79,9 +78,9 @@ spec:
|
|||
fieldPath: status.podIP
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
- configMapRef:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
{{- with .Values.web.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
28
templates/web/hpa.yaml
Normal file
28
templates/web/hpa.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
{{- 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 }}
|
|
@ -1,6 +1,6 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "glitchtip.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- 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 -}}
|
||||
|
@ -10,15 +10,15 @@ kind: Ingress
|
|||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
{{- with .Values.web.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
{{- if .Values.web.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
{{- range .Values.web.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
|
@ -27,13 +27,15 @@ spec:
|
|||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
{{- range .Values.web.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- pathType: ImplementationSpecific
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
backend:
|
||||
serviceName: {{ $fullName }}
|
||||
serviceName: {{ $fullName }}-web
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -3,14 +3,14 @@
|
|||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}-web
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
spec:
|
||||
minAvailable: {{ .Values.web.budget.minAvailable }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
|
||||
role: web
|
||||
{{- include "django.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: web
|
||||
{{- end -}}
|
||||
{{- end -}}
|
16
templates/web/service.yaml
Normal file
16
templates/web/service.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
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
|
|
@ -1,19 +0,0 @@
|
|||
{{- 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 }}
|
|
@ -1,14 +1,16 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "glitchtip.fullname" . }}-worker
|
||||
name: {{ include "django.fullname" . }}-worker
|
||||
labels:
|
||||
{{- include "glitchtip.labels" . | nindent 4 }}
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
replicas: {{ .Values.worker.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
|
||||
{{- include "django.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: worker
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
|
@ -16,7 +18,8 @@ spec:
|
|||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
tag: "{{ .Values.image.tag }}"
|
||||
labels:
|
||||
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
|
||||
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
|
@ -33,10 +36,6 @@ spec:
|
|||
resources:
|
||||
{{- toYaml .Values.worker.resources | nindent 12 }}
|
||||
env:
|
||||
- name: DEBUG
|
||||
value: "False"
|
||||
- name: STATIC_URL
|
||||
value: /
|
||||
- name: SERVER_ROLE
|
||||
value: "worker"
|
||||
{{- if .Values.redisURL }}
|
||||
|
@ -48,26 +47,26 @@ spec:
|
|||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: redis-password
|
||||
name: {{ include "glitchtip.fullname" . }}-redis
|
||||
name: {{ include "django.fullname" . }}-redis
|
||||
- name: REDIS_HOST
|
||||
value: {{ template "glitchtip.redis.host" . }}
|
||||
value: {{ template "django.redis.host" . }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ template "glitchtip.redis.port" . }}
|
||||
value: {{ template "django.redis.port" . }}
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
- configMapRef:
|
||||
name: {{ include "glitchtip.fullname" . }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
name: {{ include "django.fullname" . }}
|
||||
{{- with .Values.worker.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
{{- with .Values.worker.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
{{- with .Values.worker.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
28
templates/worker/hpa.yaml
Normal file
28
templates/worker/hpa.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
{{- 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 }}
|
99
values.yaml
99
values.yaml
|
@ -22,25 +22,37 @@ environmentVariables:
|
|||
GLITCHTIP_DOMAIN: https://example.com
|
||||
|
||||
web:
|
||||
replicaCount: 1
|
||||
hpa:
|
||||
replicaCount: 2
|
||||
autoscaling:
|
||||
enabled: false
|
||||
cputhreshold: 70
|
||||
minpods: 2
|
||||
maxpods: 4
|
||||
# budget:
|
||||
# minAvailable: 1
|
||||
minReplicas: 1
|
||||
maxReplicas: 10
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
budget:
|
||||
minAvailable: 1
|
||||
resources:
|
||||
{}
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 256Mi
|
||||
# requests:
|
||||
# cpu: 50m
|
||||
# memory: 128Mi
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app.kubernetes.io/instance
|
||||
operator: In
|
||||
values:
|
||||
- glitchtip-prod-web
|
||||
topologyKey: kubernetes.io/hostname
|
||||
livenessProbe:
|
||||
failureThreshold: 5
|
||||
initialDelaySeconds: 5
|
||||
|
@ -49,22 +61,39 @@ web:
|
|||
failureThreshold: 10
|
||||
initialDelaySeconds: 5
|
||||
timeoutSeconds: 2
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
annotations:
|
||||
{}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths: []
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
worker:
|
||||
replicaCount: 1
|
||||
hpa:
|
||||
autoscaling:
|
||||
enabled: false
|
||||
cputhreshold: 90
|
||||
minpods: 1
|
||||
maxpods: 4
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 90
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
resources:
|
||||
{}
|
||||
# limits:
|
||||
# cpu: 500m
|
||||
# memory: 256Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
limits:
|
||||
cpu: 900m
|
||||
memory: 768Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
|
@ -76,24 +105,6 @@ serviceAccount:
|
|||
# If not set and create is true, a name is generated using the fullname template
|
||||
name:
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
annotations:
|
||||
{}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths: []
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
redis:
|
||||
enabled: true
|
||||
master:
|
||||
|
|
Loading…
Reference in a new issue