Files
poimen-memory/k8s/app/obsidian.yaml
T

151 lines
3.5 KiB
YAML
Raw Normal View History

---
# Obsidian server deployment
# Serves local vault with web UI and API
apiVersion: apps/v1
kind: Deployment
metadata:
name: obsidian-server
namespace: poimen
labels:
app.kubernetes.io/name: obsidian-server
app.kubernetes.io/part-of: poimen-memory
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: obsidian-server
template:
metadata:
labels:
app.kubernetes.io/name: obsidian-server
app.kubernetes.io/part-of: poimen-memory
spec:
serviceAccountName: obsidian-server
initContainers:
- name: git-sync-init
image: alpine/git:latest
command:
- sh
- -c
- |
export GIT_SSH_COMMAND="ssh -i /root/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
if [ -d /vault/.git ]; then
cd /vault && git pull origin main || true
else
# Clone into temp, move contents into vault
rm -rf /tmp/repo
git clone ssh://[email protected]:2222/rock/poimen-obesdient-memory.git /tmp/repo
cp -a /tmp/repo/. /vault/
rm -rf /tmp/repo
fi
volumeMounts:
- name: vault
mountPath: /vault
- name: ssh-key
mountPath: /root/.ssh
readOnly: true
containers:
- name: obsidian-server
image: ppatlabs/obsidian:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 27124
protocol: TCP
env:
- name: VAULT_NAME
value: poimen-vault
- name: VAULT_PATH
value: /vault
- name: REST_API_ENABLED
value: "true"
- name: REST_API_PORT
value: "8080"
volumeMounts:
- name: vault
mountPath: /vault
- name: config
mountPath: /config
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
httpGet:
path: /
port: http
scheme: HTTPS
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
port: http
scheme: HTTPS
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 5
volumes:
- name: vault
persistentVolumeClaim:
claimName: obsidian-vault
- name: config
emptyDir: {}
- name: ssh-key
secret:
secretName: obsidian-git-ssh
defaultMode: 0400
---
# PVC for vault storage
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: obsidian-vault
namespace: poimen
labels:
app.kubernetes.io/name: obsidian-server
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 10Gi
---
# Service for Obsidian server
apiVersion: v1
kind: Service
metadata:
name: obsidian-server
namespace: poimen
labels:
app.kubernetes.io/name: obsidian-server
spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: 27124
protocol: TCP
selector:
app.kubernetes.io/name: obsidian-server
---
# ServiceAccount for Obsidian
apiVersion: v1
kind: ServiceAccount
metadata:
name: obsidian-server
namespace: poimen
labels:
app.kubernetes.io/name: obsidian-server
# Ingress managed by homelab repo (obsidian.riotpiao.com)
# See: homelab/k8s/bootstrap/ingress/ingress.yaml