diff --git a/pkg/apis/autoscaling/v1alpha1/pa_lifecycle.go b/pkg/apis/autoscaling/v1alpha1/pa_lifecycle.go index 91071fbf23d8..ab39d5558c49 100644 --- a/pkg/apis/autoscaling/v1alpha1/pa_lifecycle.go +++ b/pkg/apis/autoscaling/v1alpha1/pa_lifecycle.go @@ -173,6 +173,7 @@ func (pa *PodAutoscaler) ProgressDeadline() (time.Duration, bool) { return pa.annotationDuration(serving.ProgressDeadlineAnnotation) } +// RevisionTimeout returns the revision timeout annotation value, or false if not present. func (pa *PodAutoscaler) RevisionTimeout() (time.Duration, bool) { return pa.annotationDuration(serving.RevisionTimeoutAnnotation) } @@ -191,6 +192,8 @@ func (pa *PodAutoscaler) IsReady() bool { pas.GetCondition(PodAutoscalerConditionReady).IsTrue() } +// CanFailActivationOnUnreachableRevision checks whether the pod autoscaler is Unreachable and has been activating +// for at least the specified idle period func (pa *PodAutoscaler) CanFailActivationOnUnreachableRevision(now time.Time, idlePeriod time.Duration) bool { return pa.Spec.Reachability == ReachabilityUnreachable && pa.Status.CanFailActivation(now, idlePeriod) } diff --git a/pkg/apis/serving/register.go b/pkg/apis/serving/register.go index 00e2a470f90e..f41a6ec065c5 100644 --- a/pkg/apis/serving/register.go +++ b/pkg/apis/serving/register.go @@ -145,6 +145,7 @@ const ( // ProgressDeadlineAnnotationKey is the label key for the per revision progress deadline to set for the deployment ProgressDeadlineAnnotationKey = GroupName + "/progress-deadline" + // RevisionTimeoutAnnotationKey is the label key for the revision timeout to set for the pod autoscaler RevisionTimeoutAnnotationKey = GroupName + "/revision-timeout" ) diff --git a/pkg/reconciler/autoscaling/kpa/scaler.go b/pkg/reconciler/autoscaling/kpa/scaler.go index 7e7cac0b3b6f..b9a788a91fcf 100644 --- a/pkg/reconciler/autoscaling/kpa/scaler.go +++ b/pkg/reconciler/autoscaling/kpa/scaler.go @@ -328,6 +328,7 @@ func (ks *scaler) applyScale(ctx context.Context, pa *autoscalingv1alpha1.PodAut func (ks *scaler) scale(ctx context.Context, pa *autoscalingv1alpha1.PodAutoscaler, sks *netv1alpha1.ServerlessService, desiredScale int32) (int32, error) { asConfig := config.FromContext(ctx).Autoscaler logger := logging.FromContext(ctx) + if desiredScale < 0 && !pa.Status.IsActivating() { logger.Debug("Metrics are not yet being collected.") return desiredScale, nil