CI: валидировать values HelmRelease против схемы чарта (ловить «values don't meet the specifications of the schema») #72
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Зачем
20.09.2026 PR #70 смёржен, но реконсиляция упала:
Helm upgrade failed ... values don't meet the specifications of the schema(s)— вcontrollers.hermes.containers.app.envиспользованvalueFrom.secretKeyRefсо свойствомoptional, которого нет вvalues.schema.jsonчарта app-template 5.2.1. CI этого не поймал: Flate проверяет только сборку kustomize, а values против схемы чарта не валидирует. Ошибка всплыла только в кластере, в ивентах и статусе HelmRelease.Что должно быть
Пайплайн на PR краснеет, если values любого HelmRelease не соответствуют схеме его чарта (или если манифесты не рендерятся).
Варианты реализации
flux-local(test --allилиbuild --all) — рендерит Flux-объекты, тянет OCI-чарты и прогоняетhelm templateс values из git. Самый близкий к реальности вариант; так делают в публичных home-ops-репозиториях.helm templateпо каждомуhelmrelease.yaml: вытащитьspec.chartRefиspec.values, скормитьhelm template— ловит именноvalues don't meet the specifications of the schema.kubeconform/kubevalпо отрендеренному — ловит ошибки API-схемы, но неvalues.schema.jsonчарта, то есть нашу конкретную ошибку не поймает (в отличие от 1 и 2).Рекомендация: 1 как основной, 2 — как дешёвый минимум, если
flux-localв Gitea Actions не заводится.Ограничения, которые учесть
.github/workflows/flate.yaml), а не на GitHub: часть экшенов и синтаксиса молча не работает — см. скиллhome-ops-cluster,references/gitea-actions-portability.md.ghcr.ioза OCI-чартами и, вероятно, kubeconfig для части режимовflux-local(дляbuild— не нужен).strategy: RecreateдляDeploymentв app-template (тоже схемой валидируется).Критерий готовности
Ветка с заведомо неверными values (например,
env.FOO.valueFrom.secretKeyRef.optional: trueдля app-template 5.2.1) валит CI, а не реконсиляцию в кластере.hermes referenced this issue2026-09-24 15:32:30 +00:00
Closed as implemented by the
Flux Localgate (PR #209).What now runs on every pull request touching
kubernetes/**:Flux Local - Testinflates the cluster with helm (--enable-helm --all-namespaces) and validates the values of every HelmRelease against its chart'svalues.schema.json. That is exactly this issue's class: a value the schema rejects used to reach the rendered output with exit code 0 and fail only in the cluster.Flux Local - Diffrenders the HelmReleases at the head and at the base branch and posts the difference as a review comment, so a value bump shows its blast radius where it is reviewed.Negative control, the case from this issue: a stray
optional: trueundervalueFrom.secretKeyReffails the run withadditional properties 'optional' not allowed. On the current tree the same command reports 128 passed and no failures, and the workflow runs green in our own runner (run 179, jobsTestandDiffboth success).Two releases used to be the exception: the harbor and vault charts came from a git repository, because their upstream chart repositories sit behind CloudFront and are unusable from our network, and a chart in a git repository is exactly what flux-local cannot inflate. Both now come from our own registry as OCI artifacts (
oci://harbor.grachevko.ru/charts/<name>) via PR #207 and the mirror in grachevko/charts, with the internal-CA trust for source-controller added in PR #208. The gate therefore covers every release without exceptions.Not covered here, tracked separately:
secretKeyRef/configMapKeyRef/volumes (#74) — rendering does not resolve references;targetNamespacemust carry their own namespace). The other half of #81 — a HelmRelease source has to exist in the render — is covered by this same gate: renaming achartReftarget fails the run withUnable to find OCIRepository for <name> for HelmRelease <release>.