pusher / faros

Faros is a CRD based GitOps controller
Apache License 2.0
99 stars 15 forks source link

Document behaviour of invalid YAML interleaved with valid #174

Closed mthssdrbrg closed 5 years ago

mthssdrbrg commented 5 years ago

Follow up from #172.

Not entirely sure whether we actually want to return the valid objects, but maybe we do? We should probably mimic what kubectl apply does, and I think it fails if the file isn't valid YAML?

mthssdrbrg commented 5 years ago

Can you verify that this behaviour matches kubectl, otherwise happy to stick with that

Turns out it's actually not, it'll create all resources until it encounters an invalid one (resources.yaml contains three resources, second one is invalid):

$ kubectl apply -f resources.yaml
deployment.apps/nginx-valid created
error: error parsing resources.yaml: error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{"nginx--invalid":interface {}(nil)}
mthssdrbrg commented 5 years ago

This has now been updated to mimic the behaviour of kubectl apply -f <path>, hopefully this will provide users with a "least surprise" behaviour.