Skip to content

Commit

Permalink
Wait for namespace deletion (#142)
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored May 22, 2024
1 parent 45ecb8f commit be41e10
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 100 deletions.
28 changes: 1 addition & 27 deletions cmd/k8s-netperf/k8s-netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"k8s.io/client-go/tools/clientcmd"
)

const namespace = "netperf"
const index = "k8s-netperf"
const retry = 3

Expand Down Expand Up @@ -306,32 +305,7 @@ var rootCmd = &cobra.Command{
}

func cleanup(client *kubernetes.Clientset) {
log.Info("Cleaning resources created by k8s-netperf")
svcList, err := k8s.GetServices(client, namespace)
if err != nil {
log.Fatal(err)
}
for svc := range svcList.Items {
err = k8s.DestroyService(client, svcList.Items[svc])
if err != nil {
log.Error(err)
}
}
dpList, err := k8s.GetDeployments(client, namespace)
if err != nil {
log.Fatal(err)
}
for dp := range dpList.Items {
err = k8s.DestroyDeployment(client, dpList.Items[dp])
if err != nil {
log.Error(err)
}
_, err := k8s.WaitForDelete(client, dpList.Items[dp])
if err != nil {
log.Fatal(err)
}
}
err = k8s.DestroyNamespace(client)
err := k8s.DestroyNamespace(client)
if err != nil {
log.Error(err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/iperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (i *iperf3) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config,
id := uuid.New()
file := fmt.Sprintf("/tmp/iperf-%s", id.String())
pod := client.Items[0]
log.Debugf("🔥 Client (%s,%s) starting iperf3 against server : %s", pod.Name, pod.Status.PodIP, serverIP)
log.Debugf("🔥 Client (%s,%s) starting iperf3 against server: %s", pod.Name, pod.Status.PodIP, serverIP)
config.Show(nc, i.driverName)
tcp := true
if !strings.Contains(nc.Profile, "STREAM") {
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const omniOptions = "rt_latency,p99_latency,throughput,throughput_units,remote_r
func (n *netperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, client apiv1.PodList, serverIP string) (bytes.Buffer, error) {
var stdout, stderr bytes.Buffer
pod := client.Items[0]
log.Debugf("🔥 Client (%s,%s) starting netperf against server : %s", pod.Name, pod.Status.PodIP, serverIP)
log.Debugf("🔥 Client (%s,%s) starting netperf against server: %s", pod.Name, pod.Status.PodIP, serverIP)
config.Show(nc, n.driverName)
cmd := []string{superNetperf, strconv.Itoa(nc.Parallelism), strconv.Itoa(k8s.NetperfServerDataPort), "-H",
serverIP, "-l",
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/uperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (u *uperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, c
var exec remotecommand.Executor

pod := client.Items[0]
log.Debugf("🔥 Client (%s,%s) starting uperf against server : %s", pod.Name, pod.Status.PodIP, serverIP)
log.Debugf("🔥 Client (%s,%s) starting uperf against server: %s", pod.Name, pod.Status.PodIP, serverIP)
config.Show(nc, u.driverName)

filePath, err := createUperfProfile(c, rc, nc, pod, serverIP)
Expand Down
Loading

0 comments on commit be41e10

Please sign in to comment.