Skip to content

Commit

Permalink
Add boskos-resource-type flag to use different GCE projects for scale…
Browse files Browse the repository at this point in the history
…/gpu testing
  • Loading branch information
upodroid committed Jan 21, 2024
1 parent 9645e5c commit 29b9796
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
9 changes: 4 additions & 5 deletions tests/e2e/kubetest2-kops/deployer/common.go
Expand Up @@ -22,7 +22,6 @@ import (
"os"
"path/filepath"
"strings"
"time"

"k8s.io/klog/v2"
"k8s.io/kops/tests/e2e/kubetest2-kops/gce"
Expand Down Expand Up @@ -72,17 +71,17 @@ func (d *deployer) initialize() error {
if d.GCPProject == "" {
klog.V(1).Info("No GCP project provided, acquiring from Boskos")

boskosClient, err := boskos.NewClient("http://boskos.test-pods.svc.cluster.local.")
boskosClient, err := boskos.NewClient(d.BoskosLocation)
if err != nil {
return fmt.Errorf("failed to make boskos client: %s", err)
}
d.boskos = boskosClient

resource, err := boskos.Acquire(
d.boskos,
"gce-project",
5*time.Minute,
5*time.Minute,
d.BoskosResourceType,
d.BoskosAcquireTimeout,
d.BoskosHeartbeatInterval,
d.boskosHeartbeatClose,
)
if err != nil {
Expand Down
18 changes: 12 additions & 6 deletions tests/e2e/kubetest2-kops/deployer/deployer.go
Expand Up @@ -91,8 +91,11 @@ type deployer struct {

// boskos struct field will be non-nil when the deployer is
// using boskos to acquire a GCP project
boskos *client.Client

boskos *client.Client
BoskosLocation string `flag:"~boskos-location" desc:"If set, manually specifies the location of the Boskos server."`
BoskosAcquireTimeout time.Duration `flag:"~boskos-acquire-timeout" desc:"How long should boskos wait to acquire a resource before timing out"`
BoskosHeartbeatInterval time.Duration `flag:"~boskos-heartbeat-interval" desc:"How often should boskos send a heartbeat to Boskos to hold the acquired resource. 0 means no heartbeat."`
BoskosResourceType string `flag:"~boskos-resource-type" desc:"If set, manually specifies the resource type of GCP projects to acquire from Boskos."`
// this channel serves as a signal channel for the hearbeat goroutine
// so that it can be explicitly closed
boskosHeartbeatClose chan struct{}
Expand All @@ -117,11 +120,14 @@ func New(opts types.Options) (types.Deployer, *pflag.FlagSet) {
BuildOptions: &builder.BuildOptions{
BuildKubernetes: false,
},
boskosHeartbeatClose: make(chan struct{}),
ValidationCount: 10,
ValidationInterval: 10 * time.Second,
boskosHeartbeatClose: make(chan struct{}),
ValidationCount: 10,
ValidationInterval: 10 * time.Second,
BoskosLocation: "http://boskos.test-pods.svc.cluster.local.",
BoskosResourceType: "gce-project",
BoskosAcquireTimeout: 5 * time.Minute,
BoskosHeartbeatInterval: 5 * time.Minute,
}

dir, err := defaultArtifactsDir()
if err != nil {
klog.Fatalf("unable to determine artifacts directory: %v", err)
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/kubetest2-kops/deployer/up.go
Expand Up @@ -193,7 +193,6 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
args = appendIfUnset(args, "--project", d.GCPProject)
}
// set some sane default e2e testing behaviour on gce
args = appendIfUnset(args, "--gce-service-account", "default")
args = appendIfUnset(args, "--networking", "kubenet")
args = appendIfUnset(args, "--node-volume-size", "100")

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/scenarios/build/run-test.sh
Expand Up @@ -27,7 +27,7 @@ kubetest2 kops -v=6 \
--up --down --build --build-kubernetes=true --target-build-arch=linux/amd64 \
--cloud-provider=gce --admin-access=0.0.0.0/0 \
--kops-version-marker=https://storage.googleapis.com/kops-ci/bin/latest-ci.txt \
--create-args "--networking=kubenet --set=spec.nodeProblemDetector.enabled=true" \
--create-args "--gce-service-account=default --networking=kubenet --set=spec.nodeProblemDetector.enabled=true" \
--test=kops \
-- \
--ginkgo-args="--debug" \
Expand Down

0 comments on commit 29b9796

Please sign in to comment.