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

enable codnition updaet when message change for custom plugin #238

Conversation

andyxning
Copy link
Member

Fix #200

This PR adds a custom global config to control whether NPD should update condition status when message changes.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. 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. labels Dec 10, 2018
@andyxning
Copy link
Member Author

/cc @wangzhen127 @Random-Liu

@andyxning andyxning force-pushed the enable_condition_update_when_message_change_for_custom_plugin branch from c6c7124 to 775441d Compare December 10, 2018 05:27
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 10, 2018
@@ -176,7 +176,7 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat

condition.Status = status
condition.Reason = result.Rule.Reason
} else if condition.Status == status && condition.Reason != result.Rule.Reason {
} else if condition.Status == status && (condition.Reason != result.Rule.Reason || (*c.config.PluginGlobalConfig.EnableMessageChangeBasedConditionUpdate && condition.Message != result.Message)) {
Copy link
Member

Choose a reason for hiding this comment

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

The comment on line 180 needs update.

Can you also update the custom plugin readme to include this new option?

Copy link
Member Author

Choose a reason for hiding this comment

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

@wangzhen127 Thanks for the tips. Will do.

Copy link
Member Author

Choose a reason for hiding this comment

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

@wangzhen127 Done. PTAL.

Copy link
Member

Choose a reason for hiding this comment

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

This line is way too long... can we break it into 2 lines at some point?

@andyxning andyxning force-pushed the enable_condition_update_when_message_change_for_custom_plugin branch from 775441d to 840ba05 Compare December 11, 2018 01:58
Copy link
Member

@Random-Liu Random-Liu left a comment

Choose a reason for hiding this comment

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

LGTM with a nit

@@ -176,7 +176,7 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat

condition.Status = status
condition.Reason = result.Rule.Reason
} else if condition.Status == status && condition.Reason != result.Rule.Reason {
} else if condition.Status == status && (condition.Reason != result.Rule.Reason || (*c.config.PluginGlobalConfig.EnableMessageChangeBasedConditionUpdate && condition.Message != result.Message)) {
Copy link
Member

Choose a reason for hiding this comment

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

This line is way too long... can we break it into 2 lines at some point?

@andyxning andyxning force-pushed the enable_condition_update_when_message_change_for_custom_plugin branch from 840ba05 to 33dffe0 Compare December 11, 2018 05:15
@andyxning
Copy link
Member Author

@Random-Liu Done. PTAL.

@Random-Liu
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 Dec 11, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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,andyxning]

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 c9d7f92 into kubernetes:master Dec 11, 2018
@andyxning andyxning deleted the enable_condition_update_when_message_change_for_custom_plugin branch December 12, 2018 02:24
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