From b46d7fd5271a103a23c35a6988847b260d07329d Mon Sep 17 00:00:00 2001 From: Taylor Thomas Date: Wed, 7 Aug 2019 11:46:27 -0600 Subject: [PATCH] fix(kube): Fixes nil panic with stateful set waiting Sometimes the stateful set `rollingUpdate` field can be nil even when the strategy is a rolling update Fixes #6174 Signed-off-by: Taylor Thomas --- pkg/kube/wait.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/kube/wait.go b/pkg/kube/wait.go index bf502baea..b040f2d26 100644 --- a/pkg/kube/wait.go +++ b/pkg/kube/wait.go @@ -267,7 +267,10 @@ func (w *waiter) statefulSetReady(sts *appsv1.StatefulSet) bool { var partition int // 1 is the default for replicas if not set var replicas = 1 - if sts.Spec.UpdateStrategy.RollingUpdate.Partition != nil { + // For some reason, even if the update strategy is a rolling update, the + // actual rollingUpdate field can be nil. If it is, we can safely assume + // there is no partition value + if sts.Spec.UpdateStrategy.RollingUpdate != nil && sts.Spec.UpdateStrategy.RollingUpdate.Partition != nil { partition = int(*sts.Spec.UpdateStrategy.RollingUpdate.Partition) } if sts.Spec.Replicas != nil {