mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Add limit of stored errors
There should be a limit so the set of errors does not grow too much in case of some bug in the populator.
This commit is contained in:
parent
af0c2fe572
commit
c744385804
@ -206,6 +206,12 @@ type podToMount struct {
|
||||
outerVolumeSpecName string
|
||||
}
|
||||
|
||||
const (
|
||||
// Maximum errors to be stored per pod in desiredStateOfWorld.podErrors to
|
||||
// prevent unbound growth.
|
||||
maxPodErrors = 10
|
||||
)
|
||||
|
||||
func (dsw *desiredStateOfWorld) AddPodToVolume(
|
||||
podName types.UniquePodName,
|
||||
pod *v1.Pod,
|
||||
@ -436,7 +442,9 @@ func (dsw *desiredStateOfWorld) AddErrorToPod(podName types.UniquePodName, err s
|
||||
defer dsw.Unlock()
|
||||
|
||||
if errs, found := dsw.podErrors[podName]; found {
|
||||
errs.Insert(err)
|
||||
if errs.Len() <= maxPodErrors {
|
||||
errs.Insert(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
dsw.podErrors[podName] = sets.NewString(err)
|
||||
|
Loading…
Reference in New Issue
Block a user