Merge pull request #127574 from bouaouda-achraf/e2e-test-add-network-subnet-param

feat(test-e2e): support custom network and subnet on remote e2e mode
This commit is contained in:
Kubernetes Prow Robot
2024-09-26 03:50:08 +01:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -75,6 +75,8 @@ var instanceMetadata = flag.String("instance-metadata", "", "key/value metadata
var imageProject = flag.String("image-project", "", "gce project the hosts live in (gce)")
var instanceType = flag.String("instance-type", "e2-medium", "GCP Machine type to use for test")
var preemptibleInstances = flag.Bool("preemptible-instances", false, "If true, gce instances will be configured to be preemptible (gce)")
var network = flag.String("network", "", "Specifies the network that the VM instance are a part of")
var subnet = flag.String("subnet", "", "Specifies the subnet that the VM instance are a part of")
func init() {
flag.Var(&nodeEnvs, "node-env", "An environment variable passed to instance as metadata, e.g. when '--node-env=PATH=/usr/bin' is specified, there will be an extra instance metadata 'PATH=/usr/bin'.")
@@ -512,6 +514,12 @@ func (g *GCERunner) createGCEInstance(imageConfig *internalGCEImage) (string, er
createArgs = append(createArgs, "--machine-type="+g.machineType(imageConfig.machine))
createArgs = append(createArgs, "--create-disk="+strings.Join(diskArgs, ","))
createArgs = append(createArgs, "--service-account="+serviceAccount)
if len(*network) > 0 {
createArgs = append(createArgs, "--network="+*network)
}
if len(*subnet) > 0 {
createArgs = append(createArgs, "--subnet="+*subnet)
}
if *preemptibleInstances {
createArgs = append(createArgs, "--preemptible")
}