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 pkg/kubelet/cm/devicemanager to structured logging #99976

Merged
merged 1 commit into from Mar 15, 2021

Conversation

knabben
Copy link
Member

@knabben knabben commented Mar 9, 2021

What type of PR is this?

/kind feature
/sig instrumentation
/sig node

What this PR does / why we need it:

Migrate pkg/kubelet/cm/devicemanager to structured logging

Which issue(s) this PR fixes:

Refs #98976

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/node Categorizes an issue or PR as relevant to SIG Node. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 9, 2021
@ehashman ehashman added this to Triage in SIG Node PR Triage Mar 9, 2021
pkg/kubelet/cm/devicemanager/device_plugin_stub.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/endpoint.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/device_plugin_stub.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/device_plugin_stub.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/endpoint.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
@shubheksha shubheksha moved this from Needs Reviewer to Waiting on Author in Structured Logging Migration for Kubelet, 1.21 Mar 9, 2021
@@ -424,13 +424,13 @@ func (m *ManagerImpl) Register(ctx context.Context, r *pluginapi.RegisterRequest
}
if !versionCompatible {
errorString := fmt.Sprintf(errUnsupportedVersion, r.Version, pluginapi.SupportedVersions)
klog.Infof("Bad registration request from device plugin with resource name %q: %s", r.ResourceName, errorString)
klog.InfoS("Bad registration request from device plugin with resource.", "resource", r.ResourceName, "error", errorString)
return &pluginapi.Empty{}, fmt.Errorf(errorString)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's pass the error from fmt.Errorf(errorString) directly to InfoS under err key

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it required for all ocurrences of err on InfoS?

klog.Errorf("Container device %s has conflicting mapping host devices: %s and %s",
dev.ContainerPath, d, dev.HostPath)
klog.ErrorS(nil, "Container device has conflicting mapping host devices.",
"containerPath", dev.ContainerPath, "value1", d, "value2", dev.HostPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"containerPath", dev.ContainerPath, "value1", d, "value2", dev.HostPath)
"path", dev.ContainerPath, "got", d, "expected", dev.HostPath)

Copy link
Member Author

Choose a reason for hiding this comment

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

we are using "containerPath" as a standard on these files

@k8s-ci-robot k8s-ci-robot removed the release-note-none Denotes a PR that doesn't merit a release note. label Mar 11, 2021
Copy link
Member

@kikisdeliveryservice kikisdeliveryservice left a comment

Choose a reason for hiding this comment

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

some comments, also there is inconsistent period use throughout would suggest dropping them all.

this pr is huge, thank you for going through this!

pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/manager.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/endpoint.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/endpoint.go Outdated Show resolved Hide resolved
@knabben knabben force-pushed the sl-devicemanager branch 2 times, most recently from 55b54a0 to 8e66485 Compare March 12, 2021 02:56
Copy link
Member

@ehashman ehashman left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, remaining issue is the trailing periods on log lines.

pkg/kubelet/cm/devicemanager/pod_devices.go Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
@ehashman
Copy link
Member

(note: I didn't comment on all the log lines ending in periods, just a few---please use search to replace)

/milestone v1.21

@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Mar 12, 2021
@knabben
Copy link
Member Author

knabben commented Mar 13, 2021

/retest

@knabben
Copy link
Member Author

knabben commented Mar 13, 2021

/test pull-kubernetes-unit

Copy link
Member

@kikisdeliveryservice kikisdeliveryservice left a comment

Choose a reason for hiding this comment

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

Went through allllllll comments 😆 and found 1 thing below.

Also can you double check these two open comments since there's a difference between the expected and gots between your version and the reviewer:
#99976 (comment)
#99976 (comment)

Thank you so much for this pr @knabben It's a beast 😸

pkg/kubelet/cm/devicemanager/pod_devices.go Outdated Show resolved Hide resolved
@knabben
Copy link
Member Author

knabben commented Mar 14, 2021

/retest

@kikisdeliveryservice kikisdeliveryservice dismissed their stale review March 14, 2021 23:36

updated as requested :)

@kikisdeliveryservice
Copy link
Member

Awesome job @knabben !

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 14, 2021
@kikisdeliveryservice kikisdeliveryservice moved this from Waiting on Author to Needs Approver in Structured Logging Migration for Kubelet, 1.21 Mar 14, 2021
@kikisdeliveryservice kikisdeliveryservice moved this from Waiting on Author to Needs Approver in SIG Node PR Triage Mar 14, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: knabben, mrunalp

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 Mar 15, 2021
@mrunalp mrunalp moved this from Needs Approver to Done in Structured Logging Migration for Kubelet, 1.21 Mar 15, 2021
@k8s-ci-robot k8s-ci-robot merged commit 51ea8de into kubernetes:master Mar 15, 2021
SIG Node PR Triage automation moved this from Needs Approver to Done Mar 15, 2021
@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. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/node Categorizes an issue or PR as relevant to SIG Node. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.

None yet

9 participants