From eb8654dcea6fba2abf7d94073a71d20e66f94d2b Mon Sep 17 00:00:00 2001 From: Sebastian Sch Date: Sun, 21 Nov 2021 15:48:34 +0200 Subject: [PATCH] Remove the secure boot checker pod This commit removes the pod that is created to validate if the node has secure boot enable or not Before this PR after every test running there are test pods in the sriov operator namespace that does not get clean Signed-off-by: Sebastian Sch --- test/util/cluster/cluster.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/util/cluster/cluster.go b/test/util/cluster/cluster.go index e2db853d1..7bd0b8e9a 100644 --- a/test/util/cluster/cluster.go +++ b/test/util/cluster/cluster.go @@ -11,6 +11,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" + "k8s.io/utils/pointer" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" sriovv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1" @@ -282,6 +283,13 @@ func GetNodeSecureBootState(clients *testclient.ClientSet, nodeName, namespace s return false, err } + defer func() { + err = clients.Pods(namespace).Delete(context.Background(), created.Name, metav1.DeleteOptions{GracePeriodSeconds: pointer.Int64Ptr(0)}) + if err != nil { + err = fmt.Errorf("failed to remove the check secure boot status pod for node %s: %v", nodeName, err) + } + }() + var runningPod *corev1.Pod err = wait.PollImmediate(time.Second, 3*time.Minute, func() (bool, error) { runningPod, err = clients.Pods(namespace).Get(context.Background(), created.Name, metav1.GetOptions{})