feat(dispatch) add support for Netflix Dispatch

This commit is contained in:
Tommy 2023-12-15 18:53:09 +01:00
parent 744c654213
commit bb50fc9fde
No known key found for this signature in database
9 changed files with 186 additions and 0 deletions

View file

@ -0,0 +1,4 @@
apiVersion: v2
name: dispatch
description: Netflix Dispatch incident management system
version: 0.1.0

View file

@ -0,0 +1 @@
NOTES.txt

View file

@ -0,0 +1,30 @@
# Define a template for the chart's full name.
{{/*
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 "dispatch.fullname" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}
# Define a template for standard labels.
{{/*
Common labels
*/}}
{{- define "dispatch.labels" -}}
helm.sh/chart: {{ include "dispatch.chart" . }}
app.kubernetes.io/name: {{ include "dispatch.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.Version | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
# Define a template for the chart name and version.
{{/*
Generate basic labels
*/}}
{{- define "dispatch.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" -}}
{{- end }}
# Optionally, add more helper templates as needed.

View file

@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "dispatch.fullname" . }}-config
labels:
{{- include "dispatch.labels" . | nindent 4 }}
data:
{{- toYaml .Values.configMap.general | nindent 2 }}

View file

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "dispatch.fullname" . }}-core
labels:
{{- include "dispatch.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "dispatch.fullname" . }}-core
template:
metadata:
labels:
app: {{ include "dispatch.fullname" . }}-core
spec:
initContainers:
- name: db-init
image: "{{ .Values.initContainers.dbInit.image.repository }}:{{ .Values.initContainers.dbInit.image.tag }}"
envFrom:
- secretRef:
name: {{ .Values.postgres.secretRef.name }}
containers:
- name: core
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: {{ .Values.core.container.command }}
envFrom:
- configMapRef:
name: {{ include "dispatch.fullname" . }}-config
- secretRef:
name: {{ .Values.postgres.secretRef.name }}

View file

@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "dispatch.fullname" . }}-scheduler
labels:
{{- include "dispatch.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "dispatch.fullname" . }}-scheduler
template:
metadata:
labels:
app: {{ include "dispatch.fullname" . }}-scheduler
spec:
containers:
- name: scheduler
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: {{ .Values.scheduler.command }}
envFrom:
- configMapRef:
name: {{ include "dispatch.fullname" . }}-config
- secretRef:
name: {{ .Values.postgres.secretRef.name }}

View file

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "dispatch.fullname" . }}-web
labels:
{{- include "dispatch.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "dispatch.fullname" . }}-web
template:
metadata:
labels:
app: {{ include "dispatch.fullname" . }}-web
spec:
containers:
- name: web
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: {{ .Values.web.command }}
ports:
- containerPort: {{ .Values.web.container.port }}
service:
type: ClusterIP
port: 80
targetPort: 8000
envFrom:
- configMapRef:
name: {{ include "dispatch.fullname" . }}-config
- secretRef:
name: {{ .Values.postgres.secretRef.name }}

View file

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "dispatch.fullname" . }}-web
labels:
{{- include "dispatch.labels" . | nindent 4 }}
spec:
type: {{ .Values.web.service.type }}
ports:
- port: {{ .Values.web.service.port }}
targetPort: {{ .Values.web.container.port }}
protocol: TCP
selector:
app: {{ include "dispatch.fullname" . }}-web

View file

@ -0,0 +1,39 @@
image:
repository: ghcr.io/tommy-skaug/dispatch
tag: v20230919
pullPolicy: Always
initContainers:
dbInit:
image:
repository: ghcr.io/onedr0p/postgres-init
tag: "16"
envFrom:
- secretRef:
name: dispatch-secret
core:
container:
command: []
web:
container:
port: 8000
command: ["server", "start", "dispatch.main:app", "--host=0.0.0.0"]
service:
type: ClusterIP
port: 80
scheduler:
command: ["scheduler", "start"]
configMap:
general:
COMPOSE_PROJECT_NAME: "dispatch"
DATABASE_HOSTNAME: "postgres-rw.databases.svc.cluster.local"
DATABASE_NAME: "dispatch"
DATABASE_PORT: "5432"
postgres:
secretRef:
name: dispatch-secret