Repository navigation
deps(test): update dependency kubernetesclient to 21.0.41 - #1349
Merged
Merged
Conversation
kimpenhaus
added a commit
that referenced
this pull request
Nov 28, 2026
## What The operator identifies itself to the Kubernetes API server with its own name instead of the generic user agent of the C# client: ```text # before kubernetes-csharp/21.0.8+75f253d651 # after my-operator/1.2.0 kubeops/15.0.0 kubernetes-csharp/21.0.8+75f253d651 ``` Build metadata (`+<commit>`) is dropped from the operator and KubeOps versions; the C# client token stays as the client sends it. The API server records the user agent in its audit logs, so requests of an operator can now be told apart from those of other clients built on the C# client. This complements the explicit field manager from #1346: the API server derives the field manager of a write without `fieldManager` from the part of the user agent before the first `/`. The operator always sends an explicit field manager, so `managedFields` do not change. ## How - **`KubernetesUserAgent`** (public static class in `KubeOps.KubernetesClient`) with two members: - `Create(product, version)` returns `<product>[/<version>] kubeops/<version> <client default>`. Characters that are not allowed in an HTTP product token (RFC 9110 `tchar`), e.g. spaces, `/` or CR/LF, are replaced by `-`. An empty version is left out, build metadata is dropped. - `Apply(config, product, version)` sets that user agent on a `KubernetesClientConfiguration` unless it already carries an own one. An empty user agent and the client default count as not configured. - **`OperatorBuilder`**: the default `IKubernetes` applies the user agent from the operator name and the informational version of the entry assembly to the configuration before it creates the client. This also covers a `KubernetesClientConfiguration` registered by the user, as long as it has no own user agent; the registered configuration is changed in place (documented). The user agent always starts with the operator name, independent of `WithFieldManager`. With an empty operator name the client default is kept. - **KubeOps CLI** identifies itself as `kubeops-cli/<version>`. No new setting: an own user agent is set through `KubernetesClientConfiguration.UserAgent`, which already exists. ## Behavioural changes for users No public API is removed or changed. Visible differences: - The `User-Agent` header of the operator and the CLI changes, e.g. in API server audit logs. Anything that matches on `kubernetes-csharp` in the user agent still matches, because the client token stays at the end. - An `IKubernetes` registered by the user keeps the user agent of its configuration; `KubernetesUserAgent` can be used to set it (documented). - `KubernetesClient` constructed directly (outside the operator) is unchanged. ## Docs - New page `docs/docs/operator/configuration/user-agent.mdx`, linked from the Advanced Configuration index and from the Field Manager page - `KubeOps.KubernetesClient` README - CLI page - Migration guide ("New in v15 (non-breaking)") ## Tests - Unit tests (`Area` `KubernetesClient` / `Configuration` / `Cli`): - format, omitted version, dropped build metadata, token sanitisation (incl. CR/LF), empty product - `Apply`: replaces a missing, empty and default user agent, keeps an own one - `OperatorBuilder` wiring: operator name independent of the field manager, own configured user agent, empty operator name - CLI factory - `dotnet build -c Release`, `dotnet format --verify-no-changes` and the unit tests of `KubeOps.KubernetesClient.Test`, `KubeOps.Operator.Test` and `KubeOps.Cli.Test` pass locally, and the docs build (`npm run build`, `onBrokenLinks: throw`) succeeds. I did not run the integration tests locally. ## Reviews Run before merge: `/code-review`, `/simplify`, `/security-review`, docs sync. - **`/code-review`**: fixed - an empty operator name with an explicit field manager made resolving `IKubernetes` throw, because the product is required; the user agent is now skipped in that case - build metadata (`+<sha>`) ended up in the user agent, unlike the documented format; it is now dropped - an empty `UserAgent` counted as configured; it now counts as not configured - the in-place change of a user-registered configuration is now documented - **`/simplify`**: public surface reduced from four members (`ClientDefault`, `Create`, `CreateFromAssembly`, `SetIfNotConfigured`) to `Create` and `Apply`; string building simplified; redundant tests (incl. a wire-level test of upstream behaviour) and duplicated docs removed. Efficiency: no findings. - Skipped: changing the existing public `KubernetesClient(config, fieldManager)` constructor to also set the user agent. It was released in 14.1.0, and mutating the caller's configuration from a constructor would be a surprising behaviour change; tools call `KubernetesUserAgent.Apply` instead. - Skipped: sharing `BuildProvider` / the stub API server between test classes (small, test-only duplication). - **`/security-review`**: no findings. Product and version pass through the token sanitiser, so no header/CRLF injection; only `UserAgent` of the configuration is changed, never TLS or credentials. - **Docs**: synced with the final API (user-agent page, README, migration guide). ## Kubernetes client 21.0.41 `main` moved to `KubernetesClient` 21.0.41 (#1349) while this PR was open. Docs only: - The user agent example shows `kubernetes-csharp/21.0.41+d05b908e20`. - `migration.mdx` (v15): the client now rejects an API server certificate that does not match the server address when a CA from the kubeconfig is used ([kubernetes-client/csharp#1964](kubernetes-client/csharp#1964)), with how to fix a kubeconfig (`server` or `tls-server-name`). Our code has no own certificate validation and needs no change.
|
🎉 This PR is included in version 15.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This was referenced Dec 2, 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.
This PR contains the following updates:
21.0.8→21.0.41Release Notes
kubernetes-client/csharp (KubernetesClient)
v21.0.41What's Changed
New Contributors
Full Changelog: kubernetes-client/csharp@v21.0.7...v21.0.41
Configuration
📅 Schedule: (in timezone Europe/Zurich)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.