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

Do not import plugins unnecessarily. #293

Merged

Conversation

Random-Liu
Copy link
Member

@Random-Liu Random-Liu commented Jun 14, 2019

Follow up for #275.

This PR:

  1. Get rid of unnecessary plugin imports in cmd/options/options.go;
  2. Make NPD panic if deprecated flags are specified, but the corresponding plugin is not registered.

/cc @xueweiz

Signed-off-by: Lantao Liu [email protected]

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 14, 2019
@Random-Liu Random-Liu force-pushed the do-not-import-plugins-unnecessarily branch from 6c36d7d to ff09322 Compare June 14, 2019 00:37
name: "using deprecated options when SystemLogMonitor is not registered",
orig: NodeProblemDetectorOptions{
SystemLogMonitorConfigPaths: []string{"config-a"},
MonitorConfigPaths: types.ProblemDaemonConfigPathMap{},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: probably change to:

types.ProblemDaemonConfigPathMap{
    customPluginMonitorName: &[]string{},
}

And similar for below test case,

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh just realized that github does not highlight the selected code.
So to clarify:
I think we should change MonitorConfigPaths: types.ProblemDaemonConfigPathMap{}, into

MonitorConfigPaths: types.ProblemDaemonConfigPathMap{
    customPluginMonitorName: &[]string{},
},

Copy link
Member Author

@Random-Liu Random-Liu Jun 14, 2019

Choose a reason for hiding this comment

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

Not needed, because we are not using custom plugin monitor deprecated flag, it is fine to not register that plugin. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

How about this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@Random-Liu Random-Liu force-pushed the do-not-import-plugins-unnecessarily branch from ff09322 to f2d17ee Compare June 14, 2019 00:57
@Random-Liu
Copy link
Member Author

Sent another commit to fix the build. go build cmd/node_problem_detector.go won't include plugins.go in the output binary.

@xueweiz
Copy link
Contributor

xueweiz commented Jun 14, 2019

Sorry for the test failure. It is caused by my bug in #275
Seems the imports in package main are ignored.

Copy link
Contributor

@xueweiz xueweiz left a comment

Choose a reason for hiding this comment

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

/lgtm
Thanks for the change and the fix :P

name: "using deprecated options when SystemLogMonitor is not registered",
orig: NodeProblemDetectorOptions{
SystemLogMonitorConfigPaths: []string{"config-a"},
MonitorConfigPaths: types.ProblemDaemonConfigPathMap{},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@k8s-ci-robot
Copy link
Contributor

@xueweiz: changing LGTM is restricted to assignees, and only kubernetes/node-problem-detector repo collaborators may be assigned issues.

In response to this:

/lgtm
Thanks for the change and the fix :P

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.

@wangzhen127
Copy link
Member

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Random-Liu, wangzhen127, xueweiz

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:
  • OWNERS [Random-Liu,wangzhen127]

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 merged commit e10e6cc into kubernetes:master Jun 14, 2019
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants