kubeyaml
kubeyaml copied to clipboard
Kubeyaml returns questionable output on multidoc input including empty docs
This comes from https://github.com/weaveworks/flux/issues/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:
- The end-of-document markers (
...
) were not present in the original document (which makes both flux andkubectl
choke). Here is the error fromkubectl
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
- 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.
This makes me think that Flux never managed to successfully make releases in multi-doc manifest files.
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.
you are right, it only generates ...
with empty documents.