Repository navigation
refactor(client)!: remove JsonPatch.Net and the synchronous client API - #1319
Merged
kimpenhaus merged 9 commits intoNov 11, 2026
Merged
Conversation
kimpenhaus
force-pushed
the
refactor/replace-jsonpatch-net
branch
from
November 9, 2026 14:25
aa45ec9 to
3706181
Compare
kimpenhaus
force-pushed
the
refactor/replace-jsonpatch-net
branch
from
November 9, 2026 14:33
3706181 to
1acbf0a
Compare
kimpenhaus
changed the base branch from
feat/net11-support
to
feat/webhook-external-endpoint
November 9, 2026 14:33
… Patch implementation JsonPatch.Net ships under the Open Source Maintenance Fee EULA since 5.0.0. Implement the RFC 6902 diff and the patch types in KubeOps.Abstractions, and remove the package and its Renovate pin. Generated patches stay identical to 4.0.1. The JSON Patch API no longer requires preview features. BREAKING CHANGE: JsonPatch, PatchOperation and OperationType moved from Json.Patch to KubeOps.Abstractions.Entities, and paths are strings instead of JsonPointer. JsonPatch.Net, JsonPointer.Net and Json.More.Net are no longer transitive dependencies. JsonPatch.Apply, CreatePatch for arbitrary objects and System.Text.Json serialization of the patch types are gone. Closes #1318
…nd replace The diff only emits these three. Hand-built move, copy or test operations can still be sent as a V1Patch. Also simplify the array diff, the value comparison and the serialization. Generated patches stay identical to JsonPatch.Net 4.0.1. BREAKING CHANGE: OperationType no longer has Move, Copy and Test, and PatchOperation.From and its factories are removed.
…its factories A public record constructor allowed invalid operations such as remove with a value, and its value equality did not hold because JsonNode compares by reference. Also drop the empty Json.Patch namespace from the test project and the using in JsonPatchExtensions.Test.cs that needed it. BREAKING CHANGE: PatchOperation has no public constructor and no record members such as with and Deconstruct. Use PatchOperation.Add, Remove and Replace.
Its record equality only compared the list reference, so two patches with the same operations were not equal. BREAKING CHANGE: JsonPatch has no record members such as with and Deconstruct.
With .NET 8 gone, DeepEquals compares numbers by value on all targets, so the own comparison can go. Numbers beyond decimal precision now count as different instead of being rounded.
The overload that diffs against the current entity blocked a thread on the synchronous Get and ignored the cancellation token for that call.
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. The sync test class goes with them, and the async test class cleans up asynchronously. BREAKING CHANGE: Get, List, Save, Create, Update, UpdateStatus, Patch and Delete are removed from IKubernetesClient. Use the Async variants.
kimpenhaus
force-pushed
the
refactor/replace-jsonpatch-net
branch
from
November 11, 2026 07:43
d44a637 to
0f51d06
Compare
This was referenced Nov 11, 2026
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
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.
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.
|
🎉 This PR is included in version 14.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This was referenced Nov 19, 2026
This was referenced Nov 19, 2026
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.AbstractionsreferencesJsonPatch.Net, so nearly every KubeOps package carries it transitively. Since 5.0.0 the package ships under the Open Source Maintenance Fee EULA. 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
JsonPatch,PatchOperationandOperationTypeinKubeOps.Abstractions.Entities, limited to theadd,removeandreplaceoperations the diff emits.PatchOperationis only created through its factories, and both types are classes rather than records.JsonNode.CreatePatchandToJsonStringinJsonPatchExtensions. Array handling matches 4.0.1 on purpose, and values are compared withJsonNode.DeepEquals.JsonPatch.Netreference, its Renovate rule and itsNOTICE.mdentry.[RequiresPreviewFeatures]is gone from the JSON Patch API, along with theCA2252pragmas andEnablePreviewFeaturesinexamples/WebhookOperator. Conversion webhooks and LocalTunnel stay in preview, as they are separate features.PatchAsync(entity, operationsFilter, ...)reads the current entity withGetAsyncinstead of blocking onGet, and passes on the cancellation token. A missing entity now surfaces when the task is awaited.Get,List,Save,Create,Update,UpdateStatus,PatchandDeleteare removed fromIKubernetesClient, because they blocked a thread on the API call.GetCurrentNamespacestays because it does not call the API, andWatchstays because it does not block.Two differences from 4.0.1:
decimalrange no longer throw aFormatException, and numbers beyonddecimalprecision count as different instead of being rounded.OperationTypehas noUnknownmember, so its numeric values shift by one.Breaking changes
JsonPatch,PatchOperationandOperationTypemoved fromJson.PatchtoKubeOps.Abstractions.Entities.PatchOperation.Pathis astringinstead of aJsonPointer.OperationTypeonly hasAdd,RemoveandReplace, andPatchOperation.Fromis gone. Hand-builtmove,copyortestoperations go throughPatchAsyncas aV1Patch.JsonPatch.Net,JsonPointer.NetandJson.More.Netare no longer transitive dependencies.IKubernetesClientmethods listed above are removed. Use theAsyncvariants.JsonPatch.Apply,CreatePatchfor arbitrary objects andSystem.Text.Jsonserialization of the patch types are removed.Notes for review
IKubernetesClient.PatchAsync,operationsFilteronly decides whether a patch is sent. The patch that is sent always uses the default filter.DefaultOperationsFiltermatches withStartsWith, so it also drops paths such as/statusFoo.JsonPatch.Net:examples/AspireAppHoststill gets 3.3.0 throughAspire.Hosting.AppHost13.3.5. No KubeOps package is affected.Verification
net10.0, excludingCategory=Integration: KubernetesClient, Abstractions, Operator.Web, Operator, Cli and Aspire passed (546 tests).KubeOps.Aspire.Hosting.Testand the examples could not be built locally with thenet10.0override.KubernetesClient.Test.csis removed with the API it tested; only its namespace test moved toKubernetesClientAsync.Test.cs, whose cleanup is now asynchronous. Otherwise, existing test files only loseusing Json.Patch;and theCA2252pragma.dotnet build --configuration Releaseanddotnet format --verify-no-changeswere clean before moving onto the stack.dotnet formatfails locally on the stacked branches, presumably because of the missing .NET 11 SDK.net11.0, because no .NET 11 SDK was installed. Both depend on the CI run of this PR.