Skip to content

[release-1.21] Retry the kyverno policy apply until the webhook is up - #9308

Merged
cert-manager-prow[bot] merged 1 commit into
cert-manager:release-1.21from
wallrj:fix-kyverno-policy-apply-race-release-1.21
Sep 8, 2026
Merged

cert-manager-prow[bot] merged 1 commit into
cert-manager:release-1.21from
wallrj:fix-kyverno-policy-apply-race-release-1.21

Conversation

@wallrj

@wallrj wallrj commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Fixes the ci-cert-manager-release-1.21-e2e-v1-36-bestpractice-install periodic, which has failed every run since 2026-09-04.

Part of #9237, the v1.21.2 release tracker.

The kyverno admission webhook registers itself from inside the running pod, after helm upgrade --wait has returned. The very next step, kubectl apply of policy.yaml, lands in that window and fails with connect: connection refused, so no test runs. This backports the retry loop that master has had since #9041.

Only the retry hunk is backported. Prow cannot cherry-pick #9041 as a whole: it conflicts on make/config/kyverno/kustomization.yaml and policy.yaml, because the rest of that PR is the Kyverno 3.8.1 / ValidatingPolicy migration which this branch never took.

Evidence

Last four runs of the tab all fail in e2e-setup-kyverno with the same error, for example build 2097150545235021824:

/home/prow/go/src/github.com/cert-manager/cert-manager/_bin/tools/kubectl apply --server-side -f make/config/kyverno/policy.yaml >/dev/null
Error from server (InternalError): Internal error occurred: failed calling webhook "mutate-policy.kyverno.svc": failed to call webhook: Post "https://kyverno-svc.kyverno.svc:443/policymutate?timeout=10s": dial tcp 10.0.17.91:443: connect: connection refused
make[1]: *** [make/e2e-setup.mk:407: e2e-setup-kyverno] Error 1

The chart (3.6.2) and image (v1.16.2) are unchanged between the last passing and first failing run. The same race also hits ci-cert-manager-release-1.20-e2e-v1-35-bestpractice-install, which has a matching PR.

NONE

[Claude Fable 5]

ci-cert-manager-release-1.21-e2e-v1-36-bestpractice-install has failed
every periodic run since 2026-09-04. The kyverno admission webhook
registers itself from inside the running pod, after
`helm upgrade --wait` has already returned. The next step, applying
policy.yaml, lands in that window and fails:

  Error from server (InternalError): Internal error occurred: failed
  calling webhook "mutate-policy.kyverno.svc": failed to call webhook:
  Post "https://kyverno-svc.kyverno.svc:443/policymutate?timeout=10s":
  dial tcp 10.0.17.91:443: connect: connection refused

Retry the apply with a short backoff, as master already does since
cert-manager#9041. Only that hunk is backported. The rest of cert-manager#9041 belongs to the
Kyverno 3.8.1 / ValidatingPolicy migration, which this branch never
took, and it conflicts on cherry-pick.

Signed-off-by: Richard Wall <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
@cert-manager-prow cert-manager-prow Bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. labels Sep 8, 2026
@wallrj

wallrj commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

/kind flake

@cert-manager-prow cert-manager-prow Bot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. kind/flake Categorizes issue or PR as related to a flaky test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Sep 8, 2026
@hjoshi123

Copy link
Copy Markdown
Collaborator

Looks like we have this in master for a while. So makes sense to me to be in the 1.21 branch

/lgtm
/approve

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 8, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hjoshi123

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

@cert-manager-prow cert-manager-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2026
@cert-manager-prow
cert-manager-prow Bot merged commit 6a05b37 into cert-manager:release-1.21 Sep 8, 2026
6 checks passed
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 that all commits in the pull request have the valid DCO sign-off message. kind/flake Categorizes issue or PR as related to a flaky test. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. 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.

2 participants