-
Notifications
You must be signed in to change notification settings - Fork 7
fix: support extraVolumes/extraVolumeMounts, fix WH CA handling (OP-388) #2800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Validation & Admission | ||
|
|
||
| **Path**: `internal/validation/` + `internal/admission/` | ||
|
|
||
| Admission-webhook validators implement the `Validator` interface (`validator.go`), are | ||
| listed per-CRD in `registry.go`, and get a default severity in `admission/defaults.go`. | ||
| `doc.go` holds the sizing-mode glossary and the rule-ownership map — read it before adding a rule that | ||
| touches drive counts, container counts, or core sizing, so one condition is not reported twice. | ||
| Add a rule = implement + register + add to the defaults table. Reuse the shared helpers rather than | ||
| re-deriving: `role_specs.go` (`rolesForTemplate` — the six per-role sizing fields, one table for every | ||
| per-role validator), `template_cores.go` (`templateCoreSides` — drive/compute core totals plus the | ||
| planner-managed exclusion), `drive_role_nodes.go` (`listDriveRoleNodes` / `driveRoleNodeInfos`). | ||
| clusterCapacity validators: | ||
| `cluster_capacity_chunk_feasibility.go` (greenfield per-FD TLC share ≥ 384 GiB; skipped once the | ||
| cluster has TLC-bearing drive containers) and `cluster_capacity_protection.go` (min SW≥3, RL≥2, HS≥0 / | ||
| hotSpare optional — the `3+2+0` floor from `allocator.MinProtectionFloor`). | ||
| Protection values are resolved via `DriveSharingConfig.EffectiveProtection` (env.go): a per-cluster | ||
| spec field wins when non-zero (0 is treated as unset), else the Helm-level default (`PROTECTION_STRIPE_WIDTH` / | ||
| `PROTECTION_REDUNDANCY_LEVEL` / `PROTECTION_HOT_SPARE`, values `protection.*`) fills it. Same helper | ||
| is used in `FormCluster` so validation and formation agree. | ||
|
|
||
| Extra-volumes validators (`extra_volumes.go` shared core + `cluster_extra_volumes.go` / | ||
| `client_extra_volumes.go`) reject reserved names/paths and malformed `extraVolumes` JSON; | ||
| `client_wekahome_cacert_unverifiable.go` warns when a Weka Home CA cert cannot be verified. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,9 +63,18 @@ spec: | |
| {{- with .Values.dnsPolicy }} | ||
| dnsPolicy: {{ .k8sNetwork | default "" }} | ||
| {{- end }} | ||
| {{- range .Values.manager.extraVolumes }} | ||
| {{- if eq .name "tmpdir" }}{{ fail "manager.extraVolumes: the volume name \"tmpdir\" is reserved by the operator" }}{{ end }} | ||
| {{- end }} | ||
| {{- range .Values.manager.extraVolumeMounts }} | ||
| {{- if eq .mountPath "/tmp" }}{{ fail "manager.extraVolumeMounts: the mount path \"/tmp\" is reserved by the operator" }}{{ end }} | ||
| {{- end }} | ||
| volumes: | ||
|
Comment on lines
+66
to
72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Also nothing here catches duplicate names or duplicate mount paths within the user's own lists — Kubernetes will reject the Deployment, but with a much less obvious message than the two |
||
| - name: tmpdir | ||
| emptyDir: { } | ||
| {{- with .Values.manager.extraVolumes }} | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| containers: | ||
| - args: | ||
| - --secure-listen-address=0.0.0.0:8443 | ||
|
|
@@ -518,6 +527,9 @@ spec: | |
| volumeMounts: | ||
| - mountPath: /tmp | ||
| name: tmpdir | ||
| {{- with .Values.manager.extraVolumeMounts }} | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| name: manager | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,8 @@ | |
| | agentPort | int | if not set (0), weka will find a free port from the portRange | | ||
| | portRange | *PortRange | used for dynamic port allocation | | ||
| | nodeSelector | map[string]string | | | ||
| | extraVolumes | *runtime.RawExtension | extra volumes added to every client pod, in the same shape as a PodSpec's `volumes`.<br>Names must not collide with operator-managed volumes; see<br>doc/operator/deployment/extra-volumes.md for the reserved names and paths. | | ||
| | extraVolumeMounts | []v1.VolumeMount | mounts for `extraVolumes`, applied to the weka container only (not init containers) | | ||
| | wekaSecretRef | string | | | ||
| | network | Network | | | ||
| | driversDistService | string | | | ||
|
|
@@ -64,7 +66,6 @@ | |
| | resources | *PodResourcesSpec | experimental: pod resources to be proxied as-is to the pod spec | | ||
| | hugepages | int | hugepages, value in megabytes | | ||
| | hugepagesOffset | *int | value in megabytes to offset | | ||
| | wekaHomeConfig | WekahomeClientConfig | DEPRECATED, kept for compatibility with old API clients, not taking any action, to be removed on new API version | | ||
| | wekaHome | *WekahomeClientConfig | | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heads-up on something riding along in the Its doc comment said "kept for compatibility with old API clients … to be removed on new API version" — but this removes it from
If that's intentional and coordinated, fine — but it's an unrelated breaking API change in a PR titled |
||
| | upgradePolicy | UpgradePolicy | | | ||
| | allowHotUpgrade | bool | | | ||
|
|
@@ -85,6 +86,7 @@ | |
| | status | WekaClientStatusEnum | | | ||
| | stats | *ClientMetrics | | | ||
| | printer | ClientPrinterColumns | | | ||
| | lastAppliedPodConfigHash | string | Pod config version this client has adopted. Mirrors the WekaCluster field: it gates<br>the first-deploy adoption that lets tracking start on pods predating the annotation<br>without rolling them. | | ||
|
|
||
| --- | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things here.
1. Concatenating every file in the secret dir will inline a private key if the user points
cacertSecretat akubernetes.io/tlssecret. That's a very natural mistake — a TLS secret is the obvious thing to reach for, and it hastls.crt+tls.key. TheBEGIN CERTIFICATEcheck passes (thanks totls.crt), sotls.keylands verbatim inside/opt/weka/k8s-runtime/vars/wh-cacert/cert.pem, which is then pointed at byweka_cloud_ca_cert_path. Worth filtering to certificate blocks, or at least skipping files containing a private key:That also removes the need for the post-hoc content test, since a dir with no PEM certs produces no file at all.
2.
chmod 400happens only after the loop, so the file exists with the default umask (typically0644) for the duration of the concatenation. Harmless for a public CA bundle, but combined with (1) it's a real window on a private key. Set the mode before writing:(then drop the trailing
chmod, keeping only therm -rfon the no-certs path).Nit on the comment: "the glob skips the
..data/..2025_*dotfiles" — true, but the reason is that shell globs don't match leading dots, not the date; the..2025_*naming will read as stale in a year.# the glob skips the secret's ..data/..timestamp dotfilesis enough.