aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/gce/gce.go3
-rw-r--r--vm/gce/gce.go5
2 files changed, 5 insertions, 3 deletions
diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go
index 7100665ef..4a5491e25 100644
--- a/pkg/gce/gce.go
+++ b/pkg/gce/gce.go
@@ -118,7 +118,7 @@ func NewContext(customZoneID string) (*Context, error) {
}
func (ctx *Context) CreateInstance(name, machineType, image, sshkey string,
- preemptible, displayDevice bool) (string, error) {
+ tags []string, preemptible, displayDevice bool) (string, error) {
prefix := "https://www.googleapis.com/compute/v1/projects/" + ctx.ProjectID
sshkeyAttr := "syzkaller:" + sshkey
oneAttr := "1"
@@ -165,6 +165,7 @@ func (ctx *Context) CreateInstance(name, machineType, image, sshkey string,
DisplayDevice: &compute.DisplayDevice{
EnableDisplay: displayDevice,
},
+ Tags: &compute.Tags{Items: tags},
}
retry:
if !instance.Scheduling.Preemptible && strings.HasPrefix(machineType, "e2-") {
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index a830a9889..90b12c89f 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -59,7 +59,8 @@ type Config struct {
// Leave empty for non-OS Login GCP projects.
// Otherwise generate one and upload it:
// `gcloud compute os-login ssh-keys add --key-file some-key.pub`.
- SerialPortKey string `json:"serial_port_key"`
+ SerialPortKey string `json:"serial_port_key"`
+ Tags []string `json:"tags"` // GCE instance tags
}
type Pool struct {
@@ -195,7 +196,7 @@ func (pool *Pool) Create(_ context.Context, workdir string, index int) (vmimpl.I
}
log.Logf(0, "creating instance: %v", name)
ip, err := pool.GCE.CreateInstance(name, pool.cfg.MachineType, pool.cfg.GCEImage,
- string(gceKeyPub), pool.cfg.Preemptible, pool.cfg.DisplayDevice)
+ string(gceKeyPub), pool.cfg.Tags, pool.cfg.Preemptible, pool.cfg.DisplayDevice)
if err != nil {
return nil, err
}