Skip to content

✨ Improve logging for dynamic type kind source#3494

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
erikgb:improve-kind-source-logging
Apr 5, 2026
Merged

✨ Improve logging for dynamic type kind source#3494
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
erikgb:improve-kind-source-logging

Conversation

@erikgb
Copy link
Copy Markdown
Member

@erikgb erikgb commented Apr 5, 2026

This PR improves the logging when using a dynamic type (Unstructured and PartialObjectMetadata) with a kind source. Including information about the underlying type (kind) should make it easier to reason about what's going on. Implementation as suggested in #3493 (comment).

Was a bit in doubt about only logging the kind or the full GVK. I landed on the just the kind, but please let me know if you want me to change this.

Fixes #3493

@k8s-ci-robot k8s-ci-robot requested review from inteon and vincepri April 5, 2026 09:52
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 5, 2026
Comment thread pkg/internal/source/kind.go Outdated
switch v := any(ks.Type).(type) {
case *unstructured.Unstructured, *metav1.PartialObjectMetadata:
gvk := v.(client.Object).GetObjectKind().GroupVersionKind()
return fmt.Sprintf("kind source: %T[%s]", v, gvk.Kind)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know if just the kind is always enough, could we also add the GV?

Copy link
Copy Markdown
Member Author

@erikgb erikgb Apr 5, 2026

Choose a reason for hiding this comment

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

Sure! Which string format do you prefer? I have just committed my suggestion. 😸

@erikgb erikgb force-pushed the improve-kind-source-logging branch from 3b4164b to 6f89e1d Compare April 5, 2026 13:52
Copy link
Copy Markdown
Member

@alvaroaleman alvaroaleman left a comment

Choose a reason for hiding this comment

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

That looks good, thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 5, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 74555158d0867e84ca634b2b692f750ea97a8a2e

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, erikgb

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 5, 2026
@k8s-ci-robot k8s-ci-robot merged commit 6210f84 into kubernetes-sigs:main Apr 5, 2026
7 checks passed
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. 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/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.

Improve logging when using PartialObjectMetadata

3 participants