Skip to content

Commit ce0a565

Browse files
authored
Merge pull request #33 from fenio/talos
Talos compatibility fixes
2 parents aefb578 + 03c417b commit ce0a565

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/plugin/mount.go

+13
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const (
3434
EphemeralStorageLimit = "2Mi"
3535
)
3636

37+
var DefaultID int64 = 2137
38+
3739
func Mount(ctx context.Context, namespace, pvcName, localMountPoint string, needsRoot, debug bool) error {
3840

3941
checkSSHFS()
@@ -450,6 +452,12 @@ func getEphemeralContainerSettings(needsRoot bool) (string, *corev1.SecurityCont
450452
allowPrivilegeEscalationTrue := true
451453
allowPrivilegeEscalationFalse := false
452454
readOnlyRootFilesystemTrue := true
455+
runAsNonRootTrue := true
456+
457+
// Define seccomp profile type
458+
seccompProfileRuntimeDefault := corev1.SeccompProfile{
459+
Type: corev1.SeccompProfileTypeRuntimeDefault,
460+
}
453461

454462
if needsRoot {
455463
image = PrivilegedImage
@@ -459,6 +467,7 @@ func getEphemeralContainerSettings(needsRoot bool) (string, *corev1.SecurityCont
459467
Capabilities: &corev1.Capabilities{
460468
Add: []corev1.Capability{"SYS_ADMIN", "SYS_CHROOT"},
461469
},
470+
SeccompProfile: &seccompProfileRuntimeDefault,
462471
}
463472
} else {
464473
securityContext = &corev1.SecurityContext{
@@ -467,6 +476,10 @@ func getEphemeralContainerSettings(needsRoot bool) (string, *corev1.SecurityCont
467476
Capabilities: &corev1.Capabilities{
468477
Drop: []corev1.Capability{"ALL"},
469478
},
479+
SeccompProfile: &seccompProfileRuntimeDefault,
480+
RunAsUser: &DefaultID,
481+
RunAsGroup: &DefaultID,
482+
RunAsNonRoot: &runAsNonRootTrue,
470483
}
471484
}
472485
return image, securityContext

0 commit comments

Comments
 (0)