kubevirt/0002-tests-Set-FSGroup-to-ensure-proper-permissions.patch

45 lines
1.4 KiB
Diff

From 96bd87f47a1f0ba7c0079e8665f94d7cd38f3038 Mon Sep 17 00:00:00 2001
From: Vasiliy Ulyanov <vulyanov@suse.de>
Date: Mon, 26 Aug 2024 08:18:52 +0200
Subject: [PATCH] tests: Set FSGroup to ensure proper permissions
This fixes 'Permission Denied' error with some storage providers.
Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
---
tests/storage/migration.go | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/storage/migration.go b/tests/storage/migration.go
index c6911848b..bb17cfdde 100644
--- a/tests/storage/migration.go
+++ b/tests/storage/migration.go
@@ -459,16 +459,20 @@ func createSmallImageForDestinationMigration(vm *virtv1.VirtualMachine, name, si
},
},
}
+ podSecurityContext := k8sv1.PodSecurityContext{
+ FSGroup: pointer.P(int64(util.NonRootUID)),
+ }
pod := k8sv1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "create-img-",
Namespace: vmi.Namespace,
},
Spec: k8sv1.PodSpec{
- RestartPolicy: k8sv1.RestartPolicyNever,
- Volumes: []k8sv1.Volume{volume},
- Containers: []k8sv1.Container{cont},
- Affinity: &affinity,
+ RestartPolicy: k8sv1.RestartPolicyNever,
+ Volumes: []k8sv1.Volume{volume},
+ Containers: []k8sv1.Container{cont},
+ Affinity: &affinity,
+ SecurityContext: &podSecurityContext,
},
}
p, err := virtCli.CoreV1().Pods(vmi.Namespace).Create(context.Background(), &pod, metav1.CreateOptions{})
--
2.46.0