Skip to content

Post-render fails with unknown anchor … referenced on kind: List #4977

Description

@JeffResc

Environment

Device and OS: Ubuntu Linux on x86_64
App version: Zarf v0.77.0
Kubernetes distro being used: K3s v1.34.4+k3s1 (k3d v5.9.0)
Other:

Steps to reproduce

  1. Create a chart with a kind: List template that uses a YAML anchor across items.

    min-chart/Chart.yaml:

    apiVersion: v2
    name: min-chart
    version: 0.1.0

    min-chart/templates/list.yaml:

    apiVersion: v1
    kind: List
    items:
    - apiVersion: v1
      kind: ConfigMap
      metadata:
        name: cm-a
      data: &shared
        key: value
    - apiVersion: v1
      kind: ConfigMap
      metadata:
        name: cm-b
      data: *shared
  2. Wrap it in a zarf.yaml:

    kind: ZarfPackageConfig
    metadata:
      name: min-anchor
      version: "dev"
    components:
      - name: chart
        required: true
        charts:
          - name: min-chart
            namespace: min-test
            localPath: min-chart
            version: 0.1.0
  3. Build and deploy:

    zarf package create --architecture amd64 --skip-sbom --confirm
    zarf package deploy zarf-package-min-anchor-amd64-dev.tar.zst --confirm

Expected result

Both ConfigMaps deploy successfully, each with data.key = value. Vanilla helm install of the same chart and kubectl apply -f on the rendered output both succeed (see Visual Proof for more details).

Actual Result

ERR  failed to deploy package: unable to deploy component "chart":
release: not found
unable to install chart error while running post render on files:
error re-rendering helm output:
YAML parse error on /tmp/zarf-3747194653/chart.yaml:
error converting YAML to JSON:
yaml: unknown anchor 'shared' referenced

Visual Proof (screenshots, videos, text, etc)

Zarf deploy failure (full error above).

Same chart deploys cleanly via Helm directly:

$ helm install repro ./min-chart -n min-test --create-namespace
NAME: repro
LAST DEPLOYED: ...
NAMESPACE: min-test
STATUS: deployed
REVISION: 1

$ kubectl get cm -n min-test cm-a cm-b \
    -o jsonpath='{range .items[*]}{.metadata.name}={.data.key} {end}'
cm-a=value cm-b=value

The two ConfigMaps both end up with data.key = value — the anchor materializes correctly under Helm and the apiserver.

The same rendered YAML also applies cleanly with kubectl apply -f.

Severity/Priority

Medium. A workaround exists at the chart level (modify the upstream template), but it requires the chart author's intervention.

Additional Context

Scope of the issue, verified with three tests to narrow it down:

Scenario helm install zarf package deploy
Single resource, anchor and alias used internally
kind: List with two items, no anchor
kind: List with two items, anchor crosses items

So the issue is specifically about YAML anchors crossing item boundaries within a kind: List, not YAML anchors or kind: List in general. Anchors within a single resource resolve correctly under Zarf; plain kind: List resources without anchors deploy correctly under Zarf.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions