Skip to content

Commit

Permalink
Make Active a non-terminal condition. (#2397)
Browse files Browse the repository at this point in the history
Related to: #2394
  • Loading branch information
mattmoor authored and knative-prow-robot committed Nov 9, 2018
1 parent 2a6f37c commit 6a36566
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 79 deletions.
1 change: 0 additions & 1 deletion pkg/apis/serving/v1alpha1/revision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ const (
var revCondSet = duckv1alpha1.NewLivingConditionSet(
RevisionConditionResourcesAvailable,
RevisionConditionContainerHealthy,
RevisionConditionActive,
RevisionConditionBuildSucceeded,
)

Expand Down
9 changes: 2 additions & 7 deletions pkg/apis/serving/v1alpha1/revision_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,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()
Expand All @@ -527,9 +526,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"
Expand All @@ -539,9 +536,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()
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/v1alpha1/revision/reconcile_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 6a36566

Please sign in to comment.