Skip to content

Commit

Permalink
Remove the secure boot checker pod
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
SchSeba committed Jan 20, 2022
1 parent f4cc0f3 commit eb8654d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/util/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{})
Expand Down

0 comments on commit eb8654d

Please sign in to comment.