fix: update time format in audit webhook configuration#201
fix: update time format in audit webhook configuration#201MuneebAijaz wants to merge 1 commit intokcp-dev:mainfrom
Conversation
|
Hi @MuneebAijaz. Thanks for your PR. I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Signed-off-by: Muneeb Aijaz <muneebaijaz11@gmail.com>
daa0e75 to
d741962
Compare
|
can you open an issue and link it to this PR? |
|
/ok-to-test |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xrstf 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 |
|
/kind bug |
There was a problem hiding this comment.
Pull request overview
Fixes audit webhook duration args rendering so metav1.Duration values are passed to the container as valid Go duration strings (e.g., 30s) instead of a struct representation that breaks flag parsing.
Changes:
- Render
BatchMaxWaitasval.Duration.String()when building--audit-webhook-batch-max-wait. - Render
InitialBackoffasval.Duration.String()when building--audit-webhook-initial-backoff.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if val := config.BatchMaxWait; val != nil { | ||
| extraArgs = append(extraArgs, fmt.Sprintf("--audit-webhook-batch-max-wait=%v", val.String())) | ||
| extraArgs = append(extraArgs, fmt.Sprintf("--audit-webhook-batch-max-wait=%v", val.Duration.String())) | ||
| } |
There was a problem hiding this comment.
Consider adding a unit test for the updated duration formatting (e.g., when BatchMaxWait/InitialBackoff are set to 30s, the resulting container args contain --audit-webhook-batch-max-wait=30s / --audit-webhook-initial-backoff=30s). This would prevent regressions back to printing the metav1.Duration struct representation, which breaks flag parsing.
I honestly dont think this is necessary, release notes come from PRs and not issues :-) |
Summary
This PR fixes time translation from the Custom Resource to the container args, for setting audit webhook configuration.
Currently the function returns Struct format and passes it to the container args, which gives an error
Error: invalid argument "&Duration{Duration:30s,}" for "--audit-webhook-batch-max-wait" flag: time: invalid duration "&Duration{Duration:30s,}"What Type of PR Is This?
Related Issue(s)
Fixes #
Release Notes