feat: add storage to linkding deployment
This commit is contained in:
@@ -21,4 +21,11 @@ spec:
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
resources: {}
|
||||
volumeMounts:
|
||||
- mountPath: /etc/linkding/data
|
||||
name: data
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: linking-pvc
|
||||
status: {}
|
||||
|
||||
12
apps/hydra/linkding/pvc.yaml
Normal file
12
apps/hydra/linkding/pvc.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: linking-pvc
|
||||
namespace: linkding
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
status: {}
|
||||
@@ -11,22 +11,26 @@ import (
|
||||
var meta kube.Metadata
|
||||
var Namespace = kube.Namespace("linkding")
|
||||
var srv core.Service
|
||||
var pvc core.PersistentVolumeClaim
|
||||
|
||||
func init() {
|
||||
meta = kube.NewMetadata("linking", Namespace)
|
||||
srv = meta.Service(root.Linkding.Port)
|
||||
pvc = meta.PVC()
|
||||
}
|
||||
|
||||
func Stack() stack.Stack {
|
||||
s := stack.NewStack("linkding", map[string]any{
|
||||
"namespace": Namespace,
|
||||
"srv": srv,
|
||||
"pvc": pvc,
|
||||
"deployment": deployment(),
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
func deployment() apps.Deployment {
|
||||
storage := kube.NewVolumeFrom(kube.VolumeSourcePVC, "data", pvc.Name)
|
||||
pod_spec := core.PodSpec{
|
||||
Containers: []core.Container{
|
||||
{
|
||||
@@ -35,8 +39,17 @@ func deployment() apps.Deployment {
|
||||
Ports: []core.ContainerPort{{
|
||||
ContainerPort: root.Linkding.Port,
|
||||
}},
|
||||
VolumeMounts: []core.VolumeMount{
|
||||
{
|
||||
Name: storage.Name,
|
||||
MountPath: "/etc/linkding/data",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Volumes: []core.Volume{
|
||||
storage,
|
||||
},
|
||||
}
|
||||
return kube.NewDeployment(meta, pod_spec)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user