First charts - obsidian and trilium with syncthing

This commit is contained in:
2024-09-22 09:00:34 +01:00
parent 4f55980f3a
commit 89e3e40938
22 changed files with 496 additions and 0 deletions

View File

@@ -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/

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: obsidian-syncthing-chart
description: A Helm chart to deploy Obsidian with Syncthing for vault synchronization
version: 0.1.2
appVersion: "latest"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "obsidian-syncthing-chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "obsidian-syncthing-chart.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "obsidian-syncthing-chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "obsidian-syncthing-chart.labels" -}}
helm.sh/chart: {{ include "obsidian-syncthing-chart.chart" . }}
{{ include "obsidian-syncthing-chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "obsidian-syncthing-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "obsidian-syncthing-chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "obsidian-syncthing-chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "obsidian-syncthing-chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "obsidian-syncthing-chart.fullname" . }}
labels:
app: {{ include "obsidian-syncthing-chart.name" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "obsidian-syncthing-chart.name" . }}
template:
metadata:
labels:
app: {{ include "obsidian-syncthing-chart.name" . }}
spec:
containers:
- name: obsidian
image: "{{ .Values.image.obsidian.repository }}:{{ .Values.image.obsidian.tag }}"
imagePullPolicy: {{ .Values.image.obsidian.pullPolicy }}
ports:
- containerPort: 3000
volumeMounts:
- name: obsidian-vault
mountPath: /config
- name: syncthing
image: "{{ .Values.image.syncthing.repository }}:{{ .Values.image.syncthing.tag }}"
imagePullPolicy: {{ .Values.image.syncthing.pullPolicy }}
ports:
- containerPort: 8384
volumeMounts:
- name: obsidian-vault
mountPath: /vault
- name: syncthing-config
mountPath: /config
volumes:
- name: obsidian-vault
persistentVolumeClaim:
claimName: obsidian-vault-pvc
- name: syncthing-config
persistentVolumeClaim:
claimName: syncthing-config-pvc

View File

@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: obsidian-ingress
spec:
defaultBackend:
service:
name: {{ include "obsidian-syncthing-chart.fullname" . }}-obsidian
port:
number: 3000
ingressClassName: tailscale
tls:
- hosts:
- notes

View File

@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: syncthing-ingress
spec:
defaultBackend:
service:
name: {{ include "obsidian-syncthing-chart.fullname" . }}-syncthing
port:
number: 8384
ingressClassName: tailscale
tls:
- hosts:
- syncthing-notes

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: obsidian-vault-pvc
labels:
app: obsidian-syncthing
spec:
storageClassName: {{ .Values.persistentVolume.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.persistentVolume.size }}

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: syncthing-config-pvc
labels:
app: obsidian-syncthing
spec:
storageClassName: {{ .Values.persistentVolume.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "100Mi"

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "obsidian-syncthing-chart.fullname" . }}-obsidian
labels:
app: {{ include "obsidian-syncthing-chart.name" . }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.obsidian.port }}
targetPort: 3000
protocol: TCP
name: http
selector:
app: {{ include "obsidian-syncthing-chart.name" . }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "obsidian-syncthing-chart.fullname" . }}-syncthing
labels:
app: {{ include "obsidian-syncthing-chart.name" . }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.syncthing.port }}
targetPort: 8384
protocol: TCP
name: syncthing
selector:
app: {{ include "obsidian-syncthing-chart.name" . }}

View File

@@ -0,0 +1,28 @@
replicaCount: 1
image:
obsidian:
repository: linuxserver/obsidian
tag: "1.6.7"
pullPolicy: IfNotPresent
syncthing:
repository: linuxserver/syncthing
tag: "1.27.11"
pullPolicy: IfNotPresent
service:
obsidian:
type: ClusterIP
port: 3000
syncthing:
type: ClusterIP
port: 8384
persistentVolume:
storageClass: "longhorn"
size: "5Gi"
resources: {}
nodeSelector: {}
tolerations: []
affinity: []

View File

@@ -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/

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: trilium-syncthing-chart
description: A Helm chart to deploy Trillium with Syncthing for vault synchronization
version: 0.1.2
appVersion: "latest"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "trilium-syncthing-chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "trilium-syncthing-chart.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "trilium-syncthing-chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "trilium-syncthing-chart.labels" -}}
helm.sh/chart: {{ include "trilium-syncthing-chart.chart" . }}
{{ include "trilium-syncthing-chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "trilium-syncthing-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "trilium-syncthing-chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "trilium-syncthing-chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "trilium-syncthing-chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "trilium-syncthing-chart.fullname" . }}
labels:
app: {{ include "trilium-syncthing-chart.name" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "trilium-syncthing-chart.name" . }}
template:
metadata:
labels:
app: {{ include "trilium-syncthing-chart.name" . }}
spec:
containers:
- name: trilium
image: "{{ .Values.image.trilium.repository }}:{{ .Values.image.trilium.tag }}"
imagePullPolicy: {{ .Values.image.trilium.pullPolicy }}
ports:
- containerPort: 8080
volumeMounts:
- name: trilium-vault
mountPath: /home/node/trilium-data
securityContext:
runAsUser: 1000
- name: syncthing
image: "{{ .Values.image.syncthing.repository }}:{{ .Values.image.syncthing.tag }}"
imagePullPolicy: {{ .Values.image.syncthing.pullPolicy }}
ports:
- containerPort: 8384
volumeMounts:
- name: trilium-vault
mountPath: /vault
- name: syncthing-config
mountPath: /config
securityContext:
runAsUser: 1000
volumes:
- name: trilium-vault
persistentVolumeClaim:
claimName: trilium-vault-pvc
- name: syncthing-config
persistentVolumeClaim:
claimName: syncthing-config-pvc

View File

@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: syncthing-ingress
spec:
defaultBackend:
service:
name: {{ include "trilium-syncthing-chart.fullname" . }}-syncthing
port:
number: 8384
ingressClassName: tailscale
tls:
- hosts:
- syncthing-notes

View File

@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: trilium-ingress
spec:
defaultBackend:
service:
name: {{ include "trilium-syncthing-chart.fullname" . }}-trilium
port:
number: 8080
ingressClassName: tailscale
tls:
- hosts:
- notes

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: syncthing-config-pvc
labels:
app: trilium-syncthing
spec:
storageClassName: {{ .Values.persistentVolume.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "100Mi"

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: trilium-vault-pvc
labels:
app: trilium-syncthing
spec:
storageClassName: {{ .Values.persistentVolume.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.persistentVolume.size }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "trilium-syncthing-chart.fullname" . }}-syncthing
labels:
app: {{ include "trilium-syncthing-chart.name" . }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.syncthing.port }}
targetPort: 8384
protocol: TCP
name: syncthing
selector:
app: {{ include "trilium-syncthing-chart.name" . }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "trilium-syncthing-chart.fullname" . }}-trilium
labels:
app: {{ include "trilium-syncthing-chart.name" . }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.trilium.port }}
targetPort: 8080
protocol: TCP
name: http
selector:
app: {{ include "trilium-syncthing-chart.name" . }}

View File

@@ -0,0 +1,28 @@
replicaCount: 1
image:
trilium:
repository: triliumnext/notes
tag: "v0.90.4"
pullPolicy: IfNotPresent
syncthing:
repository: linuxserver/syncthing
tag: "1.27.11"
pullPolicy: IfNotPresent
service:
trilium:
type: ClusterIP
port: 8080
syncthing:
type: ClusterIP
port: 8384
persistentVolume:
storageClass: "longhorn"
size: "5Gi"
resources: {}
nodeSelector: {}
tolerations: []
affinity: []