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: 1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }} {{- if .Values.web.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }} {{- range $host := .Values.web.ingress.hosts }}
{{- range .paths }} {{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }} {{- end }}
{{- 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_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}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT 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. 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" . }}' 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 }}"}}") 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 }} echo http://$SERVICE_IP:{{ .Values.web.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }} {{- 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}") 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" echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80

View file

@ -4,11 +4,13 @@ metadata:
name: {{ include "glitchtip.fullname" . }}-beat name: {{ include "glitchtip.fullname" . }}-beat
labels: labels:
{{- include "glitchtip.labels" . | nindent 4 }} {{- include "glitchtip.labels" . | nindent 4 }}
app.kubernetes.io/component: beat
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }} {{- include "glitchtip.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: beat
template: template:
metadata: metadata:
annotations: annotations:
@ -17,6 +19,7 @@ spec:
tag: "{{ .Values.image.tag }}" tag: "{{ .Values.image.tag }}"
labels: labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }} {{- include "glitchtip.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: beat
spec: spec:
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
@ -38,10 +41,6 @@ spec:
cpu: 1m cpu: 1m
memory: 32Mi memory: 32Mi
env: env:
- name: DEBUG
value: "False"
- name: STATIC_URL
value: /
- name: SERVER_ROLE - name: SERVER_ROLE
value: "beat" value: "beat"
{{- if .Values.redisURL }} {{- if .Values.redisURL }}

View file

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

View file

@ -5,11 +5,11 @@ metadata:
labels: labels:
{{ include "glitchtip.labels" . | nindent 4 }} {{ include "glitchtip.labels" . | nindent 4 }}
annotations: annotations:
"helm.sh/hook": test-success "helm.sh/hook": test
spec: spec:
containers: containers:
- name: wget - name: wget
image: busybox image: busybox
command: ['wget'] command: ['wget']
args: ['{{ include "glitchtip.fullname" . }}:{{ .Values.service.port }}'] args: ['{{ include "glitchtip.fullname" . }}:{{ .Values.web.service.port }}']
restartPolicy: Never restartPolicy: Never

View file

@ -1,15 +1,18 @@
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 }}
app.kubernetes.io/component: web
spec: spec:
{{- if not .Values.web.autoscaling.enabled }}
replicas: {{ .Values.web.replicaCount }} replicas: {{ .Values.web.replicaCount }}
{{- end }}
selector: selector:
matchLabels: matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }} {{- include "glitchtip.selectorLabels" . | nindent 6 }}
role: web app.kubernetes.io/component: web
template: template:
metadata: metadata:
annotations: annotations:
@ -18,7 +21,7 @@ spec:
tag: "{{ .Values.image.tag }}" tag: "{{ .Values.image.tag }}"
labels: labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }} {{- include "glitchtip.selectorLabels" . | nindent 8 }}
role: web app.kubernetes.io/component: web
spec: spec:
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
@ -31,7 +34,7 @@ spec:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- 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 }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
- name: http - name: http
@ -54,10 +57,6 @@ spec:
resources: resources:
{{- toYaml .Values.web.resources | nindent 12 }} {{- toYaml .Values.web.resources | nindent 12 }}
env: env:
- name: DEBUG
value: "False"
- name: STATIC_URL
value: /
{{- if .Values.redisURL }} {{- if .Values.redisURL }}
- name: REDIS_URL - name: REDIS_URL
value: {{ .Values.redisURL }} value: {{ .Values.redisURL }}

View file

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

View file

@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.web.ingress.enabled -}}
{{- $fullName := include "glitchtip.fullname" . -}} {{- $fullName := include "glitchtip.fullname" . -}}
{{- $svcPort := .Values.service.port -}} {{- $svcPort := .Values.web.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1beta1
{{- else -}} {{- else -}}
@ -11,14 +11,14 @@ metadata:
name: {{ $fullName }} name: {{ $fullName }}
labels: labels:
{{- include "glitchtip.labels" . | nindent 4 }} {{- include "glitchtip.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }} {{- with .Values.web.ingress.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.ingress.tls }} {{- if .Values.web.ingress.tls }}
tls: tls:
{{- range .Values.ingress.tls }} {{- range .Values.web.ingress.tls }}
- hosts: - hosts:
{{- range .hosts }} {{- range .hosts }}
- {{ . | quote }} - {{ . | quote }}
@ -27,13 +27,15 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range .Values.ingress.hosts }} {{- range .Values.web.ingress.hosts }}
- host: {{ .host | quote }} - host: {{ .host | quote }}
http: http:
paths: paths:
- pathType: ImplementationSpecific {{- range .paths }}
- path: {{ .path }}
backend: backend:
serviceName: {{ $fullName }} serviceName: {{ $fullName }}-web
servicePort: {{ $svcPort }} servicePort: {{ $svcPort }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}

View file

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

View file

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

View file

@ -4,11 +4,13 @@ metadata:
name: {{ include "glitchtip.fullname" . }}-worker name: {{ include "glitchtip.fullname" . }}-worker
labels: labels:
{{- include "glitchtip.labels" . | nindent 4 }} {{- include "glitchtip.labels" . | nindent 4 }}
app.kubernetes.io/component: worker
spec: spec:
replicas: {{ .Values.worker.replicaCount }} replicas: {{ .Values.worker.replicaCount }}
selector: selector:
matchLabels: matchLabels:
{{- include "glitchtip.selectorLabels" . | nindent 6 }} {{- include "glitchtip.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: worker
template: template:
metadata: metadata:
annotations: annotations:
@ -17,6 +19,7 @@ spec:
tag: "{{ .Values.image.tag }}" tag: "{{ .Values.image.tag }}"
labels: labels:
{{- include "glitchtip.selectorLabels" . | nindent 8 }} {{- include "glitchtip.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: worker
spec: spec:
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
@ -33,10 +36,6 @@ spec:
resources: resources:
{{- toYaml .Values.worker.resources | nindent 12 }} {{- toYaml .Values.worker.resources | nindent 12 }}
env: env:
- name: DEBUG
value: "False"
- name: STATIC_URL
value: /
- name: SERVER_ROLE - name: SERVER_ROLE
value: "worker" value: "worker"
{{- if .Values.redisURL }} {{- if .Values.redisURL }}

View file

@ -51,6 +51,23 @@ web:
failureThreshold: 10 failureThreshold: 10
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 2 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: worker:
replicaCount: 1 replicaCount: 1
@ -79,24 +96,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:
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: redis:
enabled: true enabled: true
master: master: