@@ -53,10 +53,16 @@ func TestSingleZone(t *testing.T) {
53
53
ObjectMeta : metav1.ObjectMeta {Name : "Vol_1" , Labels : map [string ]string {v1 .LabelZoneFailureDomain : "us-west1-a" }},
54
54
},
55
55
{
56
- ObjectMeta : metav1.ObjectMeta {Name : "Vol_2" , Labels : map [string ]string {v1 .LabelZoneRegion : "us-west1-b " , "uselessLabel" : "none" }},
56
+ ObjectMeta : metav1.ObjectMeta {Name : "Vol_2" , Labels : map [string ]string {v1 .LabelZoneRegion : "us-west1" , "uselessLabel" : "none" }},
57
57
},
58
58
{
59
- ObjectMeta : metav1.ObjectMeta {Name : "Vol_3" , Labels : map [string ]string {v1 .LabelZoneRegion : "us-west1-c" }},
59
+ ObjectMeta : metav1.ObjectMeta {Name : "Vol_3" , Labels : map [string ]string {v1 .LabelZoneRegion : "us-west1" }},
60
+ },
61
+ {
62
+ ObjectMeta : metav1.ObjectMeta {Name : "Vol_Stable_1" , Labels : map [string ]string {v1 .LabelZoneFailureDomainStable : "us-west1-a" }},
63
+ },
64
+ {
65
+ ObjectMeta : metav1.ObjectMeta {Name : "Vol_Stable_2" , Labels : map [string ]string {v1 .LabelZoneRegionStable : "us-west1" , "uselessLabel" : "none" }},
60
66
},
61
67
}
62
68
@@ -77,6 +83,14 @@ func TestSingleZone(t *testing.T) {
77
83
ObjectMeta : metav1.ObjectMeta {Name : "PVC_4" , Namespace : "default" },
78
84
Spec : v1.PersistentVolumeClaimSpec {VolumeName : "Vol_not_exist" },
79
85
},
86
+ {
87
+ ObjectMeta : metav1.ObjectMeta {Name : "PVC_Stable_1" , Namespace : "default" },
88
+ Spec : v1.PersistentVolumeClaimSpec {VolumeName : "Vol_Stable_1" },
89
+ },
90
+ {
91
+ ObjectMeta : metav1.ObjectMeta {Name : "PVC_Stable_2" , Namespace : "default" },
92
+ Spec : v1.PersistentVolumeClaimSpec {VolumeName : "Vol_Stable_2" },
93
+ },
80
94
}
81
95
82
96
tests := []struct {
@@ -107,7 +121,7 @@ func TestSingleZone(t *testing.T) {
107
121
},
108
122
},
109
123
{
110
- name : "label zone failure domain matched" ,
124
+ name : "beta zone label matched" ,
111
125
Pod : createPodWithVolume ("pod_1" , "vol_1" , "PVC_1" ),
112
126
Node : & v1.Node {
113
127
ObjectMeta : metav1.ObjectMeta {
@@ -117,28 +131,28 @@ func TestSingleZone(t *testing.T) {
117
131
},
118
132
},
119
133
{
120
- name : "label zone region matched" ,
134
+ name : "beta region label matched" ,
121
135
Pod : createPodWithVolume ("pod_1" , "vol_1" , "PVC_2" ),
122
136
Node : & v1.Node {
123
137
ObjectMeta : metav1.ObjectMeta {
124
138
Name : "host1" ,
125
- Labels : map [string ]string {v1 .LabelZoneRegion : "us-west1-b " , "uselessLabel" : "none" },
139
+ Labels : map [string ]string {v1 .LabelZoneRegion : "us-west1" , "uselessLabel" : "none" },
126
140
},
127
141
},
128
142
},
129
143
{
130
- name : "label zone region failed match" ,
144
+ name : "beta region label doesn't match" ,
131
145
Pod : createPodWithVolume ("pod_1" , "vol_1" , "PVC_2" ),
132
146
Node : & v1.Node {
133
147
ObjectMeta : metav1.ObjectMeta {
134
148
Name : "host1" ,
135
- Labels : map [string ]string {v1 .LabelZoneRegion : "no_us-west1-b " , "uselessLabel" : "none" },
149
+ Labels : map [string ]string {v1 .LabelZoneRegion : "no_us-west1" , "uselessLabel" : "none" },
136
150
},
137
151
},
138
152
wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonConflict ),
139
153
},
140
154
{
141
- name : "label zone failure domain failed match" ,
155
+ name : "beta zone label doesn't match" ,
142
156
Pod : createPodWithVolume ("pod_1" , "vol_1" , "PVC_1" ),
143
157
Node : & v1.Node {
144
158
ObjectMeta : metav1.ObjectMeta {
@@ -148,6 +162,48 @@ func TestSingleZone(t *testing.T) {
148
162
},
149
163
wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonConflict ),
150
164
},
165
+ {
166
+ name : "zone label matched" ,
167
+ Pod : createPodWithVolume ("pod_1" , "Vol_Stable_1" , "PVC_Stable_1" ),
168
+ Node : & v1.Node {
169
+ ObjectMeta : metav1.ObjectMeta {
170
+ Name : "host1" ,
171
+ Labels : map [string ]string {v1 .LabelZoneFailureDomainStable : "us-west1-a" , "uselessLabel" : "none" },
172
+ },
173
+ },
174
+ },
175
+ {
176
+ name : "region label matched" ,
177
+ Pod : createPodWithVolume ("pod_1" , "Vol_Stable_2" , "PVC_Stable_2" ),
178
+ Node : & v1.Node {
179
+ ObjectMeta : metav1.ObjectMeta {
180
+ Name : "host1" ,
181
+ Labels : map [string ]string {v1 .LabelZoneRegionStable : "us-west1" , "uselessLabel" : "none" },
182
+ },
183
+ },
184
+ },
185
+ {
186
+ name : "region label doesn't match" ,
187
+ Pod : createPodWithVolume ("pod_1" , "Vol_Stable_2" , "PVC_Stable_2" ),
188
+ Node : & v1.Node {
189
+ ObjectMeta : metav1.ObjectMeta {
190
+ Name : "host1" ,
191
+ Labels : map [string ]string {v1 .LabelZoneRegionStable : "no_us-west1" , "uselessLabel" : "none" },
192
+ },
193
+ },
194
+ wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonConflict ),
195
+ },
196
+ {
197
+ name : "zone label doesn't match" ,
198
+ Pod : createPodWithVolume ("pod_1" , "Vol_Stable_1" , "PVC_Stable_1" ),
199
+ Node : & v1.Node {
200
+ ObjectMeta : metav1.ObjectMeta {
201
+ Name : "host1" ,
202
+ Labels : map [string ]string {v1 .LabelZoneFailureDomainStable : "no_us-west1-a" , "uselessLabel" : "none" },
203
+ },
204
+ },
205
+ wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonConflict ),
206
+ },
151
207
}
152
208
153
209
for _ , test := range tests {
@@ -178,6 +234,12 @@ func TestMultiZone(t *testing.T) {
178
234
{
179
235
ObjectMeta : metav1.ObjectMeta {Name : "Vol_3" , Labels : map [string ]string {v1 .LabelZoneFailureDomain : "us-west1-c__us-west1-a" }},
180
236
},
237
+ {
238
+ ObjectMeta : metav1.ObjectMeta {Name : "Vol_Stable_1" , Labels : map [string ]string {v1 .LabelZoneFailureDomainStable : "us-west1-a" }},
239
+ },
240
+ {
241
+ ObjectMeta : metav1.ObjectMeta {Name : "Vol_Stable_2" , Labels : map [string ]string {v1 .LabelZoneFailureDomainStable : "us-west1-c__us-west1-a" }},
242
+ },
181
243
}
182
244
183
245
pvcLister := fakelisters.PersistentVolumeClaimLister {
@@ -197,6 +259,14 @@ func TestMultiZone(t *testing.T) {
197
259
ObjectMeta : metav1.ObjectMeta {Name : "PVC_4" , Namespace : "default" },
198
260
Spec : v1.PersistentVolumeClaimSpec {VolumeName : "Vol_not_exist" },
199
261
},
262
+ {
263
+ ObjectMeta : metav1.ObjectMeta {Name : "PVC_Stable_1" , Namespace : "default" },
264
+ Spec : v1.PersistentVolumeClaimSpec {VolumeName : "Vol_Stable_1" },
265
+ },
266
+ {
267
+ ObjectMeta : metav1.ObjectMeta {Name : "PVC_Stable_2" , Namespace : "default" },
268
+ Spec : v1.PersistentVolumeClaimSpec {VolumeName : "Vol_Stable_2" },
269
+ },
200
270
}
201
271
202
272
tests := []struct {
@@ -215,7 +285,7 @@ func TestMultiZone(t *testing.T) {
215
285
},
216
286
},
217
287
{
218
- name : "label zone failure domain matched" ,
288
+ name : "beta zone label matched" ,
219
289
Pod : createPodWithVolume ("pod_1" , "Vol_3" , "PVC_3" ),
220
290
Node : & v1.Node {
221
291
ObjectMeta : metav1.ObjectMeta {
@@ -225,7 +295,7 @@ func TestMultiZone(t *testing.T) {
225
295
},
226
296
},
227
297
{
228
- name : "label zone failure domain failed match" ,
298
+ name : "beta zone label doesn't match" ,
229
299
Pod : createPodWithVolume ("pod_1" , "vol_1" , "PVC_1" ),
230
300
Node : & v1.Node {
231
301
ObjectMeta : metav1.ObjectMeta {
@@ -235,6 +305,27 @@ func TestMultiZone(t *testing.T) {
235
305
},
236
306
wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonConflict ),
237
307
},
308
+ {
309
+ name : "zone label matched" ,
310
+ Pod : createPodWithVolume ("pod_1" , "Vol_Stable_2" , "PVC_Stable_2" ),
311
+ Node : & v1.Node {
312
+ ObjectMeta : metav1.ObjectMeta {
313
+ Name : "host1" ,
314
+ Labels : map [string ]string {v1 .LabelZoneFailureDomainStable : "us-west1-a" , "uselessLabel" : "none" },
315
+ },
316
+ },
317
+ },
318
+ {
319
+ name : "zone label doesn't match" ,
320
+ Pod : createPodWithVolume ("pod_1" , "Vol_Stable_1" , "PVC_Stable_1" ),
321
+ Node : & v1.Node {
322
+ ObjectMeta : metav1.ObjectMeta {
323
+ Name : "host1" ,
324
+ Labels : map [string ]string {v1 .LabelZoneFailureDomainStable : "us-west1-b" , "uselessLabel" : "none" },
325
+ },
326
+ },
327
+ wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonConflict ),
328
+ },
238
329
}
239
330
240
331
for _ , test := range tests {
0 commit comments