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 kind/feature size/L sig/instrumentation sig/node cncf-cla: yes needs-triage needs-priority 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

@serathius serathius Mar 9, 2021

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

@knabben knabben Mar 9, 2021

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

@serathius serathius Mar 9, 2021

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

@knabben knabben Mar 14, 2021

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 label Mar 11, 2021
Copy link
Member

@kikisdeliveryservice kikisdeliveryservice left a comment

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 Mar 12, 2021
Copy link
Member

@ehashman ehashman left a comment

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

@ehashman ehashman commented Mar 12, 2021

(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 knabben commented Mar 13, 2021

/retest

@knabben
Copy link
Member Author

@knabben knabben commented Mar 13, 2021

/test pull-kubernetes-unit

Copy link
Member

@kikisdeliveryservice kikisdeliveryservice left a comment

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 knabben commented Mar 14, 2021

/retest

@kikisdeliveryservice kikisdeliveryservice dismissed their stale review Mar 14, 2021

updated as requested :)

@kikisdeliveryservice
Copy link
Member

@kikisdeliveryservice kikisdeliveryservice commented Mar 14, 2021

Awesome job @knabben !

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm 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

@k8s-ci-robot k8s-ci-robot commented Mar 15, 2021

[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 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
14 checks passed
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 and removed release-note labels Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/kubelet cncf-cla: yes kind/feature lgtm priority/important-soon release-note-none sig/instrumentation sig/node size/L triage/accepted
Development

Successfully merging this pull request may close these issues.

None yet

9 participants