Skip to content

Don't update condition if status stays False/Unknown for custom plugin #320

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

Merged
merged 2 commits into from
Aug 8, 2019

Conversation

wangzhen127
Copy link
Member

@wangzhen127 wangzhen127 commented Jul 30, 2019

Fixes #202

When condition status stays True, we can update condition if reason or message changes. But when condition status stays False/Unknown, we should just ignore and do not update condition.

Here is the example:

  1. NPD starts up, custom condition is set to False and reason is set to default reason.
  2. When custom plugin runs, status stays False, but result.Rule.Reason is always different from the existing reason, which is the default reason set in step 1. In this case, we should just ignore and do not update condition.

Also added some validation to check custom plugin config.
Fixes #306

@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 Jul 30, 2019
@wangzhen127
Copy link
Member Author

/assign @Random-Liu
/assign @andyxning
/cc @xueweiz

@k8s-ci-robot
Copy link
Contributor

@wangzhen127: GitHub didn't allow me to request PR reviews from the following users: xueweiz.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/assign @Random-Liu
/assign @andyxning
/cc @xueweiz

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 wangzhen127 changed the title Do not update condition when status stays False/Unknown for custom plugin Don't update condition if status stays False/Unknown for custom plugin Jul 30, 2019
@grosser
Copy link
Contributor

grosser commented Jul 30, 2019

logic looks correct to me, I have the feeling there is a more logical ordering for the if/else, like first going over all the status == True / != True, but should work either way 👍

@grosser
Copy link
Contributor

grosser commented Jul 30, 2019

might be better to turn the new validation into it's own PR so that it can be merged more quickly (also needs a test ?)

@wangzhen127 wangzhen127 force-pushed the custom-plugin-fix branch 3 times, most recently from c65194c to b5b61e4 Compare August 2, 2019 06:36
@grosser
Copy link
Contributor

grosser commented Aug 2, 2019 via email

@wangzhen127
Copy link
Member Author

/retest

@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 Aug 7, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

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
5 participants