@@ -23,6 +23,7 @@ import (
23
23
"k8s.io/api/core/v1"
24
24
storage "k8s.io/api/storage/v1"
25
25
pvtesting "k8s.io/kubernetes/pkg/controller/volume/persistentvolume/testing"
26
+ pvutil "k8s.io/kubernetes/pkg/controller/volume/persistentvolume/util"
26
27
)
27
28
28
29
// Test single call to syncVolume, expecting recycling to happen.
@@ -34,7 +35,7 @@ func TestDeleteSync(t *testing.T) {
34
35
{
35
36
// delete volume bound by controller
36
37
"8-1 - successful delete" ,
37
- newVolumeArray ("volume8-1" , "1Gi" , "uid8-1" , "claim8-1" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annBoundByController ),
38
+ newVolumeArray ("volume8-1" , "1Gi" , "uid8-1" , "claim8-1" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnBoundByController ),
38
39
novolumes ,
39
40
noclaims ,
40
41
noclaims ,
@@ -102,8 +103,8 @@ func TestDeleteSync(t *testing.T) {
102
103
// starts. This simulates "volume no longer needs recycling,
103
104
// skipping".
104
105
"8-7 - volume is bound before deleting" ,
105
- newVolumeArray ("volume8-7" , "1Gi" , "uid8-7" , "claim8-7" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annBoundByController ),
106
- newVolumeArray ("volume8-7" , "1Gi" , "uid8-7" , "claim8-7" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annBoundByController ),
106
+ newVolumeArray ("volume8-7" , "1Gi" , "uid8-7" , "claim8-7" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnBoundByController ),
107
+ newVolumeArray ("volume8-7" , "1Gi" , "uid8-7" , "claim8-7" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnBoundByController ),
107
108
noclaims ,
108
109
newClaimArray ("claim8-7" , "uid8-7" , "10Gi" , "volume8-7" , v1 .ClaimBound , nil ),
109
110
noevents , noerrors ,
@@ -131,15 +132,15 @@ func TestDeleteSync(t *testing.T) {
131
132
{
132
133
// PV requires external deleter
133
134
"8-10 - external deleter" ,
134
- newVolumeArray ("volume8-10" , "1Gi" , "uid10-1" , "claim10-1" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annBoundByController ),
135
- newVolumeArray ("volume8-10" , "1Gi" , "uid10-1" , "claim10-1" , v1 .VolumeReleased , v1 .PersistentVolumeReclaimDelete , classEmpty , annBoundByController ),
135
+ newVolumeArray ("volume8-10" , "1Gi" , "uid10-1" , "claim10-1" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnBoundByController ),
136
+ newVolumeArray ("volume8-10" , "1Gi" , "uid10-1" , "claim10-1" , v1 .VolumeReleased , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnBoundByController ),
136
137
noclaims ,
137
138
noclaims ,
138
139
noevents , noerrors ,
139
140
func (ctrl * PersistentVolumeController , reactor * pvtesting.VolumeReactor , test controllerTest ) error {
140
141
// Inject external deleter annotation
141
- test .initialVolumes [0 ].Annotations [annDynamicallyProvisioned ] = "external.io/test"
142
- test .expectedVolumes [0 ].Annotations [annDynamicallyProvisioned ] = "external.io/test"
142
+ test .initialVolumes [0 ].Annotations [pvutil . AnnDynamicallyProvisioned ] = "external.io/test"
143
+ test .expectedVolumes [0 ].Annotations [pvutil . AnnDynamicallyProvisioned ] = "external.io/test"
143
144
return testSyncVolume (ctrl , reactor , test )
144
145
},
145
146
},
@@ -148,11 +149,11 @@ func TestDeleteSync(t *testing.T) {
148
149
// One of the PVs is deleted.
149
150
"8-11 - two PVs provisioned for a single claim" ,
150
151
[]* v1.PersistentVolume {
151
- newVolume ("volume8-11-1" , "1Gi" , "uid8-11" , "claim8-11" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annDynamicallyProvisioned ),
152
- newVolume ("volume8-11-2" , "1Gi" , "uid8-11" , "claim8-11" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annDynamicallyProvisioned ),
152
+ newVolume ("volume8-11-1" , "1Gi" , "uid8-11" , "claim8-11" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnDynamicallyProvisioned ),
153
+ newVolume ("volume8-11-2" , "1Gi" , "uid8-11" , "claim8-11" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnDynamicallyProvisioned ),
153
154
},
154
155
[]* v1.PersistentVolume {
155
- newVolume ("volume8-11-2" , "1Gi" , "uid8-11" , "claim8-11" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annDynamicallyProvisioned ),
156
+ newVolume ("volume8-11-2" , "1Gi" , "uid8-11" , "claim8-11" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnDynamicallyProvisioned ),
156
157
},
157
158
// the claim is bound to volume8-11-2 -> volume8-11-1 has lost the race and will be deleted
158
159
newClaimArray ("claim8-11" , "uid8-11" , "10Gi" , "volume8-11-2" , v1 .ClaimBound , nil ),
@@ -168,21 +169,21 @@ func TestDeleteSync(t *testing.T) {
168
169
// external provisioner.
169
170
"8-12 - two PVs externally provisioned for a single claim" ,
170
171
[]* v1.PersistentVolume {
171
- newVolume ("volume8-12-1" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annDynamicallyProvisioned ),
172
- newVolume ("volume8-12-2" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annDynamicallyProvisioned ),
172
+ newVolume ("volume8-12-1" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnDynamicallyProvisioned ),
173
+ newVolume ("volume8-12-2" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnDynamicallyProvisioned ),
173
174
},
174
175
[]* v1.PersistentVolume {
175
- newVolume ("volume8-12-1" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeReleased , v1 .PersistentVolumeReclaimDelete , classEmpty , annDynamicallyProvisioned ),
176
- newVolume ("volume8-12-2" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , annDynamicallyProvisioned ),
176
+ newVolume ("volume8-12-1" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeReleased , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnDynamicallyProvisioned ),
177
+ newVolume ("volume8-12-2" , "1Gi" , "uid8-12" , "claim8-12" , v1 .VolumeBound , v1 .PersistentVolumeReclaimDelete , classEmpty , pvutil . AnnDynamicallyProvisioned ),
177
178
},
178
179
// the claim is bound to volume8-12-2 -> volume8-12-1 has lost the race and will be "Released"
179
180
newClaimArray ("claim8-12" , "uid8-12" , "10Gi" , "volume8-12-2" , v1 .ClaimBound , nil ),
180
181
newClaimArray ("claim8-12" , "uid8-12" , "10Gi" , "volume8-12-2" , v1 .ClaimBound , nil ),
181
182
noevents , noerrors ,
182
183
func (ctrl * PersistentVolumeController , reactor * pvtesting.VolumeReactor , test controllerTest ) error {
183
184
// Inject external deleter annotation
184
- test .initialVolumes [0 ].Annotations [annDynamicallyProvisioned ] = "external.io/test"
185
- test .expectedVolumes [0 ].Annotations [annDynamicallyProvisioned ] = "external.io/test"
185
+ test .initialVolumes [0 ].Annotations [pvutil . AnnDynamicallyProvisioned ] = "external.io/test"
186
+ test .expectedVolumes [0 ].Annotations [pvutil . AnnDynamicallyProvisioned ] = "external.io/test"
186
187
return testSyncVolume (ctrl , reactor , test )
187
188
},
188
189
},
0 commit comments