Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml Anchor not supported? #3497

Closed
leptonyu opened this issue Jan 21, 2021 · 5 comments · Fixed by #3500
Closed

Yaml Anchor not supported? #3497

leptonyu opened this issue Jan 21, 2021 · 5 comments · Fixed by #3500
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@leptonyu
Copy link

leptonyu commented Jan 21, 2021

Describe the bug

+ kustomize build .
Error: obj 'apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: blog
  annotations:
    config.kubernetes.io/originalNs: default
  namespace: blog
spec:
  tls:
  - hosts:
    - xyz.me
    - www.xyz.me
    secretName: cert-tls
  rules:
  - host: xyz.me
    http: &xxx_rules
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: service
            port:
              number: 80
  - host: www.xyz.me
    http: * xxx_rules
' at path 'spec/rules/http/paths/backend/serviceName': visit traversal on path: [http paths backend serviceName]: expected sequence or mapping node

Files that can reproduce the issue

kustomize version 3.9.2_1

@Shell32-Natsu Shell32-Natsu added kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it. labels Jan 21, 2021
@Shell32-Natsu
Copy link
Contributor

Please provide your resource files so we can reproduce it.

@leptonyu
Copy link
Author

test.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: blog
spec:
  tls:
  - hosts:
    - xyz.me
    - www.xyz.me
    secretName: cert-tls
  rules:
  - host: xyz.me
    http: &xxx_rules
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: service
            port:
              number: 80
  - host: www.xyz.me
    http: *xxx_rules

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- test.yaml
namespace: blog

@leptonyu
Copy link
Author

Error: obj 'apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: blog
  annotations:
    config.kubernetes.io/originalNs: default
  namespace: blog
spec:
  tls:
  - hosts:
    - xyz.me
    - www.xyz.me
    secretName: cert-tls
  rules:
  - host: xyz.me
    http: &xxx_rules
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: service
            port:
              number: 80
  - host: www.xyz.me
    http: *xxx_rules
' at path 'spec/rules/http/paths/backend/serviceName': visit traversal on path: [http paths backend serviceName]: expected sequence or mapping node

@leptonyu
Copy link
Author

@Shell32-Natsu

@george-angel
Copy link
Contributor

george-angel commented Feb 25, 2021

Hello, should I open a new issue?

$ rg -N . *
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
bases:
resources:
  - proximo.yaml
$ 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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants