Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/noderesource/noderesource.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ func buildNodePodSpec(node *seiv1alpha1.SeiNode, p PlatformConfig) corev1.PodSpe
},
},
Volumes: volumes,
SecurityContext: &corev1.PodSecurityContext{
// Avoids recursive setxattr walk on the data PVC at pod start.
SELinuxChangePolicy: ptr.To(corev1.SELinuxChangePolicyMountOption),
},
}

spec.ShareProcessNamespace = ptr.To(true)
Expand Down
15 changes: 15 additions & 0 deletions internal/noderesource/noderesource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,21 @@ func TestBuildNodePodSpec_SharedPIDNamespace(t *testing.T) {
g.Expect(*sts.Spec.Template.Spec.ShareProcessNamespace).To(BeTrue())
}

// SELinuxChangePolicy=MountOption avoids the per-pod-recreation recursive
// xattr walk over the data PVC. On a multi-TB archive PVC, that walk takes
// ~20 minutes; with MountOption the kernel applies the SELinux context as
// a per-mount overlay in milliseconds.
func TestBuildNodePodSpec_SELinuxChangePolicyMountOption(t *testing.T) {
g := NewWithT(t)
node := newSnapshotNode("snap-0", "default")

spec := buildNodePodSpec(node, platformtest.Config())

g.Expect(spec.SecurityContext).NotTo(BeNil())
g.Expect(spec.SecurityContext.SELinuxChangePolicy).NotTo(BeNil())
g.Expect(*spec.SecurityContext.SELinuxChangePolicy).To(Equal(corev1.SELinuxChangePolicyMountOption))
}

// --- PVC ---

func TestNodeDataPVCClaimName_Genesis(t *testing.T) {
Expand Down
Loading