Folders for components

This commit is contained in:
David Burke 2021-02-12 17:18:07 -05:00
parent 3077a1d304
commit e957cae6de
12 changed files with 63 additions and 61 deletions

View file

@ -1,20 +1,20 @@
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.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
{{- else if contains "NodePort" .Values.web.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "glitchtip.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 }}
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 "glitchtip.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

View file

@ -4,11 +4,13 @@ metadata:
name: {{ include "glitchtip.fullname" . }}-beat
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
app.kubernetes.io/component: beat
spec:
replicas: 1
selector:
matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: beat
template:
metadata:
annotations:
@ -17,6 +19,7 @@ spec:
tag: "{{ .Values.image.tag }}"
labels:
{{- include "glitchtip.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 }}

View file

@ -4,5 +4,9 @@ kind: ServiceAccount
metadata:
name: {{ include "glitchtip.serviceAccountName" . }}
labels:
{{ include "glitchtip.labels" . | nindent 4 }}
{{- end -}}
{{- include "glitchtip.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View file

@ -5,11 +5,11 @@ metadata:
labels:
{{ include "glitchtip.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 "glitchtip.fullname" . }}:{{ .Values.web.service.port }}']
restartPolicy: Never

View file

@ -1,15 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "glitchtip.fullname" . }}
name: {{ include "glitchtip.fullname" . }}-web
labels:
{{- include "glitchtip.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
app.kubernetes.io/component: web
template:
metadata:
annotations:
@ -18,7 +21,7 @@ spec:
tag: "{{ .Values.image.tag }}"
labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }}
role: web
app.kubernetes.io/component: web
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
@ -31,7 +34,7 @@ spec:
- 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 }}

View file

@ -9,7 +9,7 @@ spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "glitchtip.fullname" . }}
name: {{ template "glitchtip.fullname" . }}-web
minReplicas: {{ .Values.web.autoscaling.minReplicas }}
maxReplicas: {{ .Values.web.autoscaling.maxReplicas }}
metrics:

View file

@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.web.ingress.enabled -}}
{{- $fullName := include "glitchtip.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- $svcPort := .Values.web.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
@ -11,14 +11,14 @@ metadata:
name: {{ $fullName }}
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
{{- 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 }}

View file

@ -3,7 +3,7 @@
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ include "glitchtip.fullname" . }}
name: {{ include "glitchtip.fullname" . }}-web
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
@ -11,6 +11,6 @@ spec:
selector:
matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
role: web
app.kubernetes.io/component: web
{{- end -}}
{{- end -}}

View file

@ -1,16 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "glitchtip.fullname" . }}
name: {{ include "glitchtip.fullname" . }}-web
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
type: {{ .Values.web.service.type }}
ports:
- port: {{ .Values.service.port }}
- port: {{ .Values.web.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "glitchtip.selectorLabels" . | nindent 4 }}
role: web
app.kubernetes.io/component: web

View file

@ -4,11 +4,13 @@ metadata:
name: {{ include "glitchtip.fullname" . }}-worker
labels:
{{- include "glitchtip.labels" . | nindent 4 }}
app.kubernetes.io/component: worker
spec:
replicas: {{ .Values.worker.replicaCount }}
selector:
matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: worker
template:
metadata:
annotations:
@ -17,6 +19,7 @@ spec:
tag: "{{ .Values.image.tag }}"
labels:
{{- include "glitchtip.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 }}

View file

@ -31,7 +31,7 @@ web:
# targetMemoryUtilizationPercentage: 80
# budget:
# minAvailable: 1
# minAvailable: 1
resources:
{}
# limits:
@ -51,6 +51,23 @@ 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
@ -79,24 +96,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: