Skip to content

feat(web)!: replace LocalTunnel with external webhook endpoints - #1301

Merged
kimpenhaus merged 8 commits into
feat/net11-supportfrom
feat/webhook-external-endpoint
Nov 11, 2026
Merged

kimpenhaus merged 8 commits into
feat/net11-supportfrom
feat/webhook-external-endpoint

Conversation

@kimpenhaus

@kimpenhaus kimpenhaus commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1300

Problem

AddDevelopmentTunnel relies on LocalTunnel, which is unstable and was already deprecated. The webhook integration tests that depend on it were skipped permanently. There was no maintained way to reach a locally running operator's webhooks from a cluster that cannot reach the developer machine directly.

Changes

  • Removed: AddDevelopmentTunnel, DevelopmentTunnel, TunnelWebhookService, the Localtunnel package, its tests, its NOTICE entry and the LocalTunnel warning in the docs.
  • UseExternalWebhookEndpoint (KubeOps.Operator.Web): registers the webhooks against an externally provided HTTPS base URL, e.g. the public URL of a Dev Tunnel, cloudflared or ngrok tunnel that forwards to the operator. TLS is terminated by the tunnel, so the operator can listen on plain HTTP and no caBundle is needed; an optional caBundle covers endpoints with a private CA.
    • UseExternalWebhookEndpoint(Uri baseUri, byte[]? caBundle = null)
    • UseExternalWebhookEndpoint() reads KubeOps:Webhooks:ExternalUrl (KubeOps__Webhooks__ExternalUrl) at startup and fails the start if it is missing or invalid.
    • The URL must be absolute https without query or fragment, as the API server requires.
  • WithWebhookDevTunnel (KubeOps.Aspire.Hosting): starts a Microsoft Dev Tunnel (Aspire.Hosting.DevTunnels 13.6.5) with anonymous access for the operator's http endpoint (configurable), passes the tunnel URL as KubeOps__Webhooks__ExternalUrl and waits for the tunnel before starting the operator. Adds nothing in publish mode.
  • WebhookServiceBase: takes the webhook base URI and CA bundle through its constructor instead of WebhookConfig; UseCertificateProvider behaves as before.
  • Cleanup on stop: when the host stops, UseExternalWebhookEndpoint (and thus WithWebhookDevTunnel) removes the dev-validators and dev-mutators configurations it registered, as long as all their webhooks still point to its URL. Before, they stayed in the cluster and, with FailurePolicy: Fail, rejected every change of the webhook resources until someone deleted them. Best effort with a 5 s timeout; a failure is logged as a warning. UseCertificateProvider keeps them, because it can serve an operator inside the cluster, where a stopping pod must not remove the configurations of its successor. Conversion webhooks stay in the CRDs.
  • Fixes in the webhook registration:
    • A path in the base URL is kept: https://proxy.example.com/my-operator registers https://proxy.example.com/my-operator/validate/.... Before, the route replaced the path.
    • Webhooks derived from an intermediate base class are found at runtime and by the CLI; abstract classes are skipped. Before, only direct subclasses of ValidationWebhook<T>, MutationWebhook<T> and ConversionWebhook<T> were registered.
    • Two webhooks of the same type for the same entity kind, group and version fail the start with the duplicate webhook names, instead of the API server rejecting the configuration with 422.
  • Tests:
    • Unit tests for both new APIs, the webhook configuration factory, the webhook loader (runtime and CLI), the registration of admission and conversion webhooks, and the admission results.
    • The webhook integration fixture serves HTTPS with a generated certificate and registers the webhooks with its CA bundle. The admission and registration integration tests run when KUBEOPS_TEST_WEBHOOK_HOST names a host under which the API server reaches the test app; otherwise they are skipped. Stopping the test app removes dev-validators and dev-mutators, which covers the cleanup on stop against a real cluster.
    • Two test entities shared test.kubeops.dev/v1/TestEntity, which made the API server reject the webhook configuration; one now has its own kind.
    • Area traits for the webhook and hosting tests. The capturing test doubles moved into shared files. CS0618 is no longer suppressed in the web test project.
  • CI: the test workflow sets KUBEOPS_TEST_WEBHOOK_HOST to the gateway of the kind Docker network, so the webhook integration tests run in CI without a tunnel. They were skipped before.
  • Example: WebhookOperator uses the external endpoint when KubeOps:Webhooks:ExternalUrl is set, otherwise the certificate provider.
  • Docs: rewrote "Local Development Considerations" in webhooks.mdx (certificate provider vs. tunnel vs. Aspire, setup for Dev Tunnels, cloudflared and ngrok, security notes for anonymous endpoints, shared clusters, leftover webhook configurations and cloud clusters, migration note). Documented the path handling and the rules for webhook classes. Updated the KubeOps.Operator.Web and KubeOps.Aspire.Hosting READMEs, the Aspire guide, the Aspire operator model, troubleshooting, generation customization, and how to run the webhook integration tests in "Running the SDK Tests".

BREAKING CHANGE

AddDevelopmentTunnel has been removed, together with the transitive Localtunnel dependency. Start a tunnel and replace AddDevelopmentTunnel(port) with UseExternalWebhookEndpoint(...), or use WithWebhookDevTunnel() in an Aspire AppHost.

Webhooks that derive from ValidationWebhook<T>, MutationWebhook<T> or ConversionWebhook<T> through an intermediate base class of their own are now registered, both at runtime and in the manifests the CLI generates. Before, they were skipped without notice. Operators with such classes get these webhooks active after the update; check them before upgrading.

Before merging

This PR is the middle of stack #1303 (#1285 → #1301 → #1319) and ships with the same major release. It lands together with #1285 and #1319 when the stack is merged from the top PR (#1319), so all breaking changes land in one major version.

Verification

  • After rebasing the stack onto main (.NET 11 GA, Aspire.Hosting.DevTunnels 13.6.5): dotnet build --configuration Release and dotnet format --verify-no-changes clean; the top of the stack, which contains this PR, passed against a local minikube cluster with KUBEOPS_TEST_WEBHOOK_HOST=host.minikube.internal (net10.0 and net11.0): 1854 tests, 1850 passed, 4 skipped, 0 failed.

  • CI (net10.0 and net11.0): 1772 tests, 0 failed, 4 skipped (the two CLI install tests with a fixed Skip). The webhook integration tests ran against the kind cluster.

  • Locally against OrbStack (.NET 10 SDK, net10.0): all 87 tests of KubeOps.Operator.Web.Test passed with KUBEOPS_TEST_WEBHOOK_HOST=host.docker.internal.

  • Not run: WithWebhookDevTunnel end to end against a real Dev Tunnel (devtunnel CLI not installed). The Aspire wiring is covered by unit tests on the application model.

- Remove AddDevelopmentTunnel, the LocalTunnel implementation and the
  Localtunnel package.
- Add UseExternalWebhookEndpoint to register the webhooks against the
  public HTTPS URL of a maintained tunnel (Dev Tunnels, cloudflared,
  ngrok), optionally with a CA bundle or read from
  KubeOps:Webhooks:ExternalUrl.
- Add WithWebhookDevTunnel to KubeOps.Aspire.Hosting, which starts a
  Microsoft Dev Tunnel for the operator and passes its URL.
- Rework the webhook integration test fixture to use an external
  endpoint; the tests run when KubeOps__Webhooks__ExternalUrl is set.
- Document local webhook development per option and tunnel provider.

Closes #1300

BREAKING CHANGE: AddDevelopmentTunnel has been removed. Start a tunnel
and use UseExternalWebhookEndpoint, or WithWebhookDevTunnel in an Aspire
AppHost.
- Serve HTTPS from the test app with a generated certificate and register
  the webhooks with its CA bundle. The tests run when
  KUBEOPS_TEST_WEBHOOK_HOST names a host under which the API server
  reaches the test app.
- Set KUBEOPS_TEST_WEBHOOK_HOST to the gateway of the kind Docker network
  in CI, so the webhook integration tests run there.
- Give TestEntityWithISODurationTimeSpan its own kind. It shared
  test.kubeops.dev/v1/TestEntity with TestEntityWithTimeSpanConverter,
  which made the API server reject the webhook configuration with
  duplicate webhook names.
- Remove the dev-validators and dev-mutators configurations after the
  tests; they fail closed and pointed at the stopped test app.
- Document how to run the webhook integration tests locally.
…hooks

- Append webhook routes to the base URL instead of resolving them as
  relative URIs, which dropped a path such as /my-operator.
- Find webhooks that derive from an intermediate base class and skip
  abstract classes.
- Fail with the duplicate webhook names when two webhooks of the same
  type handle the same entity kind, group and version, instead of the
  API server rejecting the configuration.
- Add unit tests for the webhook configuration factory, the webhook
  loader, the registration of admission and conversion webhooks, and the
  admission results.
- Document the path handling and the rules for webhook classes.
- Pass the CA bundle to the webhook service base through its
  constructor instead of setting it in StartAsync.
- Validate the external endpoint URL in one place and derive the
  environment variable name from the configuration key.
- Register the webhook loader once and create it lazily.
- Name the webhook configurations through constants and remove them in
  the test fixture with IKubernetesClient.
- Add a WebhookIntegrationFact attribute for the webhook integration
  tests, merge the CA bundle tests into a theory and share assertions in
  the factory tests.
- Opt the mutation result tests into preview features for ToNode.
The CLI only checked the direct base class of a webhook and read the
entity type from it. A webhook derived from an intermediate base class
was registered at runtime but missing from the generated manifests.
Walk the base classes like the webhook loader of the operator does and
derive the webhook path from the entity type that was found.
…on stop

The dev-validators and dev-mutators configurations stayed in the cluster
after the operator stopped. With FailurePolicy Fail, they rejected every
change of the webhook resources until someone deleted them.

When the host stops, the external endpoint service now removes the
configurations it registered, as long as all their webhooks still point
to its base URL. This is best effort with a timeout; a failure is
logged. The certificate provider keeps them, because it can serve an
operator inside the cluster, where a stopping pod must not remove the
configurations of its successor. Conversion webhooks stay in the CRDs.
@kimpenhaus
kimpenhaus force-pushed the feat/webhook-external-endpoint branch from 1da5a7e to fa32cd4 Compare November 11, 2026 07:43
@kimpenhaus
kimpenhaus merged commit 8cb1f82 into main Nov 11, 2026
5 checks passed
@kimpenhaus
kimpenhaus deleted the feat/webhook-external-endpoint branch November 11, 2026 07:54
kimpenhaus added a commit that referenced this pull request Nov 11, 2026
## Summary

Prepares KubeOps for the .NET 11 release (November 2026) and removes the
.NET versions that go out of support at the same time.

| Version | Type | End of support |
| ------- | ---- | -------------- |
| .NET 8  | LTS  | Nov 10, 2026 — **dropped** |
| .NET 9  | STS  | Nov 10, 2026 — **dropped** |
| .NET 10 | LTS  | Nov 2028 |
| .NET 11 | STS  | Nov 2028 — **added** |

## Changes

- **Target frameworks:** all runtime libraries and `KubeOps.Cli` now
target `net10.0;net11.0` (`KubeOps.Generator` / `KubeOps.Templates` stay
on `netstandard2.0`).
- **.NET-aligned packages per TFM:** `Microsoft.Extensions.Hosting`,
`Microsoft.Extensions.Hosting.Abstractions`,
`Microsoft.Extensions.Diagnostics.HealthChecks`,
`Microsoft.Extensions.Http.Resilience`,
`Microsoft.Extensions.ServiceDiscovery`,
`Microsoft.Extensions.TimeProvider.Testing`,
`System.Reflection.MetadataLoadContext` and
`Microsoft.AspNetCore.Mvc.Testing` use the 10.x line for `net10.0` and
the 11.0 GA line for `net11.0`. The packed `net10.0` dependency groups
reference no 11.x package, so `net10.0` operators stay on the 10.x line.
- **SourceLink:** `Microsoft.SourceLink.GitHub` 11.0.100 (build-time
only, not part of the consumers' dependency graph).
- **CLI:** MSBuild `18.9.x` for `net10.0` and `18.11.x` for `net11.0`
(18.10+ only ships net11.0 assets). Roslyn is unified on `5.9.0` because
the `<=5.6.0` cap only existed for net8.0/net9.0.
- **Runtime Async (net11.0):** `src/Directory.Build.props` compiles the
`net11.0` assets with `runtime-async=on`, so the .NET 11 runtime
executes async methods natively instead of through compiler-generated
state machines (e.g. `KubeOps.Operator`: 86 → 6 state-machine types, the
remaining ones are iterators/async streams). This lowers `await`
overhead in the watcher → queue → reconciler pipeline and gives cleaner
stack traces. `net10.0` is unchanged. Runtime Async is still labeled a
preview feature in .NET 11, but the .NET runtime libraries themselves
ship compiled with it.
- **LangVersion:** raised from 12 to 14, the default of the lowest
supported TFM (`net10.0`), following the same rule that tied 12 to
`net8.0`. C# 15 is not used because it is unsupported on `net10.0` and
union types need .NET 11 runtime types. Existing code is not rewritten.
The templates no longer pin `LangVersion 12.0`, so new operator projects
use their TFM's default language version.
- **Code:** removed the now unconditional `#if NET9_0_OR_GREATER`
branches (`Crds.GetEnumNames`,
`CertificateExtensions.CopyServerCertWithPrivateKey`).
- **Tests:** test projects target `net10.0;net11.0`; the MSBuild locator
packages in `test/Directory.Build.props` are split per TFM.
- **CI:** all workflows install the .NET `10.x` and `11.x` SDKs. `dotnet
test` runs with `--max-parallel-test-modules 1`, because the net10.0 and
net11.0 modules of the same test project install identical
cluster-scoped CRDs and break each other when they run in parallel.
- **Renovate:** removed the net8.0/net9.0 MSBuild and Roslyn rules.
Added a rule that keeps the .NET-aligned packages above on the 10.x line
for `net10.0` TFMs.
- **Templates & examples:** `net9.0` → `net10.0` (LTS).
- **Docs:** updated prerequisites (.NET 10 SDK), the deployment workflow
example and the README. Added a "Supported Target Frameworks" section to
the package overview.

## BREAKING CHANGE

KubeOps no longer ships `net8.0` and `net9.0` assets. Operators must
target `net10.0` or `net11.0`. Projects that have to stay on .NET 8/9
need to remain on the previous major version of KubeOps.

## Merging

This PR is the bottom of stack #1303 (#1285 → #1301 → #1319). The stack
is rebased onto `main` with a linear history. Merge it from the top PR
(#1319), so all three breaking changes land in one major release.

`System.CommandLine` 3.0.0 is left to Renovate (#1323). That PR must not
be merged before this stack, because it also moves the `net10.0` runtime
packages to 11.0.

## Verification

On .NET 11 GA (SDK 11.0.100), after rebasing the stack onto `main`:

- `dotnet build --configuration Release`: 0 warnings, 0 errors
- `dotnet format --verify-no-changes`: clean
- `dotnet pack --configuration Release`: all packages created; no
`net10.0` dependency group references an 11.x package
- `dotnet test --configuration Release --max-parallel-test-modules 1`
against a local minikube cluster (net10.0 and net11.0):
  - this branch: 1692 total, 1676 passed, 16 skipped, 0 failed
- top of the stack (#1319) with
`KUBEOPS_TEST_WEBHOOK_HOST=host.minikube.internal`: 1854 total, 1850
passed, 4 skipped, 0 failed
kimpenhaus added a commit that referenced this pull request Nov 11, 2026
#1319)

Closes #1318

Top of stack #1303 (#1285, #1301, #1319), so that the breaking changes
land in one release. The stack merges from the bottom up.

## Problem

`KubeOps.Abstractions` references `JsonPatch.Net`, so nearly every
KubeOps package carries it transitively. Since 5.0.0 the package ships
under the [Open Source Maintenance Fee
EULA](https://www.nuget.org/packages/JsonPatch.Net/5.0.3/License). The
Renovate pin from #1032 keeps the SDK on 4.0.1, but a consumer that
pulls in 5.x still ends up on the EULA version.

## Changes

- **New types:** `JsonPatch`, `PatchOperation` and `OperationType` in
`KubeOps.Abstractions.Entities`, limited to the `add`, `remove` and
`replace` operations the diff emits. `PatchOperation` is only created
through its factories, and both types are classes rather than records.
- **Diff and serialization:** `JsonNode.CreatePatch` and `ToJsonString`
in `JsonPatchExtensions`. Array handling matches 4.0.1 on purpose, and
values are compared with `JsonNode.DeepEquals`.
- **Removed:** the `JsonPatch.Net` reference, its Renovate rule and its
`NOTICE.md` entry.
- **Preview:** `[RequiresPreviewFeatures]` is gone from the JSON Patch
API, along with the `CA2252` pragmas and `EnablePreviewFeatures` in
`examples/WebhookOperator`. Conversion webhooks and LocalTunnel stay in
preview, as they are separate features.
- **Client:** `PatchAsync(entity, operationsFilter, ...)` reads the
current entity with `GetAsync` instead of blocking on `Get`, and passes
on the cancellation token. A missing entity now surfaces when the task
is awaited.
- **Synchronous client API:** `Get`, `List`, `Save`, `Create`, `Update`,
`UpdateStatus`, `Patch` and `Delete` are removed from
`IKubernetesClient`, because they blocked a thread on the API call.
`GetCurrentNamespace` stays because it does not call the API, and
`Watch` stays because it does not block.
- **Docs:** new section in the migration guide.

Two differences from 4.0.1:

- Numbers outside the `decimal` range no longer throw a
`FormatException`, and numbers beyond `decimal` precision count as
different instead of being rounded.
- `OperationType` has no `Unknown` member, so its numeric values shift
by one.

## Breaking changes

- `JsonPatch`, `PatchOperation` and `OperationType` moved from
`Json.Patch` to `KubeOps.Abstractions.Entities`.
- `PatchOperation.Path` is a `string` instead of a `JsonPointer`.
- `OperationType` only has `Add`, `Remove` and `Replace`, and
`PatchOperation.From` is gone. Hand-built `move`, `copy` or `test`
operations go through `PatchAsync` as a `V1Patch`.
- `JsonPatch.Net`, `JsonPointer.Net` and `Json.More.Net` are no longer
transitive dependencies.
- The synchronous `IKubernetesClient` methods listed above are removed.
Use the `Async` variants.
- `JsonPatch.Apply`, `CreatePatch` for arbitrary objects and
`System.Text.Json` serialization of the patch types are removed.

## Notes for review

- **Not changed, existing behavior:**
- In `IKubernetesClient.PatchAsync`, `operationsFilter` only decides
whether a patch is sent. The patch that is sent always uses the default
filter.
- `DefaultOperationsFilter` matches with `StartsWith`, so it also drops
paths such as `/statusFoo`.
- **Remaining `JsonPatch.Net`:** `examples/AspireAppHost` still gets
3.3.0 through `Aspire.Hosting.AppHost` 13.3.5. No KubeOps package is
affected.

## Verification

- **Comparison with 4.0.1:** 100,000 random document pairs on .NET 10 on
the final code gave byte-identical patches, as did earlier runs of the
previous comparison on .NET 8, 9 and 10. Applying each patch with an
independent RFC 6902 implementation produced the target document. The
harness is not part of this PR.
- **Unit tests:** on the final code, on `net10.0`, excluding
`Category=Integration`: KubernetesClient, Abstractions, Operator.Web,
Operator, Cli and Aspire passed (546 tests).
`KubeOps.Aspire.Hosting.Test` and the examples could not be built
locally with the `net10.0` override.
- **Test changes:** `KubernetesClient.Test.cs` is removed with the API
it tested; only its namespace test moved to
`KubernetesClientAsync.Test.cs`, whose cleanup is now asynchronous.
Otherwise, existing test files only lose `using Json.Patch;` and the
`CA2252` pragma.
- **Build and format:** `dotnet build --configuration Release` and
`dotnet format --verify-no-changes` were clean before moving onto the
stack. `dotnet format` fails locally on the stacked branches, presumably
because of the missing .NET 11 SDK.
- **Not run locally:** the integration tests, because no cluster was
available, and everything on `net11.0`, because no .NET 11 SDK was
installed. Both depend on the CI run of this PR.
kimpenhaus added a commit that referenced this pull request Nov 11, 2026
…ase configuration (#1326)

## Problem

- The release notes of `v14.0.0-prerelease.1` listed three breaking
changes, but did not point to the [migration
guide](https://dotnet.github.io/dotnet-operator-sdk/docs/operator/migration#upgrading-from-v13-to-v14).
- Nothing ensured that a breaking PR updates the guide: #1285 and #1301
were merged without a section in `migration.mdx`.
- The commit parser matched the `BREAKING CHANGE` footer without regard
to case. PRs are squash-merged with the description as commit body, so a
description line starting with "Breaking change" would have triggered a
major release. Conventional Commits requires the footer in upper case.
- PR titles, which become the squash commit header, were not validated.

## Changes

- **Release notes:** `.release/release.base.mjs` adds a
`finalizeContext` hook to the release notes generator. Every release
with breaking changes gets a link to the migration guide section of its
major version (`#upgrading-from-v{N-1}-to-v{N}`) as the first entry
under "⚠ BREAKING CHANGES". Releases without breaking changes are
unchanged.
- **Upper-case footer only:** commit analyzer and release notes
generator use a `notesPattern` without the case-insensitive flag. Only
`BREAKING CHANGE` / `BREAKING-CHANGE` in upper case count as breaking;
`!` in the header works as before.
- **One set of rules for PRs and releases:**
`.release/check-pull-request.mjs` evaluates a PR with the configuration
of `release.base.mjs`. It parses the title with the release's commit
parser and checks the type against `presetConfig.types`, then runs the
commit analyzer on the prospective squash commit (title and
description). No type list or breaking-change pattern is maintained a
second time.
- **`Pull Request` workflow** (`.github/workflows/pull-request.yml`),
runs on open, edit and push:
- `PR Title`: installs the release tooling (`npm ci --ignore-scripts`,
cached) and runs the script. The job summary shows which release the PR
results in.
- `Migration Guide`: when the script reports a major release, fails
unless the PR updates `docs/docs/operator/migration.mdx`.
- `conventional-commits-parser` becomes a direct dependency of the
release tooling, at the version that was already installed (6.4.0).
- **Contribution guides:** the contribution page in the docs describes
how to mark breaking changes and both checks; `CONTRIBUTING.md` links to
it.

The notes of `v14.0.0-prerelease.1` were updated by hand with the
migration guide link.

## Before merging

To make the checks block merges, add `PR Title` and `Migration Guide` as
required status checks for `main`.

## Verification

- Release notes rendered locally with the repository configuration and
the real commits (no release published):
- `v13.3.7-prerelease.2..v14.0.0-prerelease.1`: identical to the
published notes plus the migration guide link
- `v13.3.7-prerelease.1..v13.3.7-prerelease.2` (no breaking change): no
link
  - `v13.3.6..main` as `14.0.0`: link to `#upgrading-from-v13-to-v14`
- `check-pull-request.mjs` against merged PRs matches the releases
semantic-release produced: #1285, #1301, #1319 major; #1323, #1324
(`deps(core)`) and #1316 (`fix`) patch; #1325 (`build`) and #1322
(`deps(test)`) no release. The non-conventional titles of #1110 and
#1102 fail.
- Footer samples: `BREAKING CHANGE:` major, `Breaking change:` in a
`feat` commit minor (parser default: major), a `## BREAKING CHANGE`
heading no major.
- First run on this PR: `PR Title` green ("no release"), `Migration
Guide` green without the file lookup.
- `actionlint`: clean
kimpenhaus added a commit that referenced this pull request Nov 11, 2026
## Problem

The release notes of every breaking release now link the migration guide
section of their major version (#1326), but the section "Upgrading from
v13 to v14" only covered #1319. The breaking changes of #1285 and #1301
were missing.

## Changes

`docs/docs/operator/migration.mdx`, section "Upgrading from v13 to v14":

- **Introduction** summarizing the v14 changes.
- **.NET 8 and .NET 9 no longer supported** (#1285): target `net10.0` or
`net11.0` with the .NET 10 SDK or later, raise directly referenced
`Microsoft.Extensions.*` / ASP.NET Core packages (otherwise `NU1605`),
or stay on v13.
- **`AddDevelopmentTunnel` removed** (#1301): start a tunnel and switch
to `UseExternalWebhookEndpoint(...)`, with a before/after example, the
configuration-based overload and `WithWebhookDevTunnel()` for Aspire;
links to the tunnel and Aspire sections of the webhook docs.
- **Webhooks derived through a base class of your own are registered**
(#1301): such webhooks become active with the update; a duplicate
validation or mutation webhook per entity kind, group and version fails
the start.

The existing sections for #1319 are unchanged.

## Verification

- `npm run build` in `docs` (`onBrokenLinks: "throw"`): succeeded
without broken links or anchors.
- In the built page, the new links resolve to existing anchors:
`packages/#supported-target-frameworks`,
`building-blocks/webhooks#tunnel`, `#aspire`, `#webhook-classes`.
- The `AddDevelopmentTunnel(ushort port, string hostname = "localhost")`
signature in the example matches v13.
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 14.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

kimpenhaus added a commit that referenced this pull request Dec 4, 2026
## Summary

`ExternalWebhookService` and `CertificateWebhookService` register the
webhooks in `StartAsync`, but ignored its
cancellation token: `RegisterAll` and the `Register*` methods of
`WebhookServiceBase` called `SaveAsync`, `GetAsync`
and `UpdateAsync` without a token. If the host start was cancelled (e.g.
Ctrl+C or a `StartupTimeout` while the API
server is slow), the registration still ran to the end.

The token of `StartAsync` is now passed to every client call of the
registration. `UnregisterAll` already took a
token, so all client calls in `KubeOps.Operator.Web` now honor
cancellation.

The bug exists since v9.1.0 (#756) and was carried over into
`ExternalWebhookService` (#1301, v14.0.0).

No API change and nothing users need to do, so no docs or migration
guide update.

## Tests

- `CapturingKubernetesClient` throws on a cancelled token in `GetAsync`,
`CreateAsync` and `UpdateAsync`, like the
  real client.
- New: `StartAsync_Stops_Registering_When_Cancelled` for both services
and
`Should_Not_Register_Conversion_Webhooks_When_Cancelled`. All three fail
without the fix.

## Checks

- `/code-review` (low): no findings.
- `/simplify`: `CertificateWebhookServiceTest` got a `CreateService`
helper that uses the class's certificate
generator, so the tests no longer create a generator they never dispose;
the CRD setup in `WebhookServiceBaseTest`
moved into `AddCrd()`. Not changed: making the `Register*` methods
`private` and registering validators and
mutators in parallel, as both are outside this fix. The other
`StartAsync` implementations in `src/` start their
work in the background and make no API calls in `StartAsync`, so they
need no change.
- `/security-review`: no findings.
- `dotnet build -c Release` without warnings, `dotnet format
--verify-no-changes`, all tests of
`KubeOps.Operator.Web.Test` (190) pass on net10.0 and net11.0, including
the webhook integration tests against a
local OrbStack cluster (`KUBEOPS_TEST_WEBHOOK_HOST=host.orb.internal`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Replace LocalTunnel with maintained webhook development endpoints

1 participant