From 4e8dcc8a1b86b302fb98184168b57e99ecfe7107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Th=C3=B6mmes?= Date: Tue, 13 Oct 2020 11:30:53 +0200 Subject: [PATCH] Fix nil-pointer on accessing condition in autoscaler --- pkg/reconciler/autoscaling/kpa/kpa.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/reconciler/autoscaling/kpa/kpa.go b/pkg/reconciler/autoscaling/kpa/kpa.go index b472cf71521b..4988edc4771b 100644 --- a/pkg/reconciler/autoscaling/kpa/kpa.go +++ b/pkg/reconciler/autoscaling/kpa/kpa.go @@ -149,7 +149,7 @@ func (c *Reconciler) ReconcileKind(ctx context.Context, pa *pav1alpha1.PodAutosc pa.Status.MarkSKSReady() } else { logger.Debug("SKS is not ready, marking SKS status not ready") - pa.Status.MarkSKSNotReady(sks.Status.GetCondition(nv1alpha1.ServerlessServiceConditionReady).Message) + pa.Status.MarkSKSNotReady(sks.Status.GetCondition(nv1alpha1.ServerlessServiceConditionReady).GetMessage()) } logger.Infof("PA scale got=%d, want=%d, desiredPods=%d ebc=%d", ready, want, @@ -235,7 +235,7 @@ func computeActiveCondition(ctx context.Context, pa *pav1alpha1.PodAutoscaler, p // In pre-0.17 we could have scaled down normally without ever setting ScaleTargetInitialized. // In this case we'll be in the NoTraffic/inactive state. // TODO(taragu): remove after 0.19 - alreadyScaledDownSuccessfully := minReady > 0 && pa.Status.GetCondition(pav1alpha1.PodAutoscalerConditionActive).Reason == noTrafficReason + alreadyScaledDownSuccessfully := minReady > 0 && pa.Status.GetCondition(pav1alpha1.PodAutoscalerConditionActive).GetReason() == noTrafficReason if (pc.ready >= minReady || alreadyScaledDownSuccessfully) && pa.Status.ServiceName != "" { pa.Status.MarkScaleTargetInitialized() }