Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem of Configuration becomes ready prematurely #6096

Merged
merged 3 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/apis/serving/v1alpha1/configuration_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ func (cs *ConfigurationStatus) SetLatestCreatedRevisionName(name string) {

func (cs *ConfigurationStatus) SetLatestReadyRevisionName(name string) {
cs.LatestReadyRevisionName = name
confCondSet.Manage(cs).MarkTrue(ConfigurationConditionReady)
if cs.LatestReadyRevisionName == cs.LatestCreatedRevisionName {
confCondSet.Manage(cs).MarkTrue(ConfigurationConditionReady)
}
}

func (cs *ConfigurationStatus) MarkLatestCreatedFailed(name, message string) {
Expand Down
37 changes: 35 additions & 2 deletions pkg/reconciler/configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ func TestReconcile(t *testing.T) {
Object: cfg("matching-revision-done", "foo", 5555, WithObservedGen,
// When we see the LatestCreatedRevision become Ready, then we
// update the latest ready revision.
WithLatestReady("matching-revision-done-00001"),
WithLatestCreated("matching-revision-done-00001")),
WithLatestCreated("matching-revision-done-00001"),
WithLatestReady("matching-revision-done-00001")),
}},
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "ConfigurationReady", "Configuration becomes ready"),
Expand Down Expand Up @@ -419,6 +419,39 @@ func TestReconcile(t *testing.T) {
Eventf(corev1.EventTypeNormal, "LatestReadyUpdate", "LatestReadyRevisionName updated to %q", "threerevs-00002"),
},
Key: "foo/threerevs",
}, {
Name: "revision not ready, the latest ready should be updated, but the configuration should still be ready==Unknown",
Objects: []runtime.Object{
cfg("revnotready", "foo", 3,
WithLatestCreated("revnotready-00002"),
WithLatestReady("revnotready-00001"), WithObservedGen, func(cfg *v1alpha1.Configuration) {
cfg.Spec.GetTemplate().Name = "revnotready-00003"
},
),
rev("revnotready", "foo", 1,
WithRevName("revnotready-00001"),
WithCreationTimestamp(now), MarkRevisionReady),
rev("revnotready", "foo", 2,
WithRevName("revnotready-00002"),
WithCreationTimestamp(now), MarkRevisionReady),
rev("revnotready", "foo", 3,
WithRevName("revnotready-00003"),
WithCreationTimestamp(now)),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: cfg("revnotready", "foo", 3,
// The config should NOT be ready, because LCR != LRR
WithLatestCreated("revnotready-00003"),
WithLatestReady("revnotready-00002"),
WithObservedGen, func(cfg *v1alpha1.Configuration) {
cfg.Spec.GetTemplate().Name = "revnotready-00003"
},
),
}},
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "LatestReadyUpdate", "LatestReadyRevisionName updated to %q", "revnotready-00002"),
},
Key: "foo/revnotready",
}}

table.Test(t, MakeFactory(func(ctx context.Context, listers *Listers, cmw configmap.Watcher) controller.Reconciler {
Expand Down