client-go: parse kubernetes json files to k8s structures
问题 i would like to parse kubernetes manifest file (json/yaml) and be able to convert them to k8s structures (to later on manipulate them) I know there is the NewYAMLOrJSONDecoder().Decode() function (https://github.com/kubernetes/apimachinery/blob/master/pkg/util/yaml/decoder.go) to read a json/yaml file, but the next step is: how to convert them to k8s structure/type? i.e. if I read a yaml file with a Namespace object, how to convert it to a core/v1/namespace interface for example Regards, 回答1: