mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #101875 from ravisantoshgudimetla/fix-nil-check
Fix nil check
This commit is contained in:
commit
c7be77935e
@ -847,6 +847,9 @@ func TestDaemonSetPodCreateExpectationsError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSimpleDaemonSetUpdatesStatusAfterLaunchingPods(t *testing.T) {
|
||||
dsMaxSurgeFeatureFlags := []bool{false, true}
|
||||
for _, isEnabled := range dsMaxSurgeFeatureFlags {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DaemonSetUpdateSurge, isEnabled)()
|
||||
for _, strategy := range updateStrategies() {
|
||||
ds := newDaemonSet("foo")
|
||||
ds.Spec.UpdateStrategy = *strategy
|
||||
@ -877,6 +880,7 @@ func TestSimpleDaemonSetUpdatesStatusAfterLaunchingPods(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DaemonSets should do nothing if there aren't any nodes
|
||||
func TestNoNodesDoesNothing(t *testing.T) {
|
||||
|
@ -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