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

Kubeyaml returns questionable output on multidoc input including empty docs #4

Open
2opremio opened this issue Apr 12, 2019 · 3 comments

Comments

@2opremio
Copy link
Contributor

2opremio commented Apr 12, 2019

This comes from fluxcd/flux#1925

Input:

---
# Source: webapp/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: name
  namespace: namespace
spec:
  selector:
    matchLabels:
      name: name
  template:
    metadata:
      labels:
        name: name
    spec:
      containers:
      - name: container
        image: stefanprodan/podinfo:1.4.4
---
# Source: webapp/templates/configmap.yaml
---
---
# Foo
---
---
---
---

The command:

kubeyaml.py image --namespace namespace --container container --kind deployment --name name --image bar

Results in:

---
# Source: webapp/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: name
  namespace: namespace
spec:
  selector:
    matchLabels:
      name: name
  template:
    metadata:
      labels:
        name: name
    spec:
      containers:
      - name: container
        image: stefanprodan/podinfo:latest
---
...
---
...
---
...
---
...
---
...
---
...
---
...

The output is questionable for a few reasons:

  1. The end-of-document markers (...) were not present in the original document (which makes both flux and kubectl choke). Here is the error from kubectl when trying to apply the output document:
    $ pbpaste | kubectl apply -f -
    deployment.apps/name configured
    error: error parsing STDIN: error converting YAML to JSON: yaml: did not find expected node content
    
  2. The output is missing comments.

The output seems to be correct YAML according to the standard though:

The stream format is intentionally “sloppy” to better support common use cases, such as stream concatenation.

@2opremio
Copy link
Contributor Author

2opremio commented Apr 13, 2019

This makes me think that Flux never managed to successfully make releases in multi-doc manifest files.

@squaremo
Copy link
Owner

The example includes empty documents. Do you have evidence that it produces problematic output when there are no empty documents? If not, that might be why it doesn't seem to have shown up before.

@2opremio
Copy link
Contributor Author

2opremio commented Apr 23, 2019

you are right, it only generates ... with empty documents.

@squaremo squaremo changed the title Kubeyaml returns questionable output on multidoc input Kubeyaml returns questionable output on multidoc input including empty docs Jun 11, 2019
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

No branches or pull requests

2 participants