kfctl
kfctl copied to clipboard
[Cleanup] Can KfDef converters just rely on YAML serialization?
trafficstars
The code for convertering KFConfig to a KFDef relies on custom conversion code https://github.com/kubeflow/kubeflow/blob/27da9c8b1d7c44f7bd47ef7d516214909db36e3f/bootstrap/pkg/apis/apps/configconverters/v1beta1.go#L166
Could we instead just do the following?
- Serialize KFConfig to bytes
- Desierialize bytes to KFDef.v1beta1
- ignore any errors
- See https://godoc.org/gopkg.in/yaml.v2#Unmarshal
I think Unmarshal will keep going but return a type error indicating any fields in the byte stream that aren't in the go struct. We should simply be able to ignore those.
This should simplify the conversion process and ensure the process is based on mapping fields of the same name and type.
/cc @gabrielwen @lluunn
/cc @lluunn