diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e59bd13..b9b6578 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -250,7 +250,6 @@ jobs: if: ${{ github.event_name != 'pull_request' }} steps: - name: Login to GitHub Container Registry - if: ${{ github.event_name != 'pull_request' }} uses: docker/login-action@v3 with: registry: ghcr.io diff --git a/helm/.helmignore b/helm/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/.helmignore @@ -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/ diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..c5a1ab3 --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: synctv +description: A Helm chart for deploying Synctv application with PostgreSQL StatefulSet + +type: application + +appVersion: 0.9.2 +version: 0.9.2 diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl new file mode 100644 index 0000000..e69de29 diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml new file mode 100644 index 0000000..43e38ef --- /dev/null +++ b/helm/templates/configmap.yaml @@ -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 diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml new file mode 100644 index 0000000..576966e --- /dev/null +++ b/helm/templates/ingress.yaml @@ -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 }} diff --git a/helm/templates/service-postgresql.yaml b/helm/templates/service-postgresql.yaml new file mode 100644 index 0000000..3031f00 --- /dev/null +++ b/helm/templates/service-postgresql.yaml @@ -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 }} diff --git a/helm/templates/service-synctv.yaml b/helm/templates/service-synctv.yaml new file mode 100644 index 0000000..74d5091 --- /dev/null +++ b/helm/templates/service-synctv.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: synctv + labels: + app: synctv +spec: + ports: + - port: 8080 + targetPort: 8080 + selector: + app: synctv diff --git a/helm/templates/statefulset-postgresql.yaml b/helm/templates/statefulset-postgresql.yaml new file mode 100644 index 0000000..8e711a2 --- /dev/null +++ b/helm/templates/statefulset-postgresql.yaml @@ -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 }} diff --git a/helm/templates/statefulset-synctv.yaml b/helm/templates/statefulset-synctv.yaml new file mode 100644 index 0000000..753f084 --- /dev/null +++ b/helm/templates/statefulset-synctv.yaml @@ -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 | default .Chart.AppVersion }} + 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 }} diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..9cacef2 --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1,29 @@ +# Default values for synctv. +synctv: + image: + repository: synctvorg/synctv + tag: "" + 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: {}