Repository navigation
fix(chart): correct values.schema.json structure and types - #447
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the values.schema.json for the frr-k8s chart by updating the interval field type, correcting a typo in the resources key, and repositioning the crds block. Feedback highlights a structural error where the frrk8s block is misplaced as a sibling to properties, causing it to be ignored by JSON schema validators, and suggests merging it into the top-level definition.
38a3f58 to
891cac4
Compare
|
This PR has been automatically marked as stale because it has been open 30 days
|
Four independent bugs in `charts/frr-k8s/values.schema.json` that
together leave strictly-shaped chart inputs unvalidated, reject
documented inputs, and bury a large `frrk8s` block in a schema-ignored
position. Single-file diff.
1. JSON property key typo: `"resources:"` (with trailing colon).
Pre-fix the property name under `frrk8s.frr.properties` had a stray
colon, so the `resources` map under `frrk8s.frr` was effectively
unschema'd. Rename to `"resources"`, matching the sibling shapes
`frrk8s.reloader.resources`, `frrk8s.frrMetrics.resources`,
`frrk8s.frrStatus.resources` in the same file.
2. `prometheus.serviceMonitor.interval` schema mismatch.
Pre-fix declared `anyOf: integer | null`, but the Prometheus
convention for scrape intervals is a duration string (`"30s"`,
`"1m"`, etc.) and `charts/frr-k8s/README.md:86` already documents
the field as `string`. Operators who set
`prometheus.serviceMonitor.interval: 30s` were rejected by
`helm template` with a schema error. Widen to
`anyOf: string | null`.
3. `crds` block misplaced under `prometheus`.
Pre-fix the `crds` schema lived at `properties.prometheus.crds`.
JSON Schema silently ignores unknown sibling keys, so the entire
top-level `crds` map in `values.yaml` was unvalidated —
`crds.enabled: "not_a_bool"` was accepted without complaint. Move
it to `properties.crds`; the schema now catches type errors on
`crds.enabled` and constrains `crds.validationFailurePolicy` to
the documented enum `Ignore | Fail`.
4. `frrk8s` block misplaced under `prometheus`.
Pre-fix an entire `frrk8s` definition (`tolerateMaster`,
`updateStrategy`, `runtimeClassName`, `secretName`, `frr.{image,
metricsPort, secureMetricsPort, resources}`, `command`, `reloader`,
`frrMetrics`) lived at `properties.prometheus.frrk8s` — a sibling
of `properties` inside the `prometheus` block. Same JSON-Schema
silent-ignore as metallb#3: the chart's actual `frrk8s.*` values went
unvalidated. Merge the misplaced block into the existing top-level
`properties.frrk8s` (which previously held only `strategy`,
`command`, `webhookMode`). The `frr.required: [enabled]` rule is
dropped during the move because the chart's own `values.yaml` does
not set `frrk8s.frr.enabled` — enforcing it would reject the chart's
default render with a confusing "missing property" error, which the
pre-fix schema avoided by being in a position the validator
ignored.
Verified locally (helm v3.18 and v3.21):
Pre-fix:
- `helm template ... --set prometheus.serviceMonitor.interval=30s` →
rejected ("got string, want integer").
- `helm template ... --set crds.enabled=not_a_bool` → silently accepted.
- `helm template ... --set frrk8s.tolerateMaster=not_a_bool` → silently
accepted.
Post-fix:
- `interval=30s` → accepted.
- `crds.enabled=not_a_bool` → rejected:
`at '/crds/enabled': got string, want boolean`.
- `frrk8s.tolerateMaster=not_a_bool` → rejected:
`at '/frrk8s/tolerateMaster': got string, want boolean`.
- Default `helm template charts/frr-k8s --set crds.enabled=true` renders
cleanly (42 documents, 0 errors).
- `helm lint charts/frr-k8s --set crds.enabled=true` clean.
Signed-off-by: Aleksei Sviridkin <[email protected]>
891cac4 to
3d96a59
Compare
|
Rebased onto the latest |
|
lgtm, thanks! |
Is this a BUG FIX or a FEATURE ?:
/kind bug
What this PR does / why we need it:
Four independent bugs in
charts/frr-k8s/values.schema.jsonthat together leave strictly-shaped chart inputs unvalidated, reject documented inputs, and bury a largefrrk8sblock in a schema-ignored position. Single-file diff.JSON property key typo:
"resources:"(with trailing colon).Pre-fix the property name under
frrk8s.frr.propertieshad a stray colon, so theresourcesmap underfrrk8s.frrwas effectively unschema'd. Rename to"resources", matching the sibling shapesfrrk8s.reloader.resources,frrk8s.frrMetrics.resources,frrk8s.frrStatus.resourcesin the same file.prometheus.serviceMonitor.intervalschema mismatch.Pre-fix declared
anyOf: integer | null, but the Prometheus convention for scrape intervals is a duration string ("30s","1m", etc.) andcharts/frr-k8s/README.md:86already documents the field asstring. Operators who setprometheus.serviceMonitor.interval: 30swere rejected byhelm templatewith a schema error. Widen toanyOf: string | null.crdsblock misplaced underprometheus.Pre-fix the
crdsschema lived atproperties.prometheus.crds. JSON Schema silently ignores unknown sibling keys, so the entire top-levelcrdsmap invalues.yamlwas unvalidated —crds.enabled: "not_a_bool"was accepted without complaint. Move it toproperties.crds; the schema now catches type errors oncrds.enabledand constrainscrds.validationFailurePolicyto the documented enumIgnore | Fail.frrk8sblock misplaced underprometheus.Pre-fix an entire
frrk8sdefinition (tolerateMaster,updateStrategy,runtimeClassName,secretName,frr.{image, metricsPort, secureMetricsPort, resources},command,reloader,frrMetrics) lived atproperties.prometheus.frrk8s— a sibling ofpropertiesinside theprometheusblock. Same JSON-Schema silent-ignore as Basic CI setup #3: the chart's actualfrrk8s.*values went unvalidated. Merge the misplaced block into the existing top-levelproperties.frrk8s(which previously held onlystrategy,command,webhookMode). Thefrr.required: [enabled]rule is dropped during the move because the chart's ownvalues.yamldoes not setfrrk8s.frr.enabled— enforcing it would reject the chart's default render with a confusing "missing property" error, which the pre-fix schema avoided by being in a position the validator ignored.Special notes for your reviewer:
Verified locally (helm v3.18, v3.21):
Pre-fix:
helm template ... --set prometheus.serviceMonitor.interval=30s→ rejected ("got string, want integer").helm template ... --set crds.enabled=not_a_bool→ silently accepted.helm template ... --set frrk8s.tolerateMaster=not_a_bool→ silently accepted.Post-fix:
interval=30s→ accepted.crds.enabled=not_a_bool→ rejected:at '/crds/enabled': got string, want boolean.frrk8s.tolerateMaster=not_a_bool→ rejected:at '/frrk8s/tolerateMaster': got string, want boolean.helm template charts/frr-k8s --set crds.enabled=truerenders cleanly (42 documents, 0 errors).helm lint charts/frr-k8s --set crds.enabled=trueclean.Release note: