func (d *Deployment) Add(obj KubeObject) error {
	if d.objects == nil {
		d.objects = make(map[string]KubeObject, 1)
	}
	path, err := ObjectPath(obj)
	if err != nil {
		return fmt.Errorf("could not add object: %v", err)
	}
	if _, exists := d.objects[path]; exists {
		return ErrorConflict
	}
	copy, err := deepCopy(obj)
	if err != nil {
		return err
	}
	d.objects[path] = copy
	return nil
}
Add inserts an object into a deployment. The object must be a valid Kubernetes object or it will fail.
There can only be a single object of the same name, namespace, and type. Objects are deep-copied into the Deployment.
package deploy
import (
	"encoding/json"
	"errors"
	"fmt"
	"github.com/pmezard/go-difflib/difflib"
	kube "k8s.io/kubernetes/pkg/api"
	pb "rsprd.com/spread/pkg/spreadproto"
)
func DeploymentFromDocMap(docs map[string]*pb.Document) (deploy *Deployment, err error) {
	var obj KubeObject
	deploy = new(Deployment)
	for path, doc := range docs {
		doc.GetInfo().Path = path
		obj, err = KubeObjectFromDocument(path, doc)
		if err != nil {
			return
		}
		err = deploy.Add(obj)
		if err != nil {
			return
		}
	}
	return
}
type Deployment struct {
	objects map[string]KubeObject
}