Skip to content

Keep webhook configuration watches active during draining - #3436

Merged
knative-prow[bot] merged 8 commits into
knative:mainfrom
dprotaso:webhook-config-watch-during-drain
Nov 27, 2026
Merged

knative-prow[bot] merged 8 commits into
knative:mainfrom
dprotaso:webhook-config-watch-during-drain

Conversation

@dprotaso

@dprotaso dprotaso commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Keep the ConfigMap watcher running while admission webhooks drain and finish HTTP shutdown.

Currently the shutdown signal stops the ConfigMap watcher at the same time that webhook draining begins. A draining webhook can still receive admission requests, but its configuration is frozen. This caused Serving's TestInitScaleZero to reject initial-scale=0 after allow-zero-initial-scale had been enabled: the request reached a draining webhook that retained the old setting.

This is a mitigation while Kubernetes can still route admission requests to draining webhooks.

Changes

  • Give webhook ConfigMap watchers a lifetime that extends through draining and HTTP shutdown.
  • Preserve cancellation during initial ConfigMap synchronization.
  • Preserve controller-only watcher cancellation behavior.
  • Keep an explicit webhook branch, with the startup-to-draining cancellation handoff encapsulated in startConfigMapWatcherForDrain.
  • Add a simple test verifying that shutdown leaves the synchronized watcher running until explicit cleanup.
  • Share deferred server cleanup across startup cancellation and normal shutdown, keeping profiling in its original startup position.

No changes to webhook routing, admission logic, or Serving are included.

Validation

go test -race ./injection/sharedmain ./configmap/informer ./webhook
git diff --check

Both passed.

@knative-prow

knative-prow Bot commented Nov 27, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 27, 2026
@knative-prow
knative-prow Bot requested review from Leo6Leo and skonto November 27, 2026 02:59
@knative-prow

knative-prow Bot commented Nov 27, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso

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

@knative-prow knative-prow Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 27, 2026
@knative-prow knative-prow Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 27, 2026
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.39%. Comparing base (e439916) to head (359f3fd).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3436   +/-   ##
=======================================
  Coverage   75.39%   75.39%           
=======================================
  Files         189      189           
  Lines        8371     8371           
=======================================
  Hits         6311     6311           
  Misses       1817     1817           
  Partials      243      243           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@knative-prow knative-prow Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 27, 2026
@knative-prow knative-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 27, 2026
@knative-prow knative-prow Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 27, 2026
@dprotaso
dprotaso marked this pull request as ready for review November 27, 2026 03:16
@knative-prow knative-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 27, 2026
@dprotaso

Copy link
Copy Markdown
Member Author

/assign @linkvt @dsimansk

@linkvt

linkvt commented Nov 27, 2026

Copy link
Copy Markdown
Member

/lgtm

Thanks!

@knative-prow knative-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 27, 2026
@knative-prow
knative-prow Bot merged commit b69fc46 into knative:main Nov 27, 2026
37 checks passed
@dprotaso
dprotaso deleted the webhook-config-watch-during-drain branch November 27, 2026 12:04
@dprotaso

dprotaso commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

/cherry-pick release-1.24
/cherry-pick release-1.23

@knative-prow-robot

Copy link
Copy Markdown
Contributor

@dprotaso: new pull request created: #3452

Details

In response to this:

/cherry-pick release-1.24
/cherry-pick release-1.23

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.

@knative-prow-robot

Copy link
Copy Markdown
Contributor

@dprotaso: new pull request created: #3453

Details

In response to this:

/cherry-pick release-1.24
/cherry-pick release-1.23

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.

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. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants