Repository navigation
feat(linstor-scheduler): add optional admission webhook with configurable TLS - #94
Merged
WanzenBug merged 1 commit intoJul 15, 2026
Merged
Conversation
…able TLS Add an optional, opt-in admission webhook to the linstor-scheduler chart that sets schedulerName on Pods using LINSTOR-backed PVCs, so the scheduler need not be selected by hand on every workload. Disabled by default and a no-op when off. Pod and container security contexts and the TLS secret name are configurable, and TLS can be provisioned via cert-manager (default), Helm-generated certificates, or a bring-your-own secret. helm mode generates one shared CA without lookup so the Secret ca.crt and webhook caBundle match. Includes a dedicated ServiceAccount and PodDisruptionBudget kept off the base scheduler selectors, fail-guards for invalid TLS configuration, readiness/liveness probes, opt-in cert-reload annotations, and a helm-unittest suite. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
WanzenBug
approved these changes
Jul 15, 2026
Member
|
Thanks! |
1 of 11 tasks
lexfrei
added a commit
to cozystack/cozystack
that referenced
this pull request
Jul 16, 2026
…sion webhook (#3201) ## What this PR does Re-vendors the `linstor-scheduler` chart from upstream **0.3.1** (appVersion **v0.3.6**). Upstream now ships the admission webhook natively (contributed via [piraeusdatastore/helm-charts#94](piraeusdatastore/helm-charts#94)), so the loose downstream admission templates — which round-tripped every Pod through an old `k8s.io/api` and silently stripped fields they did not know about, the `image` volume source and the native-sidecar `restartPolicy` among them, breaking KubeVirt containerDisk VMs and native sidecars cluster-wide — are dropped in favour of the upstream copy. - The admission webhook comes from the upstream chart now; the previous downstream copy and its patch are removed. `make update` pulls 0.3.1 and applies only `cozystack-scheduler-deployment.patch` (the scheduler pod component label and the distro-suffix-stripped kube-scheduler image tag, neither of which is upstream yet), so vendoring stays deterministic and reproducible. - The upstream admission Deployment keeps the same name but changes its immutable pod selector, so an in-place upgrade of an existing install would fail with `field is immutable`. Migration 52 deletes the old admission Deployment before the upgrade so the new one is recreated cleanly (`targetVersion` 52 → 53). - appVersion v0.3.6 also carries the webhook's TLS certificate hot-reload fix ([piraeusdatastore/linstor-scheduler-extender#22](piraeusdatastore/linstor-scheduler-extender#22)): the webhook used to load its certificate once at startup, so after the mounted Secret was rotated it kept serving a stale certificate and — with `failurePolicy: Ignore` — silently stopped mutating until it was restarted. It now reloads on rotation, so no external cert-reload workaround is needed here. - Wrapper values keep `replicaCount: 2`, now that the admission Pods have their own PodDisruptionBudget and no longer share the scheduler's. - Adds a helm-unittest suite covering the admission resources, PodDisruptionBudget selector isolation, least-privilege RBAC, the TLS provisioning modes and their rejection paths, the scheduler image-tag strip, and backward compatibility with the webhook disabled. Closes #3198. ### Screenshots N/A — no UI changes. ### Downstream repositories I walked the trigger map against the diff, file by file. It touches `packages/system/linstor-scheduler/` and, under `packages/core/platform/`, only migration 52 and the `migrations.targetVersion` bump — an internal, release-managed counter, not a user-facing `spec.components.platform.values.*` key documented on the website. No trigger matches. - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: ### Release note ```release-note fix(linstor-scheduler): the LINSTOR scheduler admission webhook no longer strips unknown Pod fields (the `image` volume source and native-sidecar `restartPolicy`), which had broken KubeVirt containerDisk VMs and native sidecars, and it now reloads its TLS certificate after rotation instead of silently failing. The chart is re-vendored from upstream 0.3.1; an automatic upgrade migration replaces the admission Deployment whose immutable selector changed. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Expanded the optional Linstor Scheduler admission webhook with richer configuration, including automated `schedulerName` mutation for LINSTOR CSI-backed PVC Pods. * **Improvements** * Updated the Linstor Scheduler Helm chart to **0.3.1** (scheduler app **v0.3.6**), including updated admission webhook behavior, safer defaults, and **2 replicas**. * Platform migrations now advance to **version 53**, with upgrade-safe cleanup of the existing admission deployment. * **Documentation** * Updated Helm README and post-install notes with detailed guidance for admission webhook and TLS modes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.
What this does
I add an optional admission webhook to the
linstor-schedulerchart. When enabled, it watches Pod creation and, for Pods that use a PersistentVolumeClaim backed by the LINSTOR CSI driver, setsschedulerNameto this scheduler automatically — so the scheduler no longer has to be selected by hand on every workload. It is disabled by default (admission.enabled: false), and with the default the chart renders exactly as before, so this is a complete no-op for existing installs.This revives and supersedes #68, which added the same webhook but stalled. I have carried its content over and addressed all three review comments from that PR:
admission.podSecurityContextandadmission.securityContext, with the previously hardcoded values kept as defaults.admission.tls.secretName(empty defaults to<fullname>-admission-tls), so a secret managed outside the chart can be pointed at directly.admission.createTLS—cert-manager(default, the previous behavior),helm(Helm generates the CA and certificate itself), or""(bring your own secret) — mirroring thecreateApiTLSidiom already used by thelinstor-clusterchart.A question before the code review
This chart is marked
deprecated: true, and the README already recommendsvolumeBindingMode: WaitForFirstConsumerfor new deployments. I would rather raise that directly than quietly grow a deprecated chart.The webhook is fully opt-in and a complete no-op when disabled, so it changes nothing for anyone who does not turn it on. It is aimed at clusters that still run this scheduler and want to avoid setting
schedulerNameon every Pod.Given the deprecation, would you prefer this to live in the chart at all, or would a standalone manifest / example outside the chart be a better home for it? I am happy either way — I would just like your call on the direction before taking it further.
What is new beyond #68
helm(self-contained CA + certificate generation) and""(bring your own). Inhelmmode the CA is generated once and shared, so the generated TLS Secret'sca.crtand the webhook'scaBundleare byte-identical; this is done withoutlookup, so it also works underhelm templateand on a first install.createTLSvalue, or a bring-your-own configuration with neither a secret nor a caBundle, instead of rendering a silently broken webhook.admission.reloadOnCertChange(opt-in Stakater Reloader annotations) so the Pods restart when the TLS secret is renewed — the webhook binary loads its certificate once at startup and does not hot-reload it.Known limitation
The
helmTLS mode regenerates the CA and certificate on everyhelm upgrade(Helm'sgenCAis non-deterministic), so it suits one-shot installs rather than continuously-reconciled / GitOps setups.cert-manager(the default) or bring-your-own are the right choice there. This is documented invalues.yamland the README.Supersedes #68.