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

Migrated scheduler files server.go, node_label.go, csi.go, non_csi.go to structured logging #105855

Merged
merged 6 commits into from Oct 26, 2021

Conversation

shiva1333
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Migrate cmd/kube-scheduler/app/server.go, pkg/scheduler/framework/plugins/nodelabel/node_label.go, pkg/scheduler/framework/plugins/nodevolumelimits/csi.go, pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go to structured logging

Which issue(s) this PR fixes:

Ref #105841

Special notes for your reviewer:

Added missing migration points, fixed previously migrated logs

Does this PR introduce a user-facing change?

Migrated `cmd/kube-scheduler/app/server.go`, `pkg/scheduler/framework/plugins/nodelabel/node_label.go`, `pkg/scheduler/framework/plugins/nodevolumelimits/csi.go`, `pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go` to structured logging

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


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 23, 2021
@k8s-ci-robot
Copy link
Contributor

@shivanshu1333: 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 do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. 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 Oct 23, 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 Oct 23, 2021
@shiva1333
Copy link
Contributor Author

/wg structured-logging
/area logging
/priority important-soon
/kind cleanup
/cc @kubernetes/wg-structured-logging-reviews

@k8s-ci-robot k8s-ci-robot added wg/structured-logging Categorizes an issue or PR as relevant to WG Structured Logging. area/logging priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 23, 2021
@shiva1333
Copy link
Contributor Author

/cc @serathius

@shiva1333
Copy link
Contributor Author

using label to squash
/label tide/merge-method-squash
/sig instrumentation

@k8s-ci-robot k8s-ci-robot added sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. labels Oct 23, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 26, 2021
@serathius
Copy link
Contributor

/lgtm
/assign @alculquicondor

Copy link
Contributor

@damemi damemi left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 26, 2021
@@ -96,7 +96,7 @@ func (pl *CSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod *v
csiNode, err := pl.csiNodeLister.Get(node.Name)
if err != nil {
// TODO: return the error once CSINode is created by default (2 releases)
Copy link
Member

Choose a reason for hiding this comment

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

@cofyc @msau42 can we do this TODO now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

happy to help here :)

@@ -188,7 +188,7 @@ func (pl *CSILimits) filterAttachableVolumes(
}
// If the PVC is invalid, we don't count the volume because
// there's no guarantee that it belongs to the running predicate.
klog.V(5).InfoS("Unable to look up PVC info", "PVC", fmt.Sprintf("%s/%s", pod.Namespace, pvcName))
klog.V(5).InfoS("Unable to look up PVC info", "pod", klog.KObj(pod), "PVC", klog.KRef(pod.Namespace, pvcName))
Copy link
Member

Choose a reason for hiding this comment

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

Can you check which key we are using in other parts of the source code? Is it PVC or pvc or the long name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PVC is being used as a key in this file and other files as well, also in other migration PRs, these are the most commonly used keys (eg. PV, PVC).

return "", ""
}

storageClass, err := pl.scLister.Get(scName)
if err != nil {
klog.V(5).InfoS("Could not get StorageClass for PVC", "PVC", fmt.Sprintf("%s/%s", namespace, pvcName), "err", err)
klog.V(5).InfoS("Could not get StorageClass for PVC", "storageClass", klog.KObj(storageClass), "PVC", klog.KObj(pvc), "err", err)
Copy link
Member

Choose a reason for hiding this comment

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

isn't storageClass nil in this case? you have to build the klog.KRef. Also check if storageClass is the keyword we are using in other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, adding storage class here is wrong, thanks for pointing it out, fixed it.
Also, we don't need to add anything else as "PVC", fmt.Sprintf("%s/%s", namespace, pvcName) is being replaced by "PVC", klog.KObj(pvc).

@@ -178,7 +178,7 @@ func newNonCSILimits(
filter = cinderVolumeFilter
volumeLimitKey = v1.ResourceName(volumeutil.CinderVolumeLimitKey)
default:
klog.ErrorS(errors.New("wrong filterName"), "Cannot create nonCSILimits plugin", "candidates", fmt.Sprintf("%v %v %v %v", ebsVolumeFilterType, gcePDVolumeFilterType, azureDiskVolumeFilterType, cinderVolumeFilterType))
klog.ErrorS(errors.New("wrong filterName"), "Cannot create nonCSILimits plugin", "ebsVolumeFilterType", ebsVolumeFilterType, "gcePDVolumeFilterType", gcePDVolumeFilterType, "azureDiskVolumeFilterType", azureDiskVolumeFilterType, "cinderVolumeFilterType", cinderVolumeFilterType)
Copy link
Member

Choose a reason for hiding this comment

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

Listing the types like this is useless. It should be

"candidates", []string{....}

But I'm also fine with not stating them at all. After all, this line is probably unreachable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, in that case just logging the error and messages

} else if parsedMaxVols <= 0 {
klog.Error("Maximum PD volumes must be a positive value, using default")
klog.ErrorS(nil, "Maximum PD volumes must be a positive value, using default")
Copy link
Member

Choose a reason for hiding this comment

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

let's create an error for "maximum PD volumes is negative", and use the common message "Unable to parse maximum PD volumes value, using default"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure :)

@damemi
Copy link
Contributor

damemi commented Oct 26, 2021

/approve cancel
sorry @alculquicondor didn't see your comments

@k8s-ci-robot k8s-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 26, 2021
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 26, 2021
@alculquicondor
Copy link
Member

/approve

please squash

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, sanposhiho, shivanshu1333

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 Oct 26, 2021
@shiva1333
Copy link
Contributor Author

using label to squash
/label tide/merge-method-squash

@shiva1333
Copy link
Contributor Author

shiva1333 commented Oct 26, 2021

@alculquicondor lgtm removed due to new commits, do you mind adding it?

@alculquicondor
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 26, 2021
@k8s-ci-robot k8s-ci-robot merged commit 3c87c43 into kubernetes:master Oct 26, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Oct 26, 2021
@shiva1333 shiva1333 moved this from Inbox to Waiting on Reviewer in WG Structured Logging - 1.23 Migration Oct 27, 2021
@shiva1333 shiva1333 moved this from Waiting on Reviewer to Done in WG Structured Logging - 1.23 Migration Oct 28, 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/logging 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-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. wg/structured-logging Categorizes an issue or PR as relevant to WG Structured Logging.
Development

Successfully merging this pull request may close these issues.

None yet

7 participants