diff --git a/config/config-autoscaler.yaml b/config/config-autoscaler.yaml index 976e8a114f13..9bebf5d32c3f 100644 --- a/config/config-autoscaler.yaml +++ b/config/config-autoscaler.yaml @@ -69,8 +69,8 @@ data: # Scale to zero threshold is the total time between traffic dropping to # zero and when its resources are deprovisioned. Must be at least 30s # more than scale-to-zero-grace-period (min: 60s) - scale-to-zero-threshold: "5m" + scale-to-zero-threshold: "60s" # Scale to zero grace period is the time an inactive revision is left # running before it is scaled to zero (min: 30s). - scale-to-zero-grace-period: "2m" + scale-to-zero-grace-period: "30s" diff --git a/pkg/apis/serving/v1alpha1/revision_types.go b/pkg/apis/serving/v1alpha1/revision_types.go index 99dc49105409..cc6bf8bc983d 100644 --- a/pkg/apis/serving/v1alpha1/revision_types.go +++ b/pkg/apis/serving/v1alpha1/revision_types.go @@ -199,7 +199,6 @@ const ( var revCondSet = duckv1alpha1.NewLivingConditionSet( RevisionConditionResourcesAvailable, RevisionConditionContainerHealthy, - RevisionConditionActive, RevisionConditionBuildSucceeded, ) diff --git a/pkg/apis/serving/v1alpha1/revision_types_test.go b/pkg/apis/serving/v1alpha1/revision_types_test.go index 8c88cc36e9c2..8f7842d62857 100644 --- a/pkg/apis/serving/v1alpha1/revision_types_test.go +++ b/pkg/apis/serving/v1alpha1/revision_types_test.go @@ -500,7 +500,6 @@ func TestTypicalFlowWithSuspendResume(t *testing.T) { checkConditionOngoingRevision(r.Status, RevisionConditionResourcesAvailable, t) checkConditionOngoingRevision(r.Status, RevisionConditionContainerHealthy, t) checkConditionOngoingRevision(r.Status, RevisionConditionReady, t) - checkConditionOngoingRevision(r.Status, RevisionConditionActive, t) // Enter a Ready state. r.Status.MarkActive() @@ -526,9 +525,7 @@ func TestTypicalFlowWithSuspendResume(t *testing.T) { if got := checkConditionFailedRevision(r.Status, RevisionConditionActive, t); got == nil || got.Reason != want { t.Errorf("MarkInactive = %v, want %v", got, want) } - if got := checkConditionFailedRevision(r.Status, RevisionConditionReady, t); got == nil || got.Reason != want { - t.Errorf("MarkInactive = %v, want %v", got, want) - } + checkConditionSucceededRevision(r.Status, RevisionConditionReady, t) // From an Inactive state, start to activate the revision. want = "Activating" @@ -538,9 +535,7 @@ func TestTypicalFlowWithSuspendResume(t *testing.T) { if got := checkConditionOngoingRevision(r.Status, RevisionConditionActive, t); got == nil || got.Reason != want { t.Errorf("MarkInactive = %v, want %v", got, want) } - if got := checkConditionOngoingRevision(r.Status, RevisionConditionReady, t); got == nil || got.Reason != want { - t.Errorf("MarkInactive = %v, want %v", got, want) - } + checkConditionSucceededRevision(r.Status, RevisionConditionReady, t) // From the activating state, simulate the transition back to readiness. r.Status.MarkActive() diff --git a/pkg/reconciler/v1alpha1/revision/reconcile_resources.go b/pkg/reconciler/v1alpha1/revision/reconcile_resources.go index 22f50b6dd50f..e9aadf9732b3 100644 --- a/pkg/reconciler/v1alpha1/revision/reconcile_resources.go +++ b/pkg/reconciler/v1alpha1/revision/reconcile_resources.go @@ -64,7 +64,7 @@ func (c *Reconciler) reconcileDeployment(ctx context.Context, rev *v1alpha1.Revi // Now that we have a Deployment, determine whether there is any relevant // status to surface in the Revision. - if hasDeploymentTimedOut(deployment) { + if hasDeploymentTimedOut(deployment) && !rev.Status.IsActivationRequired() { rev.Status.MarkProgressDeadlineExceeded(fmt.Sprintf( "Unable to create pods for more than %d seconds.", resources.ProgressDeadlineSeconds)) c.Recorder.Eventf(rev, corev1.EventTypeNormal, "ProgressDeadlineExceeded", @@ -187,7 +187,7 @@ func (c *Reconciler) reconcileService(ctx context.Context, rev *v1alpha1.Revisio // TODO(mattmoor): How to ensure this only fires once? c.Recorder.Eventf(rev, corev1.EventTypeNormal, "RevisionReady", "Revision becomes ready upon endpoint %q becoming ready", serviceName) - } else { + } else if !rev.Status.IsActivationRequired() { // If the endpoints is NOT ready, then check whether it is taking unreasonably // long to become ready and if so mark our revision as having timed out waiting // for the Service to become ready. diff --git a/pkg/reconciler/v1alpha1/revision/table_test.go b/pkg/reconciler/v1alpha1/revision/table_test.go index fc38b88c9b87..3dd4a056ccfe 100644 --- a/pkg/reconciler/v1alpha1/revision/table_test.go +++ b/pkg/reconciler/v1alpha1/revision/table_test.go @@ -48,9 +48,6 @@ import ( var ( conditionsOnFailure = duckv1alpha1.Conditions{{ - Type: "Active", - Status: "Unknown", - }, { Type: "BuildSucceeded", Status: "True", }, { @@ -395,8 +392,7 @@ func TestReconcile(t *testing.T) { LogURL: "http://logger.io/test-uid", Conditions: duckv1alpha1.Conditions{{ Type: "Active", - Status: "Unknown", - Reason: "Deploying", + Status: "True", }, { Type: "BuildSucceeded", Status: "True", @@ -416,7 +412,17 @@ func TestReconcile(t *testing.T) { // on the Endpoints to become ready. }}, }), - kpa("foo", "endpoint-created-timeout", "busybox"), + addKPAStatus( + kpa("foo", "endpoint-created-timeout", "busybox"), + kpav1alpha1.PodAutoscalerStatus{ + Conditions: duckv1alpha1.Conditions{{ + Type: "Active", + Status: "True", + }, { + Type: "Ready", + Status: "True", + }}, + }), deploy("foo", "endpoint-created-timeout", "busybox"), svc("foo", "endpoint-created-timeout", "busybox"), endpoints("foo", "endpoint-created-timeout", "busybox"), @@ -430,8 +436,7 @@ func TestReconcile(t *testing.T) { LogURL: "http://logger.io/test-uid", Conditions: duckv1alpha1.Conditions{{ Type: "Active", - Status: "Unknown", - Reason: "Deploying", + Status: "True", }, { Type: "BuildSucceeded", Status: "True", @@ -594,10 +599,8 @@ func TestReconcile(t *testing.T) { Type: "ContainerHealthy", Status: "True", }, { - Type: "Ready", - Status: "Unknown", - Reason: "Something", - Message: "This is something longer", + Type: "Ready", + Status: "True", }, { Type: "ResourcesAvailable", Status: "True", @@ -670,10 +673,9 @@ func TestReconcile(t *testing.T) { Status: "Unknown", Reason: "Deploying", }, { - Type: "Ready", - Status: "False", - Reason: "NoTraffic", - Message: "This thing is inactive.", + Type: "Ready", + Status: "Unknown", + Reason: "Deploying", }, { Type: "ResourcesAvailable", Status: "Unknown", @@ -741,7 +743,7 @@ func TestReconcile(t *testing.T) { }, { Type: "Ready", Status: "Unknown", - Reason: "Deploying", + Reason: "Updating", }, { Type: "ResourcesAvailable", Status: "Unknown", @@ -880,9 +882,6 @@ func TestReconcile(t *testing.T) { v1alpha1.RevisionStatus{ LogURL: "http://logger.io/test-uid", Conditions: duckv1alpha1.Conditions{{ - Type: "Active", - Status: "Unknown", - }, { Type: "BuildSucceeded", Status: "Unknown", }, { @@ -919,9 +918,6 @@ func TestReconcile(t *testing.T) { v1alpha1.RevisionStatus{ LogURL: "http://logger.io/test-uid", Conditions: duckv1alpha1.Conditions{{ - Type: "Active", - Status: "Unknown", - }, { Type: "BuildSucceeded", Status: "Unknown", Reason: "Building", @@ -1088,9 +1084,6 @@ func TestReconcile(t *testing.T) { v1alpha1.RevisionStatus{ LogURL: "http://logger.io/test-uid", Conditions: duckv1alpha1.Conditions{{ - Type: "Active", - Status: "Unknown", - }, { Type: "BuildSucceeded", Status: "False", Reason: "SomeReason", @@ -1252,9 +1245,6 @@ func TestReconcileWithVarLogEnabled(t *testing.T) { ServiceName: svc("foo", "create-configmap-failure", "busybox").Name, LogURL: "http://logger.io/test-uid", Conditions: duckv1alpha1.Conditions{{ - Type: "Active", - Status: "Unknown", - }, { Type: "BuildSucceeded", Status: "True", }, {