Skip to content

Commit 43d625a

Browse files
committed
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 <[email protected]> Run-TryBot: Carlos Amedee <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Alexander Rakoczy <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent ac829c2 commit 43d625a

File tree

2 files changed

+0
-63
lines changed

2 files changed

+0
-63
lines changed

buildenv/envs.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,11 @@ type Environment struct {
7474
// other fields.
7575
ControlZone string
7676

77-
// PreferredEC2Zone is the preffered AWS availability zone.
78-
PreferredEC2Zone string
79-
8077
// VMZones are the GCE zones that the VMs will be deployed to. These
8178
// GCE zones will be periodically cleaned by deleting old VMs. The zones
8279
// should all exist within a single region.
8380
VMZones []string
8481

85-
// VMEC2Zones are the AWS availability zones that the VMs will be deployed to.
86-
// The availability zones should all exist within a single region.
87-
VMEC2Zones []string
88-
8982
// StaticIP is the public, static IP address that will be attached to the
9083
// coordinator instance. The zero value means the address will be looked
9184
// up by name. This field is optional.
@@ -149,8 +142,6 @@ type Environment struct {
149142
AWSSecurityGroup string
150143

151144
// AWSRegion is the region where AWS resources are deployed.
152-
// The availability zones set in VMEC2Zones should all reside
153-
// within this region.
154145
AWSRegion string
155146
}
156147

@@ -168,16 +159,6 @@ func (e Environment) RandomVMZone() string {
168159
return e.VMZones[rand.Intn(len(e.VMZones))]
169160
}
170161

171-
// RandomEC2VMZone returns a randomly selected zone from the zones in
172-
// VMAvailabilityZones. The PreferredAvailabilityZone value will be
173-
// returned if VMAvailabilityZones is not set.
174-
func (e Environment) RandomEC2VMZone() string {
175-
if len(e.VMEC2Zones) == 0 {
176-
return e.PreferredEC2Zone
177-
}
178-
return e.VMEC2Zones[rand.Intn(len(e.VMEC2Zones))]
179-
}
180-
181162
// Region returns the GCE region, derived from its zone.
182163
func (e Environment) Region() string {
183164
return e.ControlZone[:strings.LastIndex(e.ControlZone, "-")]
@@ -266,7 +247,6 @@ var Staging = &Environment{
266247
IsProd: true,
267248
ControlZone: "us-central1-f",
268249
VMZones: []string{"us-central1-a", "us-central1-b", "us-central1-c", "us-central1-f"},
269-
VMEC2Zones: []string{"us-east-1a", "us-east-1b"},
270250
StaticIP: "104.154.113.235",
271251
MachineType: "n1-standard-1",
272252
PreferContainersOnCOS: true,
@@ -302,7 +282,6 @@ var Production = &Environment{
302282
IsProd: true,
303283
ControlZone: "us-central1-f",
304284
VMZones: []string{"us-central1-a", "us-central1-b", "us-central1-c", "us-central1-f"},
305-
VMEC2Zones: []string{"us-east-2a", "us-east-2b"},
306285
StaticIP: "107.178.219.46",
307286
MachineType: "n1-standard-4",
308287
PreferContainersOnCOS: true,

buildenv/envs_test.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -50,48 +50,6 @@ func TestEnvironmentNextZone(t *testing.T) {
5050
}
5151
}
5252

53-
func TestEnvironmentRandomEC2VMZone(t *testing.T) {
54-
testCases := []struct {
55-
name string
56-
env Environment
57-
wantOneOf []string
58-
}{
59-
{
60-
name: "zones-not-set",
61-
env: Environment{
62-
PreferredEC2Zone: "zone-a",
63-
VMEC2Zones: []string{},
64-
},
65-
wantOneOf: []string{"zone-a"},
66-
},
67-
{
68-
name: "zone-and-zones-set",
69-
env: Environment{
70-
PreferredEC2Zone: "zone-a",
71-
VMEC2Zones: []string{"zone-b", "zone-c"},
72-
},
73-
74-
wantOneOf: []string{"zone-b", "zone-c"},
75-
},
76-
{
77-
name: "zones-only-contains-one-entry",
78-
env: Environment{
79-
PreferredEC2Zone: "zone-a",
80-
VMEC2Zones: []string{"zone-b"},
81-
},
82-
wantOneOf: []string{"zone-b"},
83-
},
84-
}
85-
for _, tc := range testCases {
86-
t.Run(tc.name, func(t *testing.T) {
87-
got := tc.env.RandomEC2VMZone()
88-
if !containsString(got, tc.wantOneOf) {
89-
t.Errorf("got=%q; want %v", got, tc.wantOneOf)
90-
}
91-
})
92-
}
93-
}
94-
9553
func containsString(item string, items []string) bool {
9654
for _, s := range items {
9755
if item == s {

0 commit comments

Comments
 (0)