-
Notifications
You must be signed in to change notification settings - Fork 254
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
🌱 Add more ctrl options flags #1725
Conversation
/test metal3-bmo-e2e-test-pull |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
main.go
Outdated
Cache: cache.Options{ | ||
ByObject: secretutils.AddSecretSelector(nil), | ||
DefaultNamespaces: watchNamespaces, | ||
}, | ||
} | ||
|
||
if leaseDuration != "" { | ||
dur, err := time.ParseDuration(leaseDuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the defaults, it's tempting to skip the parsing and make the command line argument -lease-duration-seconds
. Nobody is going to want a duration in years or even hours. It could be a float if they really want to get down to the milliseconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have leaseDurationSeconds
, it'll create weird temporaries like:
leaseDurationSecondsDuration := time.Duration(leaseDurationSeconds) * time.Second
ctrlOptions.LeaseDuration = &leaseDurationSecondsDuration
But more annoyingly, we'll have to parse the env vars to int
s. So this tidy line:
flag.StringVar(&renewDeadline, "renew-deadline", os.Getenv("RENEW_DEADLINE"), "Golang duration, e.g. '26s'")
would become something more involved because os.Getenv
returns a string but the default must be a number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'll create weird temporaries
TBH I would take that one extra line of code over complicated user documentation.
we'll have to parse the env vars to ints
flag.IntVar()
is only a convenience. If you wanted to keep it as StringVar
and continue to do the parsing to int/float here yourself I don't think there's anything stopping you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched it to using seconds, left it as a StringVar
and added strconv.ParseInt
.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zaneb 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 |
@honza did you forget to push your local changes? |
Nope. But I did push them to the wrong branch... 😞 |
We add a few command-line flags to the baremetal-operator binary to configure more ctrl.Options{}. Signed-off-by: Honza Pokorny <[email protected]>
/lgtm |
/test metal3-bmo-e2e-test-pull |
We add a few command-line flags to the baremetal-operator binary to configure more
ctrl.Options{}
.