Skip to content

Commit 690f42f

Browse files
andrew-edgarPivotal
authored and
Pivotal
committed
Add support for optional placement tags.
[#129370091] Signed-off-by: Brandon Shroyer <[email protected]>
1 parent 4db10b4 commit 690f42f

11 files changed

+189
-54
lines changed

cmd/bbs/lrp_convergence_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var _ = Describe("Convergence API", func() {
3030
[]string{},
3131
[]string{},
3232
[]string{},
33+
[]string{},
3334
)
3435
consulHelper.RegisterCell(&cellPresence)
3536
processGuid = "some-process-guid"

controllers/lrp_convergence_controller_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ var _ = Describe("LRP Convergence Controllers", func() {
116116
fakeRepClientFactory.CreateClientReturns(fakeRepClient)
117117
fakeServiceClient.CellByIdReturns(nil, errors.New("hi"))
118118

119-
cellPresence := models.NewCellPresence("cell-id", "1.1.1.1", "z1", models.CellCapacity{}, nil, nil, nil)
119+
cellPresence := models.NewCellPresence("cell-id", "1.1.1.1", "z1", models.CellCapacity{}, nil, nil, nil, nil)
120120
cellSet = models.CellSet{"cell-id": &cellPresence}
121121
fakeServiceClient.CellsReturns(cellSet, nil)
122122

@@ -266,6 +266,7 @@ var _ = Describe("LRP Convergence Controllers", func() {
266266
[]string{},
267267
[]string{},
268268
[]string{},
269+
[]string{},
269270
)
270271

271272
fakeServiceClient.CellByIdReturns(&cellPresence, nil)

controllers/task_controller_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ var _ = Describe("Task Controller", func() {
643643
)
644644

645645
BeforeEach(func() {
646-
cellPresence := models.NewCellPresence("cell-id", "1.1.1.1", "z1", models.CellCapacity{}, nil, nil, nil)
646+
cellPresence := models.NewCellPresence("cell-id", "1.1.1.1", "z1", models.CellCapacity{}, nil, nil, nil, nil)
647647
cellSet = models.CellSet{"cell-id": &cellPresence}
648648
fakeServiceClient.CellsReturns(cellSet, nil)
649649
})

db/etcd/lrp_convergence_test.go

+52-5
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ var _ = Describe("LRPConvergence", func() {
730730
[]string{},
731731
[]string{},
732732
[]string{},
733+
[]string{},
733734
)
734735
cells = models.CellSet{cellId: &cellPresence}
735736
})
@@ -891,6 +892,7 @@ var _ = Describe("LRPConvergence", func() {
891892
[]string{},
892893
[]string{},
893894
[]string{},
895+
[]string{},
894896
)
895897

896898
lrpKey0 = models.NewActualLRPKey(processGuid, 0, freshDomain)
@@ -1003,7 +1005,16 @@ var _ = Describe("LRPConvergence", func() {
10031005

10041006
BeforeEach(func() {
10051007
cells = models.CellSet{}
1006-
cellPresence = models.NewCellPresence("cell-id", "cell.example.com", "the-zone", models.NewCellCapacity(128, 1024, 3), []string{}, []string{}, []string{})
1008+
cellPresence = models.NewCellPresence(
1009+
"cell-id",
1010+
"cell.example.com",
1011+
"the-zone",
1012+
models.NewCellCapacity(128, 1024, 3),
1013+
[]string{},
1014+
[]string{},
1015+
[]string{},
1016+
[]string{},
1017+
)
10071018
})
10081019

10091020
JustBeforeEach(func() {
@@ -1081,7 +1092,16 @@ var _ = Describe("LRPConvergence", func() {
10811092
)
10821093

10831094
JustBeforeEach(func() {
1084-
cellPresence = models.NewCellPresence("cell-id", "cell.example.com", "the-zone", models.NewCellCapacity(128, 1024, 3), []string{}, []string{}, []string{})
1095+
cellPresence = models.NewCellPresence(
1096+
"cell-id",
1097+
"cell.example.com",
1098+
"the-zone",
1099+
models.NewCellCapacity(128, 1024, 3),
1100+
[]string{},
1101+
[]string{},
1102+
[]string{},
1103+
[]string{},
1104+
)
10851105
cells = models.CellSet{}
10861106
cells["cell-id"] = &cellPresence
10871107

@@ -1192,7 +1212,16 @@ var _ = Describe("LRPConvergence", func() {
11921212
)
11931213

11941214
JustBeforeEach(func() {
1195-
cellPresence = models.NewCellPresence("cell-id", "cell.example.com", "the-zone", models.NewCellCapacity(128, 1024, 100), []string{}, []string{}, []string{})
1215+
cellPresence = models.NewCellPresence(
1216+
"cell-id",
1217+
"cell.example.com",
1218+
"the-zone",
1219+
models.NewCellCapacity(128, 1024, 100),
1220+
[]string{},
1221+
[]string{},
1222+
[]string{},
1223+
[]string{},
1224+
)
11961225
cells = models.CellSet{}
11971226
cells["cell-id"] = &cellPresence
11981227

@@ -1248,7 +1277,16 @@ var _ = Describe("LRPConvergence", func() {
12481277
)
12491278

12501279
JustBeforeEach(func() {
1251-
cellPresence = models.NewCellPresence("cell-id", "cell.example.com", "the-zone", models.NewCellCapacity(124, 1024, 6), []string{}, []string{}, []string{})
1280+
cellPresence = models.NewCellPresence(
1281+
"cell-id",
1282+
"cell.example.com",
1283+
"the-zone",
1284+
models.NewCellCapacity(124, 1024, 6),
1285+
[]string{},
1286+
[]string{},
1287+
[]string{},
1288+
[]string{},
1289+
)
12521290
cells = models.CellSet{}
12531291
cells["cell-id"] = &cellPresence
12541292

@@ -1749,7 +1787,16 @@ func newUnstartableCrashedActualLRP(d *models.DesiredLRP, index int32) *models.A
17491787
}
17501788

17511789
func newCellPresence(cellID string) *models.CellPresence {
1752-
cellPresence := models.NewCellPresence(cellID, "1.2.3.4", "az-1", models.NewCellCapacity(128, 1024, 3), []string{}, nil, nil)
1790+
cellPresence := models.NewCellPresence(
1791+
cellID,
1792+
"1.2.3.4",
1793+
"az-1",
1794+
models.NewCellCapacity(128, 1024, 3),
1795+
[]string{},
1796+
nil,
1797+
nil,
1798+
nil,
1799+
)
17531800
return &cellPresence
17541801
}
17551802

db/etcd/task_convergence_test.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,16 @@ var _ = Describe("Convergence of Tasks", func() {
182182

183183
Context("when the associated cell is present", func() {
184184
BeforeEach(func() {
185-
cellPresence := models.NewCellPresence("cell-id", "1.2.3.4", "the-zone", models.NewCellCapacity(128, 1024, 3), []string{}, []string{}, []string{})
185+
cellPresence := models.NewCellPresence(
186+
"cell-id",
187+
"1.2.3.4",
188+
"the-zone",
189+
models.NewCellCapacity(128, 1024, 3),
190+
[]string{},
191+
[]string{},
192+
[]string{},
193+
[]string{},
194+
)
186195
cells["cell-id"] = &cellPresence
187196
})
188197

handlers/actual_lrp_lifecycle_handler_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ var _ = Describe("ActualLRP Lifecycle Handlers", func() {
794794
[]string{},
795795
[]string{},
796796
[]string{},
797+
[]string{},
797798
)
798799

799800
fakeServiceClient.CellByIdReturns(&cellPresence, nil)

models/cell_presence.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (cap CellCapacity) Validate() error {
7070
func NewCellPresence(
7171
cellID, repAddress, zone string,
7272
capacity CellCapacity,
73-
rootFSProviders, preloadedRootFSes, placementTags []string,
73+
rootFSProviders, preloadedRootFSes, placementTags, optionalPlacementTags []string,
7474
) CellPresence {
7575
var providers []*Provider
7676
var pProviders []string
@@ -84,12 +84,13 @@ func NewCellPresence(
8484
}
8585

8686
return CellPresence{
87-
CellId: cellID,
88-
RepAddress: repAddress,
89-
Zone: zone,
90-
Capacity: &capacity,
91-
RootfsProviders: providers,
92-
PlacementTags: placementTags,
87+
CellId: cellID,
88+
RepAddress: repAddress,
89+
Zone: zone,
90+
Capacity: &capacity,
91+
RootfsProviders: providers,
92+
PlacementTags: placementTags,
93+
OptionalPlacementTags: optionalPlacementTags,
9394
}
9495
}
9596

models/cell_presence_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ var _ = Describe("CellPresence", func() {
1818
rootfsProviders := []string{"provider-1"}
1919
preloadedRootFSes := []string{"provider-2", "provider-3"}
2020
placementTags := []string{"tag-1", "tag-2"}
21-
cellPresence = models.NewCellPresence("some-id", "some-address", "some-zone", capacity, rootfsProviders, preloadedRootFSes, placementTags)
21+
optionalPlacementTags := []string{"optional-tag-1", "optional-tag-2"}
22+
cellPresence = models.NewCellPresence("some-id", "some-address", "some-zone", capacity, rootfsProviders, preloadedRootFSes, placementTags, optionalPlacementTags)
2223
expectedProviderList = []*models.Provider{
2324
&models.Provider{"preloaded", []string{"provider-2", "provider-3"}},
2425
&models.Provider{"provider-1", []string{}},

0 commit comments

Comments
 (0)