Skip to content

fix: update time format in audit webhook configuration#201

Open
MuneebAijaz wants to merge 1 commit intokcp-dev:mainfrom
MuneebAijaz:fix/time-format
Open

fix: update time format in audit webhook configuration#201
MuneebAijaz wants to merge 1 commit intokcp-dev:mainfrom
MuneebAijaz:fix/time-format

Conversation

@MuneebAijaz
Copy link
Copy Markdown

@MuneebAijaz MuneebAijaz commented Apr 9, 2026

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,}"

image

What Type of PR Is This?

Related Issue(s)

Fixes #

Release Notes

fixed time format in audit webhook configuration when passing the value to container args 

@kcp-ci-bot kcp-ci-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. dco-signoff: no Indicates the PR's author has not signed the DCO. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 9, 2026
@kcp-ci-bot
Copy link
Copy Markdown
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@kcp-ci-bot kcp-ci-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Apr 9, 2026
Signed-off-by: Muneeb Aijaz <muneebaijaz11@gmail.com>
@kcp-ci-bot kcp-ci-bot added dco-signoff: yes Indicates the PR's author has signed the DCO. and removed dco-signoff: no Indicates the PR's author has not signed the DCO. labels Apr 9, 2026
@olamilekan000
Copy link
Copy Markdown
Contributor

can you open an issue and link it to this PR?

@xrstf
Copy link
Copy Markdown
Contributor

xrstf commented Apr 9, 2026

/ok-to-test
/approve

@kcp-ci-bot kcp-ci-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 9, 2026
@kcp-ci-bot
Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2026
@xrstf
Copy link
Copy Markdown
Contributor

xrstf commented Apr 9, 2026

/kind bug

@kcp-ci-bot kcp-ci-bot added kind/bug Categorizes issue or PR as related to a bug. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Apr 9, 2026
@xrstf xrstf requested a review from Copilot April 9, 2026 14:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BatchMaxWait as val.Duration.String() when building --audit-webhook-batch-max-wait.
  • Render InitialBackoff as val.Duration.String() when building --audit-webhook-initial-backoff.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 90 to 92
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()))
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MuneebAijaz Could you please? :)

@embik
Copy link
Copy Markdown
Member

embik commented Apr 9, 2026

can you open an issue and link it to this PR?

I honestly dont think this is necessary, release notes come from PRs and not issues :-)

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. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants