Add support for applying set of resources via kubectl

Discussion: https://github.com/GoogleCloudPlatform/kubernetes/issues/1905
One advantage of this form is that it's easy to export a label query of a type via the CLI to JSON which coincidently matches (child array of items).  Both seem valuable, but just getting the simpler pattern in now seems fine.


> On Nov 3, 2014, at 10:44 PM, bgrant0607 <notifications@github.com> wrote:
> 
> In pkg/kubectl/cmd/apply.go:
> 
> > +	"github.com/golang/glog"
> > +	"github.com/spf13/cobra"
> > +	"gopkg.in/v1/yaml"
> > +)
> > +
> > +// InternalConfig represents the Config format and holds the config items
> > +type InternalConfig struct {
> > +	// TODO: We can set the apiVersion for Config which will be then used as a
> > +	//			'default' apiVersion for all items.
> > +	runtime.TypeMeta `yaml:",inline" json:",inline"`
> > +	Items            []runtime.RawExtension `json:"items" yaml:"items"`
> > +}
> > +
> > +// DataToObjects converts the raw JSON data into API objects
> > +func DataToObjects(m meta.RESTMapper, t runtime.ObjectTyper, data []byte) (result []runtime.Object, errors errs.ValidationErrorList) {
> > +	configObj := InternalConfig{}
> Could we unmarshal directly into []runtime.RawExtension and avoid the wrapper object altogether in the serialized form? I think this would be easier for users to simply concatenate several objects into a single file, as well as easier for simple config generators. The default api version could be set using profiles (#1755), or in a configuration generator, or in a simple transformation pass.
> 
> —
> Reply to this email directly or view it on GitHub.