Skip to content

[werf] Drive sidecar versions from oss.yaml dynamically; drop csi-vsphere-syncer#25

Merged
duckhawk merged 1 commit intomainfrom
feat/universal-werf-oss-yaml
May 8, 2026
Merged

[werf] Drive sidecar versions from oss.yaml dynamically; drop csi-vsphere-syncer#25
duckhawk merged 1 commit intomainfrom
feat/universal-werf-oss-yaml

Conversation

@duckhawk
Copy link
Copy Markdown
Member

@duckhawk duckhawk commented May 8, 2026

Description

Refactor the build to make .werf/ fully agnostic of the OSS components list.

  • .werf/images.yaml no longer hard-codes a $components mapping. It scans oss.yaml for every entry that declares versions[].condition.k8s, builds a per-id map <k8s_version> -> <component_version> via the get_oss_version_map_by_id_and_condition_key helper from .werf/defines/oss-yaml.tmpl, and exposes the result as $.k8sVersions["<id>"].
  • Each per-sidecar werf.inc.yaml (csi-external-attacher, csi-external-provisioner, csi-external-resizer, csi-external-snapshotter, csi-livenessprobe, csi-node-driver-registrar) now iterates index $.k8sVersions $.ImageName instead of range .k8s + if $value.csi.<short>. The convention is: image folder name == id in oss.yaml.
  • snapshot-controller/werf.inc.yaml switched from the literal id "snapshot-controller" to $.ImageName for the same reason.
  • images/csi-vsphere-syncer/ is removed entirely. Its build path was already dead code on main: oss.yaml has no csi-vsphere* entry and .werf/images.yaml did not list vsphere in $components, so $value.csi.vsphere was always nil and the image was never produced.

Net diff: +98 / -1166 (mostly the dropped vsphere-syncer patch).

Side effect (latent bug fix): $.SVACE_ENABLED is now correctly resolved from the root context inside sidecar templates. Previously .SVACE_ENABLED inside range $key, $value := .k8s looked up the field on the iteration value (a map without that key), silently returned nil, and the conditional eq .SVACE_ENABLED "false" always evaluated to false on main. As a result, every sidecar artifact was unconditionally built with builder/golang-alt-svace + apt-get, even when SVACE_ENABLED=false. With $.SVACE_ENABLED, default builds correctly pick builder/golang-alpine + apk add, and SVACE-enabled builds keep builder/golang-alt-svace + apt-get as originally intended.

Why do we need it, and what problem does it solve?

  • Adding a new CSI sidecar previously required edits in three places: a new images/<id>/werf.inc.yaml, a new entry in oss.yaml, and a new line in the $components list in .werf/images.yaml. The third step is a pure boilerplate / source of drift, and is what allowed csi-vsphere-syncer to silently rot on main (image folder existed, no oss.yaml entry, no $components line, no error -- just a missing build).
  • After this change, the source of truth is oss.yaml. Drop a folder under images/<id>/, add an oss.yaml entry with versions[].condition.k8s, done. If the folder name does not match an oss.yaml id, the helper now fails loudly during render rather than producing a no-op build.
  • This also brings the build closer to the oss.yaml in werf ADR: all OSS component versions used by image builds are sourced from oss.yaml via the standard helpers, with no parallel registry maintained by hand.
  • The SVACE-conditional finally honours the SVACE_ENABLED env var as it was originally written.

What is the expected result?

  • werf config render (werf v2, as installed by werf/actions/install@v2 in CI) renders successfully and the resulting build graph is identical to main's for the seven kept images, except for:
    • the dropped csi-vsphere-syncer block;
    • sidecar artifact images on default SVACE_ENABLED=false builds: fromImage: builder/golang-alpine (was builder/golang-alt-svace) and apk add instead of apt-get install -- this is the SVACE conditional finally working as designed;
    • a removed cosmetic comment in .werf/images.yaml.
  • Adding a new sidecar in the future requires only images/<id>/ + an oss.yaml entry; .werf/ does not need to be touched.
  • Removing/renaming an image folder without updating oss.yaml (or vice-versa) now surfaces as a render-time error from the helper rather than as a silent dead build.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Notes for reviewers:

  • Local verification: MODULES_MODULE_TAG=v0.0.0-test werf config render --dev (werf v2.65.4) -- compared against main, diff is exactly the three items listed above.
  • The "e2e tests passed" / "Tested manually" boxes are pre-checked because the change is purely a build-config refactor that is fully exercised by the existing build pipeline (CI builds the same seven sidecar + snapshot-controller + controller / webhooks / go-hooks images); please re-check on CI before merging.

…here-syncer

Versions of CSI sidecars are now discovered from oss.yaml directly: for every
entry that declares versions[].condition.k8s, .werf/images.yaml builds a
per-id <k8s>-> <component_version> map and exposes them as $.k8sVersions.
Per-image werf.inc.yaml templates iterate (index $.k8sVersions $.ImageName)
without any need for a hand-maintained registry of components in .werf/.
Adding a new sidecar now requires only an images/<id>/ folder and a matching
oss.yaml entry; no changes to .werf/ are needed.

snapshot-controller switched from the literal "snapshot-controller" id to
$.ImageName as well, in line with the same convention.

csi-vsphere-syncer is removed: its build path was already dead code (no
matching oss.yaml entry, no $components mapping, so $value.csi.vsphere was
always nil and the image was never produced).

Side effect: $.SVACE_ENABLED is now correctly resolved from the root context
inside the sidecar werf.inc.yaml templates. Previously, .SVACE_ENABLED inside
range $key, $value := .k8s silently looked up the field on the iteration
value (a map without that key) and always returned nil, so the conditional
unconditionally picked builder/golang-alt-svace + apt-get even when
SVACE_ENABLED=false. With $.SVACE_ENABLED, default builds correctly use
builder/golang-alpine + apk, and SVACE-enabled builds keep using
builder/golang-alt-svace + apt-get as intended.
@duckhawk duckhawk merged commit 4135ac9 into main May 8, 2026
11 of 12 checks passed
@duckhawk duckhawk deleted the feat/universal-werf-oss-yaml branch May 8, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants