func (k *KubeResource) InjectVarsDeployment(envVars []v1.EnvVar) (*v1beta1.Deployment, error) {
	deployment := &v1beta1.Deployment{}
	if err := json.Unmarshal(k.Data, &deployment); err != nil {
		return deployment, err
	}
	podSpec := injectPodSpecEnvVars(
		deployment.Spec.Template.Spec,
		envVars,
	)
	deployment.Spec.Template.Spec = podSpec
	return deployment, nil
}
InjectVarsDeployment inserts EnvVars into a Deployment doc
package main
import (
	"encoding/json"
	"io"
	"k8s.io/kubernetes/pkg/api/unversioned"
	"k8s.io/kubernetes/pkg/api/v1"
	"k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
	"k8s.io/kubernetes/pkg/runtime"
	"k8s.io/kubernetes/pkg/util/yaml"
)
type KubeResource struct {
	Kind string
	Data []byte
}
func ParseDocs(reader io.Reader) ([]KubeResource, error) {
	resources := []KubeResource{}
	decoder := yaml.NewYAMLOrJSONDecoder(reader, 4096)
	for {
		rawExtension := runtime.RawExtension{}
		err := decoder.Decode(&rawExtension)
		if err == io.EOF {
			break
		} else if err != nil {
			return resources, err
		}
		kind, err := getResourceKind(rawExtension.Raw)
		if err != nil {
			return resources, err
		}
		resources = append(resources, KubeResource{
			Kind: kind,
			Data: rawExtension.Raw,
		})
	}
	return resources, nil
}