Skip to content

Commit

Permalink
Kubernetes benchmarks: Refactor kubectl context to allow sets of clus…
Browse files Browse the repository at this point in the history
…ters.

Also add sanity check to make sure each cluster works as part of
initialization, by running a sample pod within.

PiperOrigin-RevId: 710786751
  • Loading branch information
EtiennePerot authored and gvisor-bot committed Dec 30, 2024
1 parent 1db44ea commit 4dbba85
Show file tree
Hide file tree
Showing 25 changed files with 283 additions and 133 deletions.
28 changes: 14 additions & 14 deletions test/kubernetes/benchmarks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -89,7 +89,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -122,7 +122,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -155,7 +155,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -188,7 +188,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -222,7 +222,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -254,7 +254,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -287,7 +287,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -320,7 +320,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -352,7 +352,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -392,7 +392,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -426,7 +426,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -458,7 +458,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
Expand Down Expand Up @@ -491,7 +491,7 @@ go_test(
],
deps = [
"//test/kubernetes/k8sctx",
"//test/kubernetes/k8sctx/autok8sctx",
"//test/kubernetes/k8sctx/kubectlctx",
"//test/kubernetes/testcluster",
],
)
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/abslbuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

// TestABSLBuild benchmarks building various Abseil C++ targets.
func TestABSLBuild(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/ffmpeg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestFfmpeg(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestGRPCBuild(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/gsutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestGSUtil(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/nginx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestNginx(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/ollama_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestOllama(t *testing.T) {
fmt.Fprint(os.Stderr, "HEADS UP: This test uses a huge container image which may take up to 30 minutes to download onto nodes the first time you run it.\n")

ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/postgresql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

// TestPostgresPGBench benchmarks a PostgreSQL database with pgbench.
func TestPostgresPGBench(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/pytorch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

Expand Down Expand Up @@ -49,7 +49,7 @@ func TestMobileNetV2(t *testing.T) {
}

func runTests(ctx context.Context, t *testing.T, tests []pytorchTest) {
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

// TestRedis benchmarks redis servers on k8s clusters.
func TestRedis(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/rubydev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

// TestRubyDev benchmarks a build job on k8s clusters.
func TestRubyDev(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/stablediffusion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestStableDiffusionXL(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/startup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestStartup(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/tensorflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestTensorflowOnCPU(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/kubernetes/benchmarks/wordpress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"testing"

"gvisor.dev/gvisor/test/kubernetes/k8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/autok8sctx"
"gvisor.dev/gvisor/test/kubernetes/k8sctx/kubectlctx"
"gvisor.dev/gvisor/test/kubernetes/testcluster"
)

func TestWordpress(t *testing.T) {
ctx := context.Background()
k8sCtx, err := autok8sctx.New(ctx)
k8sCtx, err := kubectlctx.New(ctx)
if err != nil {
t.Fatalf("Failed to get kubernetes context: %v", err)
}
Expand Down
1 change: 0 additions & 1 deletion test/kubernetes/k8sctx/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package(

go_library(
name = "k8sctx",
testonly = True,
srcs = [
"k8sctx.go",
],
Expand Down
Loading

0 comments on commit 4dbba85

Please sign in to comment.