feat: Add security context to linkding
This commit is contained in:
@@ -21,9 +21,15 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 9090
|
- containerPort: 9090
|
||||||
resources: {}
|
resources: {}
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /etc/linkding/data
|
- mountPath: /etc/linkding/data
|
||||||
name: data
|
name: data
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 33
|
||||||
|
runAsGroup: 33
|
||||||
|
runAsUser: 33
|
||||||
volumes:
|
volumes:
|
||||||
- name: data
|
- name: data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
|
|||||||
@@ -32,19 +32,25 @@ func Stack() stack.Stack {
|
|||||||
func deployment() apps.Deployment {
|
func deployment() apps.Deployment {
|
||||||
storage := kube.NewVolumeFrom(kube.VolumeSourcePVC, "data", pvc.Name)
|
storage := kube.NewVolumeFrom(kube.VolumeSourcePVC, "data", pvc.Name)
|
||||||
pod_spec := core.PodSpec{
|
pod_spec := core.PodSpec{
|
||||||
|
SecurityContext: &core.PodSecurityContext{
|
||||||
|
RunAsUser: new(int64(33)), // www-data user ID
|
||||||
|
RunAsGroup: new(int64(33)),
|
||||||
|
FSGroup: new(int64(33)),
|
||||||
|
},
|
||||||
Containers: []core.Container{
|
Containers: []core.Container{
|
||||||
{
|
{
|
||||||
Name: root.Linkding.Name,
|
Name: root.Linkding.Name,
|
||||||
Image: root.Linkding.Image,
|
Image: root.Linkding.Image,
|
||||||
|
SecurityContext: &core.SecurityContext{
|
||||||
|
AllowPrivilegeEscalation: new(false),
|
||||||
|
},
|
||||||
Ports: []core.ContainerPort{{
|
Ports: []core.ContainerPort{{
|
||||||
ContainerPort: root.Linkding.Port,
|
ContainerPort: root.Linkding.Port,
|
||||||
}},
|
}},
|
||||||
VolumeMounts: []core.VolumeMount{
|
VolumeMounts: []core.VolumeMount{{
|
||||||
{
|
|
||||||
Name: storage.Name,
|
Name: storage.Name,
|
||||||
MountPath: "/etc/linkding/data",
|
MountPath: "/etc/linkding/data",
|
||||||
},
|
}},
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Volumes: []core.Volume{
|
Volumes: []core.Volume{
|
||||||
@@ -53,3 +59,5 @@ func deployment() apps.Deployment {
|
|||||||
}
|
}
|
||||||
return kube.NewDeployment(meta, pod_spec)
|
return kube.NewDeployment(meta, pod_spec)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// kubectl --kubeconfig ~/.kube/hydra -n linkding exec -it linking-67f686679d-2tfrk -- python manage.py createsuperuser --username=daniel --email=danicosme@pm.me
|
||||||
|
|||||||
Reference in New Issue
Block a user