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

🌱 Log controller name in predicates #10959

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

Karthik-K-N
Copy link
Contributor

@Karthik-K-N Karthik-K-N commented Jul 30, 2024

What this PR does / why we need it:
This PR tries to improve the logging of predicate to include more key value pairs.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Part of #10818

/area logging

@k8s-ci-robot k8s-ci-robot added the area/logging Issues or PRs related to logging label Jul 30, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 30, 2024
@Karthik-K-N
Copy link
Contributor Author

@sbueringer regarding the kind value being empty I see multiple issues regarding Typemeta being empty kubernetes-sigs/controller-runtime#1735 and needs an upstream fix.

Meanwhile I think we can fetch the GVK with help of client like client.GroupVersionKindFor(obj), But which might require predicate signature change or creating a new predicate. Should I do that?

Could you please help me If any other better way of fetching find GVK or making object contain GVK.

@sbueringer
Copy link
Member

@Karthik-K-N I'll look into, but I'll need some time

@sbueringer sbueringer mentioned this pull request Sep 3, 2024
2 tasks
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 9, 2024
@Karthik-K-N
Copy link
Contributor Author

@sbueringer I thought of using predicate_controller as the key for logging controller name, Please suggest better name if you have it in mind. Also I tried to add it across all the controllers.

@sbueringer
Copy link
Member

sbueringer commented Sep 9, 2024

@sbueringer I thought of using predicate_controller as the key for logging controller name, Please suggest better name if you have it in mind. Also I tried to add it across all the controllers.

I would use "controller". This should intentionally match up with the controller key/value pair of other code of the same controller (which controller-runtime does for us for everything that gets a logger out of the context passed into Reconcile(ctx context, req Request))

@Karthik-K-N
Copy link
Contributor Author

Karthik-K-N commented Sep 10, 2024

@sbueringer I thought of using predicate_controller as the key for logging controller name, Please suggest better name if you have it in mind. Also I tried to add it across all the controllers.

I would use "controller". This should intentionally match up with the controller key/value pair of other code of the same controller (which controller-runtime does for us for everything that gets a logger out of the context passed into Reconcile(ctx context, req Request))

I got your point and made the changes to use controller as the key, Earlier my intention was to uniquely identify predicate logs using that key.
Please take a look when you get some time and let me know if any further changes are required.

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Thx, two nits

@sbueringer
Copy link
Member

Thank you!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 11, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 893b1af962ca8d1e89508efdb21e42a3c2ae9b58

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2024
@Karthik-K-N
Copy link
Contributor Author

/retest

@sbueringer
Copy link
Member

sbueringer commented Sep 11, 2024

Changed the PR description to re-trigger the title verifier. We merged a change there which had a bug, but that was fixed just now

@k8s-ci-robot k8s-ci-robot merged commit d4a8f10 into kubernetes-sigs:main Sep 11, 2024
22 of 23 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.9 milestone Sep 11, 2024
@Karthik-K-N Karthik-K-N deleted the predicate-log branch September 12, 2024 09:42
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. area/logging Issues or PRs related to logging cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", 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.

3 participants