mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
DaemonSet: Fix surgeCount function
If the surge is not requested, we should return 0. We are returning an error now as r.MaxSurge is passed down as nil. This commit fixes the issue by setting the surgeCount to 0 if r.MaxSurge is nil.
This commit is contained in:
parent
f94e8ba908
commit
ceeb05a3d7
@ -144,6 +144,10 @@ func SurgeCount(ds *apps.DaemonSet, numberToSchedule int) (int, error) {
|
||||
if r == nil {
|
||||
return 0, nil
|
||||
}
|
||||
// If surge is not requested, we should default to 0.
|
||||
if r.MaxSurge == nil {
|
||||
return 0, nil
|
||||
}
|
||||
return intstrutil.GetScaledValueFromIntOrPercent(r.MaxSurge, numberToSchedule, true)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user