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

🐛 Inject kcp-start-informers logger into correct hook context #3134

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

embik
Copy link
Member

@embik embik commented May 16, 2024

Summary

I've observed log lines like the one below for quite a while:

{"ts":1715849616335.2378,"caller":"replication/replication_reconcile.go:200","msg":"Updating object in global cache","component":"kcp","postStartHook":"kcp-start-informers","postStartHook":"kcp-start-controllers","reconciler":"kcp-replication-controller","key":"v1.clusterroles.rbac.authorization.k8s.io::root|system:kcp:universal-workspacetype-use","reconcilerKey":"root|system:kcp:universal-workspacetype-use","kind":"ClusterRole","namespace":"","name":"system:kcp:universal-workspacetype-use","v":2}

Note the double entry "postStartHook":"kcp-start-informers","postStartHook":"kcp-start-controllers".

Turns out that in the kcp-start-informers post start hook the logger gets injected into ctx. That's however not the context of the hook, it's the main context used by the whole (s *Server) Run method! This PR creates a new hookCtx that is explicitly instantiated within the hook and is subsequently passed to all informers and the server bootstrap code.

Note this is relatively low priority and I don't want it to block #3132.

Related issue(s)

Fixes #

Release Notes

Fix `postStartHook` being present two times on log lines

@kcp-ci-bot kcp-ci-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the DCO. labels May 16, 2024
@kcp-ci-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kcp-ci-bot kcp-ci-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 16, 2024
@embik embik marked this pull request as ready for review June 3, 2024 06:45
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 3, 2024
@embik
Copy link
Member Author

embik commented Jun 4, 2024

/cc @mjudeikis @xrstf

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jun 4, 2024
Copy link
Contributor

@xrstf xrstf left a comment

Choose a reason for hiding this comment

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

/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 4, 2024
@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 905c156049115f6b32ecd76717bb1179533b238c

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xrstf

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

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2024
@kcp-ci-bot kcp-ci-bot merged commit 5299c30 into kcp-dev:main Jun 4, 2024
18 checks passed
@embik embik deleted the cleanup-informers-hook-context branch June 4, 2024 07:39
@embik
Copy link
Member Author

embik commented Aug 27, 2024

/kind bug

@kcp-ci-bot kcp-ci-bot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 27, 2024
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. dco-signoff: yes Indicates the PR's author has signed the DCO. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants