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

Don't log Fatal when handling events in the eventlistener #810

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

bigkevmcd
Copy link
Member

Changes

Don't log with Fatal when we can't fetch resources.

For this case, Fatalf causes the process to exit, and so the container cycles.

Fixes: #809

I had a look through the other cases where we're using Fatalf on the logger, and they all look like non-user error cases

It's not clear whether or not these should also be fixed for example this pattern is used twice:

https://github.com/tektoncd/triggers/blob/master/pkg/client/injection/reconciler/triggers/v1alpha1/eventlistener/controller.go#L55

This issue also doesn't look like a user could trigger it:

https://github.com/tektoncd/triggers/blob/master/pkg/client/injection/reconciler/triggers/v1alpha1/eventlistener/reconciler.go#L134

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

Previously, if the EventListener object could not be loaded by the eventlistener process when handling an event, the error logging caused the container to cycle, it should now be logged nomally.

…event.

For this case, Fatalf causes the process to exit, and so the container cycles.

This also adds a little bit of testing for this functionality, and to do so
brings in a slightly newer version of the zap logging package.
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Oct 22, 2020
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 22, 2020
@dibyom
Copy link
Member

dibyom commented Oct 22, 2020

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 22, 2020
@@ -87,7 +90,7 @@ func getSinkAssets(t *testing.T, resources test.Resources, elName string, auth A
clients := test.SeedResources(t, ctx, resources)
test.AddTektonResources(clients.Kube)

logger, _ := zap.NewProduction()
logger := zaptest.NewLogger(t)
Copy link
Member

Choose a reason for hiding this comment

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

nice!

@dibyom
Copy link
Member

dibyom commented Oct 22, 2020

Thanks for the fix and adding the test! @bigkevmcd

The other two places where we use log.Fatalf should be fine. They are generated code, and they basically fail to start the reconciler if the config is incorrect. I think that is ok.

@dibyom
Copy link
Member

dibyom commented Oct 22, 2020

/approve
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 22, 2020
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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

The pull request process is described here

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 22, 2020
@tekton-robot tekton-robot merged commit d250116 into tektoncd:master Oct 22, 2020
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
3 participants