buildenv: remove EC2 zone configuration options
There is no need to set availability zones for EC2 resources at this
time. The resources currently in use are available to all zones within
a single region.
For golang/go#36841
Change-Id: Ifcb2c3404fba2489741c31fe63ad4e7747639ad9
Reviewed-on: https://go-review.googlesource.com/c/build/+/255359
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
diff --git a/buildenv/envs.go b/buildenv/envs.go
index edc4645..1b3e239 100644
--- a/buildenv/envs.go
+++ b/buildenv/envs.go
@@ -74,18 +74,11 @@
// other fields.
ControlZone string
- // PreferredEC2Zone is the preffered AWS availability zone.
- PreferredEC2Zone string
-
// VMZones are the GCE zones that the VMs will be deployed to. These
// GCE zones will be periodically cleaned by deleting old VMs. The zones
// should all exist within a single region.
VMZones []string
- // VMEC2Zones are the AWS availability zones that the VMs will be deployed to.
- // The availability zones should all exist within a single region.
- VMEC2Zones []string
-
// StaticIP is the public, static IP address that will be attached to the
// coordinator instance. The zero value means the address will be looked
// up by name. This field is optional.
@@ -149,8 +142,6 @@
AWSSecurityGroup string
// AWSRegion is the region where AWS resources are deployed.
- // The availability zones set in VMEC2Zones should all reside
- // within this region.
AWSRegion string
}
@@ -168,16 +159,6 @@
return e.VMZones[rand.Intn(len(e.VMZones))]
}
-// RandomEC2VMZone returns a randomly selected zone from the zones in
-// VMAvailabilityZones. The PreferredAvailabilityZone value will be
-// returned if VMAvailabilityZones is not set.
-func (e Environment) RandomEC2VMZone() string {
- if len(e.VMEC2Zones) == 0 {
- return e.PreferredEC2Zone
- }
- return e.VMEC2Zones[rand.Intn(len(e.VMEC2Zones))]
-}
-
// Region returns the GCE region, derived from its zone.
func (e Environment) Region() string {
return e.ControlZone[:strings.LastIndex(e.ControlZone, "-")]
@@ -266,7 +247,6 @@
IsProd: true,
ControlZone: "us-central1-f",
VMZones: []string{"us-central1-a", "us-central1-b", "us-central1-c", "us-central1-f"},
- VMEC2Zones: []string{"us-east-1a", "us-east-1b"},
StaticIP: "104.154.113.235",
MachineType: "n1-standard-1",
PreferContainersOnCOS: true,
@@ -302,7 +282,6 @@
IsProd: true,
ControlZone: "us-central1-f",
VMZones: []string{"us-central1-a", "us-central1-b", "us-central1-c", "us-central1-f"},
- VMEC2Zones: []string{"us-east-2a", "us-east-2b"},
StaticIP: "107.178.219.46",
MachineType: "n1-standard-4",
PreferContainersOnCOS: true,
diff --git a/buildenv/envs_test.go b/buildenv/envs_test.go
index 79f2d34..bbee9aa 100644
--- a/buildenv/envs_test.go
+++ b/buildenv/envs_test.go
@@ -50,48 +50,6 @@
}
}
-func TestEnvironmentRandomEC2VMZone(t *testing.T) {
- testCases := []struct {
- name string
- env Environment
- wantOneOf []string
- }{
- {
- name: "zones-not-set",
- env: Environment{
- PreferredEC2Zone: "zone-a",
- VMEC2Zones: []string{},
- },
- wantOneOf: []string{"zone-a"},
- },
- {
- name: "zone-and-zones-set",
- env: Environment{
- PreferredEC2Zone: "zone-a",
- VMEC2Zones: []string{"zone-b", "zone-c"},
- },
-
- wantOneOf: []string{"zone-b", "zone-c"},
- },
- {
- name: "zones-only-contains-one-entry",
- env: Environment{
- PreferredEC2Zone: "zone-a",
- VMEC2Zones: []string{"zone-b"},
- },
- wantOneOf: []string{"zone-b"},
- },
- }
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- got := tc.env.RandomEC2VMZone()
- if !containsString(got, tc.wantOneOf) {
- t.Errorf("got=%q; want %v", got, tc.wantOneOf)
- }
- })
- }
-}
-
func containsString(item string, items []string) bool {
for _, s := range items {
if item == s {