Skip to content

Commit

Permalink
Talos compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fenio committed Jan 1, 2025
1 parent aefb578 commit 03c417b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/plugin/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const (
EphemeralStorageLimit = "2Mi"
)

var DefaultID int64 = 2137

func Mount(ctx context.Context, namespace, pvcName, localMountPoint string, needsRoot, debug bool) error {

checkSSHFS()
Expand Down Expand Up @@ -450,6 +452,12 @@ func getEphemeralContainerSettings(needsRoot bool) (string, *corev1.SecurityCont
allowPrivilegeEscalationTrue := true
allowPrivilegeEscalationFalse := false
readOnlyRootFilesystemTrue := true
runAsNonRootTrue := true

// Define seccomp profile type
seccompProfileRuntimeDefault := corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
}

if needsRoot {
image = PrivilegedImage
Expand All @@ -459,6 +467,7 @@ func getEphemeralContainerSettings(needsRoot bool) (string, *corev1.SecurityCont
Capabilities: &corev1.Capabilities{
Add: []corev1.Capability{"SYS_ADMIN", "SYS_CHROOT"},
},
SeccompProfile: &seccompProfileRuntimeDefault,
}
} else {
securityContext = &corev1.SecurityContext{
Expand All @@ -467,6 +476,10 @@ func getEphemeralContainerSettings(needsRoot bool) (string, *corev1.SecurityCont
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
SeccompProfile: &seccompProfileRuntimeDefault,
RunAsUser: &DefaultID,
RunAsGroup: &DefaultID,
RunAsNonRoot: &runAsNonRootTrue,
}
}
return image, securityContext
Expand Down

0 comments on commit 03c417b

Please sign in to comment.