Skip to content

Commit

Permalink
feat: helm
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 committed Jan 19, 2025
1 parent 3294ff7 commit ac40011
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 0 deletions.
23 changes: 23 additions & 0 deletions helm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
8 changes: 8 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
name: synctv
description: A Helm chart for deploying Synctv application with PostgreSQL StatefulSet

type: application

version: 0.1.0
appVersion: "1.0"
Empty file added helm/templates/_helpers.tpl
Empty file.
11 changes: 11 additions & 0 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.synctv.envConfigName }}
data:
DATABASE_TYPE: postgres
DATABASE_HOST: synctv-postgresql
DATABASE_PORT: "5432"
DATABASE_USER: postgres
DATABASE_PASSWORD: synctv
DATABASE_NAME: postgres
33 changes: 33 additions & 0 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: synctv
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: synctv
port:
number: 8080
{{- end }}
tls:
{{- range .Values.ingress.hosts }}
- hosts:
- {{ .host | quote }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions helm/templates/service-postgresql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.postgresql.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: synctv-postgresql
labels:
app: synctv-postgresql
spec:
ports:
- port: {{ .Values.postgresql.service.port }}
targetPort: {{ .Values.postgresql.service.port }}
selector:
app: synctv-postgresql
{{- end }}
12 changes: 12 additions & 0 deletions helm/templates/service-synctv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: synctv
labels:
app: synctv
spec:
ports:
- port: 8080
targetPort: 8080
selector:
app: synctv
41 changes: 41 additions & 0 deletions helm/templates/statefulset-postgresql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.postgresql.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: synctv-postgresql
labels:
app: synctv-postgresql
spec:
replicas: {{ .Values.postgresql.replicaCount }}
selector:
matchLabels:
app: synctv-postgresql
template:
metadata:
labels:
app: synctv-postgresql
spec:
containers:
- name: postgresql
image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
ports:
- containerPort: {{ .Values.postgresql.service.port }}
env:
- name: POSTGRES_PASSWORD
value: {{ .Values.postgresql.password | quote }}
volumeMounts:
- name: postgresql-storage
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: postgresql-storage
spec:
{{- with .Values.postgresql.storage.storageClass }}
storageClassName: {{ . }}
{{- end }}
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: {{ .Values.postgresql.storage.size }}
{{- end }}
48 changes: 48 additions & 0 deletions helm/templates/statefulset-synctv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: synctv
labels:
app: synctv
spec:
selector:
matchLabels:
app: synctv
template:
metadata:
labels:
app: synctv
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- synctv-postgresql
topologyKey: kubernetes.io/hostname
containers:
- name: synctv
image: {{ .Values.synctv.image.repository }}:{{ .Values.synctv.image.tag }}
imagePullPolicy: {{ .Values.synctv.image.pullPolicy }}
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: {{ .Values.synctv.envConfigName }}
volumeMounts:
- name: synctv-storage
mountPath: /root/.synctv
volumeClaimTemplates:
- metadata:
name: synctv-storage
spec:
{{- with .Values.synctv.storage.storageClass }}
storageClassName: {{ . }}
{{- end }}
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: {{ .Values.synctv.storage.size }}
29 changes: 29 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Default values for synctv.
synctv:
image:
repository: synctvorg/synctv
tag: latest
pullPolicy: IfNotPresent
envConfigName: synctv-env
storage:
size: 1Gi
storageClass: ""

postgresql:
enabled: true
replicaCount: 1
service:
port: 5432
image:
repository: pgvector/pgvector
tag: pg16
pullPolicy: IfNotPresent
password: synctv
storage:
size: 1Gi
storageClass: ""

ingress:
enabled: true
className: nginx
annotations: {}

0 comments on commit ac40011

Please sign in to comment.