-
Notifications
You must be signed in to change notification settings - Fork 48
Handle invalid ValidityDuration user input #253
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
685ced1 to
119b232
Compare
|
cc @neolit123 |
783c3dc to
e6346e5
Compare
|
/test pull-etcd-operator-test-e2e |
internal/controller/utils.go
Outdated
| // Set default duration to 365 days for auto provider if not provided | ||
| var duration time.Duration | ||
| if autoConfig.ValidityDuration == "" { | ||
| duration = certInterface.DefaultAutoValidity | ||
| } else { | ||
| var err error | ||
| duration, err = time.ParseDuration(autoConfig.ValidityDuration) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to parse ValidityDuration: %w", err) | ||
| } |
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.
Please add a function something like below, and reuse it for both createCMCertificateConfig and createAutoCertificateConfig
func parseValidityDuration(customizedDuration string, defaultDuration time.Duration) (time.Duration, error)
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.
Sure, updated the PR.
ivanvc
left a comment
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.
Thanks for the pull request, Arka. Other than Benjamin's comment and one observation I left, this looks great :)
This commit will handle a scenario of invalid cert-manager ValidityDuration user input and throw an error. In case, ValidityDuration is not defined by user it will default to 90days for cert-manager Signed-off-by: ArkaSaha30 <[email protected]>
e6346e5 to
4adafe5
Compare
This commit will handle a scenario of invalid auto cert provider ValidityDuration user input and throw an error. In case, ValidityDuration is not defined by user it will default to 365days for auto cert provider Signed-off-by: ArkaSaha30 <[email protected]>
4adafe5 to
4d9d86c
Compare
Signed-off-by: ArkaSaha30 <[email protected]>
|
@ArkaSaha30: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions 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. I understand the commands that are listed here. |
ivanvc
left a comment
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.
LGTM. Thanks, Arka.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahrtr, ArkaSaha30, ivanvc The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR will handle a scenario of invalid
ValidityDurationuser input for the following certificate providers and throw an error.In case
ValidityDurationis not defined by the user, it will default to the corresponding default values:Fixes: #251