feat: add storage to linkding deployment

This commit is contained in:
Daniel Cosme
2026-04-18 10:18:07 -04:00
parent 3a0b0d7f72
commit ae768dfc95
3 changed files with 32 additions and 0 deletions
+7
View File
@@ -21,4 +21,11 @@ spec:
ports: ports:
- containerPort: 9090 - containerPort: 9090
resources: {} resources: {}
volumeMounts:
- mountPath: /etc/linkding/data
name: data
volumes:
- name: data
persistentVolumeClaim:
claimName: linking-pvc
status: {} status: {}
+12
View File
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: linking-pvc
namespace: linkding
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
status: {}
+13
View File
@@ -11,22 +11,26 @@ import (
var meta kube.Metadata var meta kube.Metadata
var Namespace = kube.Namespace("linkding") var Namespace = kube.Namespace("linkding")
var srv core.Service var srv core.Service
var pvc core.PersistentVolumeClaim
func init() { func init() {
meta = kube.NewMetadata("linking", Namespace) meta = kube.NewMetadata("linking", Namespace)
srv = meta.Service(root.Linkding.Port) srv = meta.Service(root.Linkding.Port)
pvc = meta.PVC()
} }
func Stack() stack.Stack { func Stack() stack.Stack {
s := stack.NewStack("linkding", map[string]any{ s := stack.NewStack("linkding", map[string]any{
"namespace": Namespace, "namespace": Namespace,
"srv": srv, "srv": srv,
"pvc": pvc,
"deployment": deployment(), "deployment": deployment(),
}) })
return s return s
} }
func deployment() apps.Deployment { func deployment() apps.Deployment {
storage := kube.NewVolumeFrom(kube.VolumeSourcePVC, "data", pvc.Name)
pod_spec := core.PodSpec{ pod_spec := core.PodSpec{
Containers: []core.Container{ Containers: []core.Container{
{ {
@@ -35,8 +39,17 @@ func deployment() apps.Deployment {
Ports: []core.ContainerPort{{ Ports: []core.ContainerPort{{
ContainerPort: root.Linkding.Port, ContainerPort: root.Linkding.Port,
}}, }},
VolumeMounts: []core.VolumeMount{
{
Name: storage.Name,
MountPath: "/etc/linkding/data",
}, },
}, },
},
},
Volumes: []core.Volume{
storage,
},
} }
return kube.NewDeployment(meta, pod_spec) return kube.NewDeployment(meta, pod_spec)
} }