mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Remove volumesNeedReportedInUse for reconstructed volumes
This commit is contained in:
parent
8c1983ffc0
commit
2491560ae5
@ -62,11 +62,4 @@ func (rc *reconciler) reconcile() {
|
|||||||
// This will start reconciliation of node.status.volumesInUse.
|
// This will start reconciliation of node.status.volumesInUse.
|
||||||
rc.updateLastSyncTime()
|
rc.updateLastSyncTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rc.volumesNeedReportedInUse) != 0 && rc.populatorHasAddedPods() {
|
|
||||||
// Once DSW is populated, mark all reconstructed as reported in node.status,
|
|
||||||
// so they can proceed with MountDevice / SetUp.
|
|
||||||
rc.desiredStateOfWorld.MarkVolumesReportedInUse(rc.volumesNeedReportedInUse)
|
|
||||||
rc.volumesNeedReportedInUse = nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,6 @@ func NewReconciler(
|
|||||||
timeOfLastSync: time.Time{},
|
timeOfLastSync: time.Time{},
|
||||||
volumesFailedReconstruction: make([]podVolume, 0),
|
volumesFailedReconstruction: make([]podVolume, 0),
|
||||||
volumesNeedUpdateFromNodeStatus: make([]v1.UniqueVolumeName, 0),
|
volumesNeedUpdateFromNodeStatus: make([]v1.UniqueVolumeName, 0),
|
||||||
volumesNeedReportedInUse: make([]v1.UniqueVolumeName, 0),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +142,6 @@ type reconciler struct {
|
|||||||
timeOfLastSync time.Time
|
timeOfLastSync time.Time
|
||||||
volumesFailedReconstruction []podVolume
|
volumesFailedReconstruction []podVolume
|
||||||
volumesNeedUpdateFromNodeStatus []v1.UniqueVolumeName
|
volumesNeedUpdateFromNodeStatus []v1.UniqueVolumeName
|
||||||
volumesNeedReportedInUse []v1.UniqueVolumeName
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rc *reconciler) unmountVolumes() {
|
func (rc *reconciler) unmountVolumes() {
|
||||||
|
@ -91,9 +91,6 @@ func (rc *reconciler) reconstructVolumes() {
|
|||||||
// Add the volumes to ASW
|
// Add the volumes to ASW
|
||||||
rc.updateStates(reconstructedVolumes)
|
rc.updateStates(reconstructedVolumes)
|
||||||
|
|
||||||
// The reconstructed volumes are mounted, hence a previous kubelet must have already put it into node.status.volumesInUse.
|
|
||||||
// Remember to update DSW with this information.
|
|
||||||
rc.volumesNeedReportedInUse = reconstructedVolumeNames
|
|
||||||
// Remember to update devicePath from node.status.volumesAttached
|
// Remember to update devicePath from node.status.volumesAttached
|
||||||
rc.volumesNeedUpdateFromNodeStatus = reconstructedVolumeNames
|
rc.volumesNeedUpdateFromNodeStatus = reconstructedVolumeNames
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ func TestReconstructVolumes(t *testing.T) {
|
|||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
volumePaths []string
|
volumePaths []string
|
||||||
expectedVolumesNeedReportedInUse []string
|
|
||||||
expectedVolumesNeedDevicePath []string
|
expectedVolumesNeedDevicePath []string
|
||||||
expectedVolumesFailedReconstruction []string
|
expectedVolumesFailedReconstruction []string
|
||||||
verifyFunc func(rcInstance *reconciler, fakePlugin *volumetesting.FakeVolumePlugin) error
|
verifyFunc func(rcInstance *reconciler, fakePlugin *volumetesting.FakeVolumePlugin) error
|
||||||
@ -47,7 +46,6 @@ func TestReconstructVolumes(t *testing.T) {
|
|||||||
filepath.Join("pod1", "volumes", "fake-plugin", "pvc-abcdef"),
|
filepath.Join("pod1", "volumes", "fake-plugin", "pvc-abcdef"),
|
||||||
filepath.Join("pod2", "volumes", "fake-plugin", "pvc-abcdef"),
|
filepath.Join("pod2", "volumes", "fake-plugin", "pvc-abcdef"),
|
||||||
},
|
},
|
||||||
expectedVolumesNeedReportedInUse: []string{"fake-plugin/pvc-abcdef", "fake-plugin/pvc-abcdef"},
|
|
||||||
expectedVolumesNeedDevicePath: []string{"fake-plugin/pvc-abcdef", "fake-plugin/pvc-abcdef"},
|
expectedVolumesNeedDevicePath: []string{"fake-plugin/pvc-abcdef", "fake-plugin/pvc-abcdef"},
|
||||||
expectedVolumesFailedReconstruction: []string{},
|
expectedVolumesFailedReconstruction: []string{},
|
||||||
verifyFunc: func(rcInstance *reconciler, fakePlugin *volumetesting.FakeVolumePlugin) error {
|
verifyFunc: func(rcInstance *reconciler, fakePlugin *volumetesting.FakeVolumePlugin) error {
|
||||||
@ -75,7 +73,6 @@ func TestReconstructVolumes(t *testing.T) {
|
|||||||
volumePaths: []string{
|
volumePaths: []string{
|
||||||
filepath.Join("pod1", "volumes", "missing-plugin", "pvc-abcdef"),
|
filepath.Join("pod1", "volumes", "missing-plugin", "pvc-abcdef"),
|
||||||
},
|
},
|
||||||
expectedVolumesNeedReportedInUse: []string{},
|
|
||||||
expectedVolumesNeedDevicePath: []string{},
|
expectedVolumesNeedDevicePath: []string{},
|
||||||
expectedVolumesFailedReconstruction: []string{"pvc-abcdef"},
|
expectedVolumesFailedReconstruction: []string{"pvc-abcdef"},
|
||||||
},
|
},
|
||||||
@ -117,14 +114,6 @@ func TestReconstructVolumes(t *testing.T) {
|
|||||||
t.Errorf("Expected expectedVolumesNeedDevicePath:\n%v\n got:\n%v", expectedVolumes, rcInstance.volumesNeedUpdateFromNodeStatus)
|
t.Errorf("Expected expectedVolumesNeedDevicePath:\n%v\n got:\n%v", expectedVolumes, rcInstance.volumesNeedUpdateFromNodeStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedVolumes = make([]v1.UniqueVolumeName, len(tc.expectedVolumesNeedReportedInUse))
|
|
||||||
for i := range tc.expectedVolumesNeedReportedInUse {
|
|
||||||
expectedVolumes[i] = v1.UniqueVolumeName(tc.expectedVolumesNeedReportedInUse[i])
|
|
||||||
}
|
|
||||||
if !reflect.DeepEqual(expectedVolumes, rcInstance.volumesNeedReportedInUse) {
|
|
||||||
t.Errorf("Expected volumesNeedReportedInUse:\n%v\n got:\n%v", expectedVolumes, rcInstance.volumesNeedReportedInUse)
|
|
||||||
}
|
|
||||||
|
|
||||||
volumesFailedReconstruction := sets.NewString()
|
volumesFailedReconstruction := sets.NewString()
|
||||||
for _, vol := range rcInstance.volumesFailedReconstruction {
|
for _, vol := range rcInstance.volumesFailedReconstruction {
|
||||||
volumesFailedReconstruction.Insert(vol.volumeSpecName)
|
volumesFailedReconstruction.Insert(vol.volumeSpecName)
|
||||||
|
Loading…
Reference in New Issue
Block a user