Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-0.58] [export tests]: Specify fsGroup so we can write the exported PVC #8789

Merged
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
8 changes: 6 additions & 2 deletions tests/storage/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ var _ = SIGDescribe("Export", func() {
var err error
var token *k8sv1.Secret
var virtClient kubecli.KubevirtClient
var qemuGid = int64(107)

BeforeEach(func() {
virtClient, err = kubecli.GetKubevirtClient()
Expand Down Expand Up @@ -172,6 +173,10 @@ var _ = SIGDescribe("Export", func() {
},
},
})
if pod.Spec.SecurityContext == nil {
pod.Spec.SecurityContext = &k8sv1.PodSecurityContext{}
}
pod.Spec.SecurityContext.FSGroup = &qemuGid

volumeMode := pvc.Spec.VolumeMode
if volumeMode != nil && *volumeMode == k8sv1.PersistentVolumeBlock {
Expand All @@ -184,7 +189,6 @@ var _ = SIGDescribe("Export", func() {
}

createSourcePodChecker := func(pvc *k8sv1.PersistentVolumeClaim) *k8sv1.Pod {
nonRootUser := int64(107)
volumeName := pvc.GetName()
podName := "download-pod"
pod := tests.RenderPod(podName, []string{"/bin/sh", "-c", "sleep 360"}, []string{})
Expand All @@ -199,7 +203,7 @@ var _ = SIGDescribe("Export", func() {
if pod.Spec.SecurityContext == nil {
pod.Spec.SecurityContext = &k8sv1.PodSecurityContext{}
}
pod.Spec.SecurityContext.FSGroup = &nonRootUser
pod.Spec.SecurityContext.FSGroup = &qemuGid

volumeMode := pvc.Spec.VolumeMode
if volumeMode != nil && *volumeMode == k8sv1.PersistentVolumeBlock {
Expand Down