-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix parsing --drain-priority-config #8219
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
Conversation
The --drain-priority-config flag was only parsed if isFlagPassed() returned true for it. However, isFlagPassed() would actually silently never work. The implementation relied on walking the flags parsed by the standard Go "flag" pkg. This seems like it would work since CA defines its flags using the standard "flag" pkg. However, the flags are then actually parsed and processed by the "github.com/spf13/pflag" pkg, so isFlagPassed() could never see them. This commit replaces removes isFlagPassed() and replaces the calls with a pkg-provided pflag.CommandLine.Changed(). Unit tests are added to verify that the flag is correctly parsed after this change.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jackfrancis, towca 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 |
/cherry-pick cluster-autoscaler-release-1.30 |
@jackfrancis: #8219 failed to apply on top of branch "cluster-autoscaler-release-1.30":
In response to this:
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-sigs/prow repository. |
/cherry-pick cluster-autoscaler-release-1.31 |
/cherry-pick cluster-autoscaler-release-1.32 |
/cherry-pick cluster-autoscaler-release-1.33 |
@jackfrancis: #8219 failed to apply on top of branch "cluster-autoscaler-release-1.31":
In response to this:
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-sigs/prow repository. |
@jackfrancis: #8219 failed to apply on top of branch "cluster-autoscaler-release-1.32":
In response to this:
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-sigs/prow repository. |
@jackfrancis: new pull request could not be created: failed to create pull request against kubernetes/autoscaler#cluster-autoscaler-release-1.33 from head k8s-infra-cherrypick-robot:cherry-pick-8219-to-cluster-autoscaler-release-1.33: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between kubernetes:cluster-autoscaler-release-1.33 and k8s-infra-cherrypick-robot:cherry-pick-8219-to-cluster-autoscaler-release-1.33"}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"} In response to this:
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-sigs/prow repository. |
@jackfrancis The cherry-picks don't apply cleanly because the logic was moved from |
What type of PR is this?
/kind bug
What this PR does / why we need it:
The
--drain-priority-config
flag was only parsed ifisFlagPassed()
returnedtrue
for it. However,isFlagPassed()
would actually silently never work. The implementation relied on walking the flags parsed by the standard Go "flag" pkg. This seems like it would work since CA defines its flags using the standard "flag" pkg. However, the flags are then actually parsed and processed by the "github.com/spf13/pflag" pkg, soisFlagPassed()
could never see them.This commit removes
isFlagPassed()
and replaces the calls with a pkg-providedpflag.CommandLine.Changed()
. Unit tests are added to verify that the flag is correctly parsed after this change.Which issue(s) this PR fixes:
Fixes #7851
Does this PR introduce a user-facing change?