libgitops icon indicating copy to clipboard operation
libgitops copied to clipboard

`Patcher.Apply` should respect the type of the given file

Open twelho opened this issue 5 years ago • 2 comments

Currently serializerEncode in the patcher is hard-configured to handle patching the manifests as JSON, e.g. https://github.com/weaveworks/libgitops/blob/master/pkg/util/patch/patch.go#L94. This is used by both Apply and ApplyOnFile.

There should either be a way to configure these in the patcher, or file type detection could be performed to support YAML output in the case of YAML input.

twelho avatar Jun 15 '20 15:06 twelho

This is actually a limitation of API Machinery's StrategicMergePatch, see here: https://github.com/weaveworks/libgitops/blob/2c871bbbbf0c31630571e873a45bb914246c7488/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go#L812 So we need to work with this in Ignite. Closing.

twelho avatar Jun 15 '20 16:06 twelho

We could add ContentType in here by automatically converting YAML to JSON whenever needed though.

luxas avatar Jun 29 '20 13:06 luxas