Merge pull request #16268 from borg-land/boskos-patches

Add `boskos-resource-type` flag to use different GCE projects for scale/gpu testing
This commit is contained in:
Kubernetes Prow Robot 2024-01-26 19:53:11 -08:00 committed by GitHub
commit 825e9cc56d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 13 deletions

View File

@ -22,7 +22,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time"
"k8s.io/klog/v2" "k8s.io/klog/v2"
"k8s.io/kops/tests/e2e/kubetest2-kops/gce" "k8s.io/kops/tests/e2e/kubetest2-kops/gce"
@ -72,7 +71,7 @@ func (d *deployer) initialize() error {
if d.GCPProject == "" { if d.GCPProject == "" {
klog.V(1).Info("No GCP project provided, acquiring from Boskos") 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 { if err != nil {
return fmt.Errorf("failed to make boskos client: %s", err) return fmt.Errorf("failed to make boskos client: %s", err)
} }
@ -80,9 +79,9 @@ func (d *deployer) initialize() error {
resource, err := boskos.Acquire( resource, err := boskos.Acquire(
d.boskos, d.boskos,
"gce-project", d.BoskosResourceType,
5*time.Minute, d.BoskosAcquireTimeout,
5*time.Minute, d.BoskosHeartbeatInterval,
d.boskosHeartbeatClose, d.boskosHeartbeatClose,
) )
if err != nil { if err != nil {

View File

@ -92,8 +92,11 @@ type deployer struct {
// boskos struct field will be non-nil when the deployer is // boskos struct field will be non-nil when the deployer is
// using boskos to acquire a GCP project // 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 // this channel serves as a signal channel for the hearbeat goroutine
// so that it can be explicitly closed // so that it can be explicitly closed
boskosHeartbeatClose chan struct{} boskosHeartbeatClose chan struct{}
@ -118,11 +121,14 @@ func New(opts types.Options) (types.Deployer, *pflag.FlagSet) {
BuildOptions: &builder.BuildOptions{ BuildOptions: &builder.BuildOptions{
BuildKubernetes: false, BuildKubernetes: false,
}, },
boskosHeartbeatClose: make(chan struct{}), boskosHeartbeatClose: make(chan struct{}),
ValidationCount: 10, ValidationCount: 10,
ValidationInterval: 10 * time.Second, 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() dir, err := defaultArtifactsDir()
if err != nil { if err != nil {
klog.Fatalf("unable to determine artifacts directory: %v", err) klog.Fatalf("unable to determine artifacts directory: %v", err)

View File

@ -193,7 +193,6 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
args = appendIfUnset(args, "--project", d.GCPProject) args = appendIfUnset(args, "--project", d.GCPProject)
} }
// set some sane default e2e testing behaviour on gce // set some sane default e2e testing behaviour on gce
args = appendIfUnset(args, "--gce-service-account", "default")
args = appendIfUnset(args, "--networking", "kubenet") args = appendIfUnset(args, "--networking", "kubenet")
args = appendIfUnset(args, "--node-volume-size", "100") args = appendIfUnset(args, "--node-volume-size", "100")

View File

@ -27,7 +27,7 @@ kubetest2 kops -v=6 \
--up --down --build --build-kubernetes=true --target-build-arch=linux/amd64 \ --up --down --build --build-kubernetes=true --target-build-arch=linux/amd64 \
--cloud-provider=gce --admin-access=0.0.0.0/0 \ --cloud-provider=gce --admin-access=0.0.0.0/0 \
--kops-version-marker=https://storage.googleapis.com/kops-ci/bin/latest-ci.txt \ --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 \ --test=kops \
-- \ -- \
--ginkgo-args="--debug" \ --ginkgo-args="--debug" \