kubernetes: kubectl apply -o yaml does not output proper yaml when changing multiple objects
Is this a BUG REPORT or FEATURE REQUEST?: Bug report
/kind bug
What happened: Given the following file:
kind: ConfigMap
apiVersion: v1
metadata:
name: test
data:
key1: apple
---
kind: ConfigMap
apiVersion: v1
metadata:
name: test2
data:
key2: apple
returns
apiVersion: v1
data:
key1: apples
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"key1":"apples"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"test","namespace":"some-namespace"}}
creationTimestamp: 2018-01-25T22:43:35Z
name: test
namespace: somenamespace
resourceVersion: "12144"
selfLink: /api/v1/namespaces/some-namespace/configmaps/test
uid: 2dc1c468-0221-11e8-bce4-8ece3fb0c49d
apiVersion: v1
data:
key2: apples
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"key2":"apples"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"test2","namespace":"some-namespace"}}
creationTimestamp: 2018-01-25T22:43:35Z
name: test2
namespace: some-namespace
resourceVersion: "12145"
selfLink: /api/v1/namespaces/some-namespace/configmaps/test2
uid: 2dc2d982-0221-11e8-bce4-8ece3fb0c49d
which is not valid yaml (needs a document separator) What you expected to happen: For the output to be a List object containing the 2 ConfigMaps
How to reproduce it (as minimally and precisely as possible): Described above
Anything else we need to know?: The -o json flag returns something similar, where it’s just JSON bodies concatenated one after another. Not sure if that’s considered valid json.
Environment:
- Kubernetes version (use
kubectl version
): 1.8.6 client/server - Cloud provider or hardware configuration:
- OS (e.g. from /etc/os-release): N/A
- Kernel (e.g.
uname -a
): 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64 - Install tools:
- Others:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (4 by maintainers)
Thanks for fixing!