I'm looking into writing a tool that generates Kubernetes definitions programatically for our project.
I've found that the API types in Kubernetes can be found in k8s.io/kubernetes/pkg/api
. I would like to output YAML based on these types.
Given an object like this:
ns := &api.Namespace{
ObjectMeta: api.ObjectMeta{
Name: "test",
},
}
What's the best way to generate the YAML output expected by kubectl create
?