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

migrate generic_scheduler.go and types.go to structured logs #98134

Merged
merged 1 commit into from Jan 26, 2021

Conversation

tanjing2020
Copy link
Contributor

@tanjing2020 tanjing2020 commented Jan 18, 2021

What type of PR is this?

/kind cleanup
What this PR does / why we need it:
Ref:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md

Which issue(s) this PR fixes:

Verify log output (generic_scheduler.go):

before:
generic_scheduler.go:318] Skipping extender &{false pod0 false false} as it returned error not a binder and has ignorable flag set
generic_scheduler.go:376] Plugin NodeAffinity scores on default/test-pod => [{node0 5} {node1 3}]
generic_scheduler.go:414] test-pod_default -> tmp: fakeExtender, Score: (7)
generic_scheduler.go:432] Host tmp => Score 7
after
generic_scheduler.go:318] "Skipping extender as it returned error and has ignorable flag set"  err="not a binder" extender=&{isBinder:false interestedPodName:pod0 ignorable:false gotBind:false}
generic_scheduler.go:375] "Plugin scored node for pod" pod="default/test-pod" plugin="NodeAffinity" node="node0" score=5
generic_scheduler.go:375] "Plugin scored node for pod" pod="default/test-pod" plugin="NodeAffinity" node="node1" score=3
generic_scheduler.go:413] "Extender scored node for pod" pod="default/test-pod" host="tmp" extenders name="fakeExtender" score=7
generic_scheduler.go:431] "Calculated node's final score for pod" pod="default/test-pod" node="tmp" score=7

Verify log output (types.go):

before:
types.go:565] Cannot get pod key, err: Cannot get cache key for pod with empty UID
types.go:594] Cannot get pod key, err: Cannot get cache key for pod with empty UID
after
types.go:565] "Cannot get pod key" err="Cannot get cache key for pod with empty UID"
types.go:594] Cannot get pod key, err: Cannot get cache key for pod with empty UID

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

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

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 18, 2021
@k8s-ci-robot
Copy link
Contributor

@tanjing2020: 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.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 18, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @tanjing2020. 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.

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/test-infra repository.

@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-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jan 18, 2021
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 18, 2021
@tanjing2020 tanjing2020 force-pushed the change-log branch 2 times, most recently from e5bea41 to ec8115c Compare January 18, 2021 08:50
pkg/scheduler/core/generic_scheduler.go Outdated Show resolved Hide resolved
pkg/scheduler/core/generic_scheduler.go Outdated Show resolved Hide resolved
pkg/scheduler/core/generic_scheduler.go Outdated Show resolved Hide resolved
pkg/scheduler/core/generic_scheduler.go Outdated Show resolved Hide resolved
@tanjing2020 tanjing2020 force-pushed the change-log branch 5 times, most recently from 5b752e3 to 6636100 Compare January 19, 2021 02:29
@tanjing2020
Copy link
Contributor Author

tanjing2020 commented Jan 19, 2021

Please check again, thank you.
/recc @alculquicondor

@JornShen
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 19, 2021
Copy link
Member

@chendave chendave left a comment

Choose a reason for hiding this comment

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

please revert all those file permission from 100755 -> 100644

@chendave
Copy link
Member

and please fix bazel dependency issue as well.

@tanjing2020 tanjing2020 force-pushed the change-log branch 2 times, most recently from c70d54a to ce29376 Compare January 21, 2021 03:04
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 21, 2021
@tanjing2020
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jan 21, 2021
@@ -373,7 +371,7 @@ func (g *genericScheduler) prioritizeNodes(

if klog.V(10).Enabled() {
for plugin, nodeScoreList := range scoresMap {
klog.Infof("Plugin %s scores on %v/%v => %v", plugin, pod.Namespace, pod.Name, nodeScoreList)
klog.InfoS("Plugin scored nodes for pod", "pod", klog.KObj(pod), "plugin", plugin, "nodeScoreList", nodeScoreList)
Copy link
Member

Choose a reason for hiding this comment

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

Extend this to a for loop, and have one line for each node, just like we do for extenders.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okey, I fixed it like this:
for _, nodeScore := range nodeScoreList {
klog.InfoS("Plugin scored node for pod", "pod", klog.KObj(pod), "plugin", plugin, "node", nodeScore.Name, "score", nodeScore.Score)
}

@@ -429,7 +427,7 @@ func (g *genericScheduler) prioritizeNodes(

if klog.V(10).Enabled() {
for i := range result {
klog.Infof("Host %s => Score %d", result[i].Name, result[i].Score)
klog.InfoS("Combined (added) all scores together for that node", "node", result[i].Name, "score", result[i].Score)
Copy link
Member

Choose a reason for hiding this comment

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

"Calculated final score for node"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, done.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 22, 2021
@tanjing2020
Copy link
Contributor Author

/retest

@kikisdeliveryservice
Copy link
Member

Linking to open issue: kubernetes/enhancements#1602

Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

/approve

@@ -429,7 +429,7 @@ func (g *genericScheduler) prioritizeNodes(

if klog.V(10).Enabled() {
for i := range result {
klog.Infof("Host %s => Score %d", result[i].Name, result[i].Score)
klog.InfoS("Calculated final score for node", "node", result[i].Name, "score", result[i].Score)
Copy link
Member

Choose a reason for hiding this comment

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

Please add the pod. Sorry I missed this before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, tanjing2020

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 Jan 22, 2021
@tanjing2020
Copy link
Contributor Author

/recc @alculquicondor @chendave

@tanjing2020
Copy link
Contributor Author

/retest

@chendave
Copy link
Member

@alculquicondor 's comments has been addressed.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 26, 2021
@tanjing2020
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-ubuntu-containerd

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

2 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@@ -562,7 +562,7 @@ func removeFromSlice(s []*PodInfo, k string) []*PodInfo {
for i := range s {
k2, err := GetPodKey(s[i].Pod)
if err != nil {
klog.Errorf("Cannot get pod key, err: %v", err)
klog.ErrorS(err, "Cannot get pod key")
Copy link
Member

Choose a reason for hiding this comment

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

Add pod here and below

@k8s-ci-robot k8s-ci-robot merged commit 35871e4 into kubernetes:master Jan 26, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 26, 2021
@chendave
Copy link
Member

@tanjing2020 please submit a following up PR to address @alculquicondor 's comments, thanks!

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Mar 29, 2021
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants