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

vpa-updater: Log the Pod namespace when evicting a Pod #6903

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

ialidzhikov
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Currently vpa logs for eviction look like:

I0607 09:56:37.171710       1 updater.go:220] evicting pod etcd-main-2
I0607 09:57:37.177733       1 updater.go:220] evicting pod etcd-main-0
I0607 09:58:37.059142       1 updater.go:220] evicting pod etcd-main-1
I0607 09:59:37.225718       1 updater.go:220] evicting pod etcd-events-2
I0607 10:00:37.083830       1 updater.go:220] evicting pod etcd-events-1

It is not possible to deduce which is the namespace of these Pods because it is simply not logged. We have hundreds of namespaces deploying StatefulSet Pods which at the end have the same name.

This PR logs the namespace as well so that log readers can locate the affected Pods unambiguously.

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

N/A

Does this PR introduce a user-facing change?

vpa-updater logging is now improved. In many cases it now logs the objects' namespaces as well.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. 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 Jun 7, 2024
@ialidzhikov
Copy link
Contributor Author

/cc @kwiesmueller

@voelzmo
Copy link
Contributor

voelzmo commented Jun 10, 2024

/lgtm

confirmed that the new logs have the format namespace/name just as expected:

I0610 11:52:26.075626       1 updater.go:220] evicting pod default/hamster-c6967774f-54nzv
I0610 11:53:26.075706       1 updater.go:220] evicting pod default/hamster-c6967774f-srjrd

Great use of klog.KObj there, I learned something new!

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

@kwiesmueller kwiesmueller left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ialidzhikov, kwiesmueller

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 Jun 21, 2024
@k8s-ci-robot k8s-ci-robot merged commit b9b8ab0 into kubernetes:master Jun 21, 2024
7 checks passed
@ialidzhikov ialidzhikov deleted the enh/pod-logging branch June 23, 2024 14:24
@ialidzhikov
Copy link
Contributor Author

/cherry-pick vpa-release-1.1

@k8s-infra-cherrypick-robot

@ialidzhikov: #6903 failed to apply on top of branch "vpa-release-1.1":

Applying: vpa-updater: Log the Pod namespace when evicting a Pod
Using index info to reconstruct a base tree...
M	vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
Falling back to patching base and 3-way merge...
Auto-merging vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
CONFLICT (content): Merge conflict in vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 vpa-updater: Log the Pod namespace when evicting a Pod
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick vpa-release-1.1

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 added a commit that referenced this pull request Jun 27, 2024
…903-origin-vpa-release-1.1

[vpa-release-1.1] Automated cherry pick of #6903: vpa-updater: Log the Pod namespace when evicting a Pod
@raywainman raywainman mentioned this pull request Aug 6, 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. area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. 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.

5 participants