mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +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
|
outerVolumeSpecName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Maximum errors to be stored per pod in desiredStateOfWorld.podErrors to
|
||||||
|
// prevent unbound growth.
|
||||||
|
maxPodErrors = 10
|
||||||
|
)
|
||||||
|
|
||||||
func (dsw *desiredStateOfWorld) AddPodToVolume(
|
func (dsw *desiredStateOfWorld) AddPodToVolume(
|
||||||
podName types.UniquePodName,
|
podName types.UniquePodName,
|
||||||
pod *v1.Pod,
|
pod *v1.Pod,
|
||||||
@ -436,7 +442,9 @@ func (dsw *desiredStateOfWorld) AddErrorToPod(podName types.UniquePodName, err s
|
|||||||
defer dsw.Unlock()
|
defer dsw.Unlock()
|
||||||
|
|
||||||
if errs, found := dsw.podErrors[podName]; found {
|
if errs, found := dsw.podErrors[podName]; found {
|
||||||
|
if errs.Len() <= maxPodErrors {
|
||||||
errs.Insert(err)
|
errs.Insert(err)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dsw.podErrors[podName] = sets.NewString(err)
|
dsw.podErrors[podName] = sets.NewString(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user