refactor: use AddEventHandlerWithOptions in cronjob and certificates by ogulcanaydogan · Pull Request #139641 · kubernetes/kubernetes · GitHub
Skip to content

refactor: use AddEventHandlerWithOptions in cronjob and certificates#139641

Open
ogulcanaydogan wants to merge 1 commit into
kubernetes:masterfrom
ogulcanaydogan:feat/cronjob-certificates-contextual-logging
Open

refactor: use AddEventHandlerWithOptions in cronjob and certificates#139641
ogulcanaydogan wants to merge 1 commit into
kubernetes:masterfrom
ogulcanaydogan:feat/cronjob-certificates-contextual-logging

Conversation

@ogulcanaydogan

Copy link
Copy Markdown

Migrate plain AddEventHandler calls in pkg/controller/cronjob and pkg/controller/certificates to AddEventHandlerWithOptions with cache.HandlerOptions{Logger: &logger}, so the contextual logger is propagated into the informer handler goroutines.

The logger is already in scope at each call site (klog.FromContext(ctx)) so this is a pure API migration with no behaviour change.

Files changed (2):

  • pkg/controller/cronjob/cronjob_controllerv2.go (2 call sites)
  • pkg/controller/certificates/certificate_controller.go (1 call site)

Fixes: #126379

NONE

Migrate plain AddEventHandler calls in the cronjob and certificate
signing request controllers to AddEventHandlerWithOptions with
cache.HandlerOptions{Logger: &logger} so the contextual logger is
propagated into the informer handler goroutines.

The logger is already in scope at each call site (klog.FromContext(ctx))
so this is a pure API migration with no behaviour change.

Fixes: kubernetes#126379
Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 11, 2026
@ogulcanaydogan

Copy link
Copy Markdown
Author

@k8s-ci-robot k8s-ci-robot added the do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. label Jun 11, 2026
@ogulcanaydogan

Copy link
Copy Markdown
Author

/sig apps

@k8s-ci-robot k8s-ci-robot added the do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jun 11, 2026
@ogulcanaydogan

Copy link
Copy Markdown
Author

/sig auth

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 11, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @ogulcanaydogan. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Details

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-sigs/prow repository.

@ogulcanaydogan

Copy link
Copy Markdown
Author

/release-note-none

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Jun 11, 2026
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jun 11, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in SIG Apps Jun 11, 2026
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 11, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

@enj enj moved this to Needs Triage in SIG Auth Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

Status: Needs Triage
Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

add and use alternative APIs which support contextual logging

4 participants