Skip to content

Propagate termination message of a failing pod to the revision. - #2722

Merged
knative-prow-robot merged 12 commits into
knative:masterfrom
markusthoemmes:revision-fail
Dec 21, 2018
Merged

knative-prow-robot merged 12 commits into
knative:masterfrom
markusthoemmes:revision-fail

Conversation

@markusthoemmes

@markusthoemmes markusthoemmes commented Dec 14, 2018 •

Copy link
Copy Markdown
Contributor

Fixes #499
Fixes #2010

Proposed Changes

  • Start a user-container with the termination message policy "TerminationMessageFallbackToLogsOnError".
  • Propagate the termination message and reason to the revision if pods fail to come up.

Release Note

The reason and message for crashing pods are now propagated to the revision to ease debuggability.

@knative-prow-robot knative-prow-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 14, 2018

@knative-prow-robot knative-prow-robot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@markusthoemmes: 2 warnings.

Details

In response to this:

…sion.

Fixes #499

Proposed Changes

  • Start a user-container with the termination message policy "TerminationMessageFallbackToLogsOnError".
  • Propagate the termination message and reason to the revision if pods fail to come up.

Todo

  • Unit tests
  • Conformance test

Release Note

The reason and message for crashing pods are now propagated to the revision to ease debuggability.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.


const (
userContainerName = "user-container"
UserContainerName = "user-container"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported const UserContainerName should have comment (or a comment on this block) or be unexported. More info.

revCondSet.Manage(rs).MarkTrue(RevisionConditionContainerHealthy)
}

func (rs *RevisionStatus) MarkContainerExiting(exitCode int32, message string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported method RevisionStatus.MarkContainerExiting should have comment or be unexported. More info.

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

@mattmoor could you give this a quick glance on whether the approach is suitable? I tried to guard the API call as good as possible. I wouldn't want the controller to have an informer for pods as that could have very high churn, so the if clause here should only match if something is indeed going wrong (or is in a very early stage of the revision, where it shouldn't harm either).

@mattmoor

Copy link
Copy Markdown
Contributor

@markusthoemmes What does the Service report for your example?

Generally I don't have anything against the approach (still drinking my coffee). The main thing I'd like to make sure is that this can be covered by a reliable conformance test.

We should also make sure that this is covered in errors.md

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

@mattmoor it's already covered in errors.md (which was my inspiration to actually attack it). Conformance test is on the way of being implemented.

The revision in my example reports:

    Reason:                ExitCode5
    Severity:              Error
    Status:                False
    Type:                  ContainerHealthy
    Last Transition Time:  2018-12-17T14:12:15Z
    Message:               Container failed with: 2018/12/17 14:11:47 Hello world app started.
2018/12/17 14:11:47 Or not?

@markusthoemmes markusthoemmes changed the title [WIP] Propagate termination message of a failing pod to the revi… Propagate termination message of a failing pod to the revision. Dec 17, 2018
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 17, 2018
@markusthoemmes

Copy link
Copy Markdown
Contributor Author

/test pull-knative-serving-unit-tests

The usual GlobalRouteSync flake.

Comment thread test/e2e/errorcondition_test.go Resolved
@markusthoemmes

Copy link
Copy Markdown
Contributor Author

/test pull-knative-serving-integration-tests

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

Non-evicted pods twice in a row. Wondering if it's related 🤔

/test pull-knative-serving-integration-tests

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

@mattmoor all your comments have been addressed. I'll need to figure out why the autoscaling test seems keeps failing with non-evicted pods though 🤔

/test pull-knative-serving-integration-tests

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

Trying again to see if Prow was just acting up yesterday:

/test pull-knative-serving-integration-tests

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

GlobalSync flake...

/test pull-knative-serving-unit-tests

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

@mattmoor this is finally done from my end. I had to adjust the Autoscale test to only look for non-evicted pods of its own deployment, because the conformance tests kept the list of pods at non-zero causing that test to timeout. That race might've been surfaced by the move of the error-condition tests to conformance.

WantUpdates: []clientgotesting.UpdateActionImpl{{
Object: rev("foo", "pod-error",
WithK8sServiceName, WithLogURL, AllUnknownConditions, MarkActive,
MarkContainerExiting(5, "I failed man!")),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was absolutely amazed that the test-framework already accounted for being able to list fake things with a client etc. Great stuff 😁

@mattmoor mattmoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 19, 2018
@markusthoemmes

Copy link
Copy Markdown
Contributor Author

Oh great, it never failed in that test before...

/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 19, 2018
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 19, 2018
@markusthoemmes

markusthoemmes commented Dec 19, 2018 •

Copy link
Copy Markdown
Contributor Author

I think I have a race going on here between the reconcileDeployment and the reconcileService setting the overall condition to ready. I'll try to loosen these up.

This was not the case.

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

@mattmoor I think I discovered and fixed the race. It was due to the lack of a readiness probe. The container was intermittently "Ready", thus an endpoint was marked available and thus the Revision was considered ready for a brief amount of time.

Plumbing in a readinessProbe should fix that condition.

/hold cancel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 21, 2018
@knative-metrics-robot

Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/serving/v1alpha1/revision_types.go 91.7% 87.3% -4.4
pkg/reconciler/v1alpha1/revision/reconcile_resources.go 88.0% 88.2% 0.2

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

Intermittent unit test failure. Surely unrelated. Logged an issue #2774.

/test pull-knative-serving-unit-tests

@mattmoor mattmoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 21, 2018
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markusthoemmes, mattmoor

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@markusthoemmes

Copy link
Copy Markdown
Contributor Author

/test pull-knative-serving-upgrade-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants