Repository navigation
chore(deps): updated k8s KubernetesClient to v18.0.5 - #976
Merged
Merged
Conversation
- Updated project files to use the latest version of `KubernetesClient` across the solution. - Adjusted `Crds` logic to align with the updated library API.
…thand across tests and core classes - Refactored entity `Metadata` and other class initializations to use object initializer shorthand consistently. - Marked test classes as `sealed` for improved optimization and design clarity. - Adjusted tests and core logic to align with the updated initialization style and coding standards.
- Updated object initializations across generator classes to use initializer shorthand for consistency. - Marked generator classes as `sealed` for optimization and better design practices. - Improved readability and alignment with modern C# coding standards.
…alizer tests - Marked entities (`V1OperatorIntegrationTestEntity` and its sub-classes) and test classes as `sealed` for better design and optimization. - Added null checks in finalizer integration tests to improve safety and adherence to modern C# standards. - Disabled obsolete warning in `KubernetesClient` with a TODO for clarification.
…sts and core classes - Updated object and dictionary initializations to improve readability. - Applied consistent formatting to multiline constructs and private methods. - Improved alignment with modern C# coding style.
- Adjusted formatting in `RbacGenerator` and `NamespacedOperator.Integration.Test` to enhance consistency and readability.
8 tasks
buehler
enabled auto-merge (squash)
November 7, 2025 12:26
kimpenhaus
added a commit
that referenced
this pull request
Nov 28, 2026
## Summary
`kubeops generate operator` produced an unusable conversion webhook for
CRDs with a `[ConversionWebhook]`. Checked
against Kubernetes 1.36 (OrbStack) with
`examples/ConversionWebhookOperator`:
| Generated CRD | Result |
| --- | --- |
| before: `service: { name: service }` (no namespace) | the API server
rejects the CRD: `spec.conversion.webhookClientConfig.service.name:
Required value` (the namespace is missing) |
| only `name: operator` | `service "operator" not found`: kustomize
prefixes the service to `<name>-operator`, but does not rename a service
reference in a CRD |
| `name: <name>-operator`, `namespace: <name>-system` | conversion v1 ↔
v3 works |
Changes:
- **CRD** (`CrdGenerator`): the conversion webhook points at the
`operator` service in the operator namespace
(`--namespace` or `<name>-system`); kustomize replaces the namespace
with the one of the kustomization.
- **`kustomizeconfig.yaml`** (new `KustomizeConfigGenerator`): a
`nameReference` from `Service` to
`spec/conversion/webhook/clientConfig/service/name` of
`CustomResourceDefinition`, listed under `configurations` in
the `kustomization.yaml` (as kubebuilder does). Kustomize renames this
reference for validation and mutation
webhooks on its own, but not for CRDs. Only generated when a conversion
webhook exists; written with LF.
- **`KustomizationConfig.Configurations`** (KubeOps.Abstractions): new
nullable property, additive.
- **Webhook deployment**: no longer sets `hostPort: 5001`. It came in
with #976 (v9.11.9), where
`new(5001, name: "https")` (the `containerPort`) became `HostPort =
5001`; #1061 added `ContainerPort` but kept it.
With it, a rolling update cannot start the new pod on the node of the
old one (seen in OrbStack), and at most one
pod runs per node. The service reaches the pod through `targetPort:
https`. Anyone who reached the webhook through
`<node-ip>:5001` loses that.
- The service name `operator` is a shared constant
(`WebhookDeploymentGenerator.ServiceName`) for the service, the
webhook configurations and the CRD.
Tests: the CLI test operator had no conversion webhook, which is why
`Should_Generate_Installer_The_Api_Server_Accepts`
(server dry run) never saw such a CRD. It now has a `v2` version with a
conversion webhook (same CRD).
`Should_Point_Webhooks_At_The_Generated_Service` checks that the
rendered CRD points at the rendered service and
namespace, `Should_Wire_The_Generated_Deployment` that no port has a
`hostPort`.
Docs: `cli.mdx` says to apply the manifests with `kubectl apply -k`.
Rebased onto #1358: the test conversion webhook no longer needs
`[RequiresPreviewFeatures]`.
## Checks
- `/code-review` (medium): no blocking bug. Fixed: the test converter
sets `apiVersion`/`kind` (the test entities are
not partial); `kustomizeconfig.yaml` with LF; docs on applying CRD files
without kustomize; `hostPort` removal noted
here. Not part of this PR (pre-existing): a `[ConversionWebhook(group,
plural)]` with an own route is not reflected
in the CRD path.
- `/simplify`: shared constant for the service name; one `CrdGenerator`
call instead of two.
- `/security-review`: no findings; dropping the `hostPort` no longer
binds the webhook port on the node.
- `dotnet build -c Release` without warnings, `dotnet format
--verify-no-changes`, `KubeOps.Cli.Test` unit tests (100)
and integration tests (8 per TFM) against OrbStack pass.
- End-to-end test in OrbStack: see comment below.
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.
Hi Christoph @buehler ,
I've updated the k8s KubernetesClient to v18 which brings some breaking changes. Unfortunately there is no detailed changelog so I had to extract the changes by comparing v17.0.14 with v18.0.5.
Things to mention are:
Model changed from ctor arguments to property initialization
WatcherExt methods are marked as obsolete - but sadly the message is misleading so I have no idea yet how to replace. I will start a discussion about that with the k8s team. In the meanwhile I disabled the obsolete warning with a pragme which I will remove once I know how to chage it properly. (see: WatcherExt: Watch & WatchAsync marked as obsolete kubernetes-client/csharp#1679)
this will make pull request #967 obsolete