mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
Add integration tests for desire state of world populator
This adds tests for code introduced here : https://github.com/kubernetes/kubernetes/issues/26994 Via integration test we can now verify that if pod delete event is somehow missed by AttachDetach controller - it still get cleaned up by Desired State of World populator.
This commit is contained in:
@@ -67,6 +67,7 @@ const (
|
||||
// AttachDetachController defines the operations supported by this controller.
|
||||
type AttachDetachController interface {
|
||||
Run(stopCh <-chan struct{})
|
||||
GetDesiredStateOfWorld() cache.DesiredStateOfWorld
|
||||
}
|
||||
|
||||
// NewAttachDetachController returns a new instance of AttachDetachController.
|
||||
@@ -220,7 +221,6 @@ func (adc *attachDetachController) podAdd(obj interface{}) {
|
||||
if pod == nil || !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if pod.Spec.NodeName == "" {
|
||||
// Ignore pods without NodeName, indicating they are not scheduled.
|
||||
return
|
||||
@@ -229,6 +229,11 @@ func (adc *attachDetachController) podAdd(obj interface{}) {
|
||||
adc.processPodVolumes(pod, true /* addVolumes */)
|
||||
}
|
||||
|
||||
// GetDesiredStateOfWorld returns desired state of world associated with controller
|
||||
func (adc *attachDetachController) GetDesiredStateOfWorld() cache.DesiredStateOfWorld {
|
||||
return adc.desiredStateOfWorld
|
||||
}
|
||||
|
||||
func (adc *attachDetachController) podUpdate(oldObj, newObj interface{}) {
|
||||
// The flow for update is the same as add.
|
||||
adc.podAdd(newObj)
|
||||
|
||||
Reference in New Issue
Block a user