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

Have Activator key off of Active not Ready. #2395

Merged
merged 1 commit into from
Nov 2, 2018
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
14 changes: 7 additions & 7 deletions pkg/activator/revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func (r *revisionActivator) activateRevision(namespace, name string) (*v1alpha1.
serviceName, configurationName := getServiceAndConfigurationLabels(revision)
r.reporter.ReportRequest(namespace, serviceName, configurationName, name, 1.0)

// Wait for the revision to be ready
if !revision.Status.IsReady() {
// Wait for the revision to not require activation.
if revision.Status.IsActivationRequired() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please update the comment above, similar to what you have in the PR description?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

wi, err := r.knaClient.ServingV1alpha1().Revisions(rev.namespace).Watch(metav1.ListOptions{
FieldSelector: fmt.Sprintf("metadata.name=%s", rev.name),
})
Expand All @@ -88,24 +88,24 @@ func (r *revisionActivator) activateRevision(namespace, name string) (*v1alpha1.
}
defer wi.Stop()
ch := wi.ResultChan()
RevisionReady:
RevisionActive:
for {
select {
case <-time.After(r.readyTimout):
// last chance to check
if revision.Status.IsReady() {
break RevisionReady
if !revision.Status.IsActivationRequired() {
break RevisionActive
}
return nil, errors.New("Timeout waiting for revision to become ready")
case event := <-ch:
if revision, ok := event.Object.(*v1alpha1.Revision); ok {
if !revision.Status.IsReady() {
if revision.Status.IsActivationRequired() {
logger.Info("Revision is not yet ready")
continue
} else {
logger.Info("Revision is ready")
}
break RevisionReady
break RevisionActive
} else {
return nil, fmt.Errorf("Unexpected result type for revision: %v", event)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/activator/revision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ func (b *revisionBuilder) withReady(ready bool) *revisionBuilder {
if ready {
b.revision.Status.MarkContainerHealthy()
b.revision.Status.MarkResourcesAvailable()
b.revision.Status.MarkActive()
} else {
b.revision.Status.MarkContainerMissing("reasonz")
b.revision.Status.MarkInactive("reasonz", "detailz")
}
return b
}
Expand Down