Skip to content

YAML Anchor support #3675

Closed
@george-angel

Description

@george-angel

Starting from kustomize/v4.0.0 - there is no way for us to build manifests that contain yaml anchors. Previously we were able to workaround by setting --enable_kyaml=false.

Example:

proximo.yaml

apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/path: /__/metrics
    prometheus.io/port: "8080"
    prometheus.io/scrape: "true"
  labels:
    app: &app proximo
    uw.systems/mirror: "true"
  name: *app
spec:
  ports:
  - name: ops
    port: 8080
    protocol: TCP
  - name: http
    port: 6868
    protocol: TCP
  selector:
    app: *app

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - proximo.yaml

Trying to do a build:

$ kustomize build .
Error: considering field 'metadata/name' of object
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/path: /__/metrics
    prometheus.io/port: "8080"
    prometheus.io/scrape: "true"
  labels:
    app: &app proximo
    uw.systems/mirror: "true"
  name: *app
spec:
  ports:
  - name: ops
    port: 8080
    protocol: TCP
  - name: http
    port: 6868
    protocol: TCP
  selector:
    app: *app
: wrong Node Kind for metadata.name expected: ScalarNode was AliasNode: value: {*app}

Thank you.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions