func (c *Pod) Deployment() (*deploy.Deployment, error) {
	deployment := deploy.Deployment{}
	kubePod, childObj, err := c.data()
	if err != nil {
		return nil, err
	}
	err = deployment.Add(kubePod)
	if err != nil {
		return nil, err
	}
	err = deployment.AddDeployment(childObj)
	if err != nil {
		return nil, err
	}
	return &deployment, nil
}
Deployment is created containing Pod with attached Containers.
package entity
import (
	"errors"
	"fmt"
	"sort"
	"rsprd.com/spread/pkg/deploy"
	"rsprd.com/spread/pkg/image"
	kube "k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/api/validation"
)
var DefaultPodSpec = kube.PodSpec{
	RestartPolicy: kube.RestartPolicyAlways,
	DNSPolicy:     kube.DNSDefault,
}
type Pod struct {
	base
	pod        *kube.Pod
	containers containers
}
func NewPod(kubePod *kube.Pod, defaults kube.ObjectMeta, source string, objects ...deploy.KubeObject) (*Pod, error) {
	if kubePod == nil {
		return nil, fmt.Errorf("cannot create Pod from nil `%s`", source)
	}
	kubePod, err := copyPod(kubePod)
	if err != nil {
		return nil, err
	}
	base, err := newBase(EntityPod, defaults, source, objects)
	if err != nil {
		return nil, fmt.Errorf("could not create Pod from `%s`: %v", source, err)
	}
	pod := Pod{base: base}
	for _, v := range kubePod.Spec.Containers {
		container, err := NewContainer(v, defaults, source)
		if err != nil {
			return nil, err
		}
		pod.containers = append(pod.containers, container)
	}
	kubePod.Spec.Containers = []kube.Container{}
	base.setDefaults(kubePod)
	if err := validatePod(kubePod, true); err != nil {
		return nil, fmt.Errorf("could not create Pod from `%s`: %v", source, err)
	}
	sort.Sort(pod.containers)
	pod.pod = kubePod
	return &pod, nil
}
func NewPodFromPodSpec(meta kube.ObjectMeta, podSpec kube.PodSpec, defaults kube.ObjectMeta, source string, objects ...deploy.KubeObject) (*Pod, error) {
	pod := kube.Pod{
		ObjectMeta: meta,
		Spec:       podSpec,
	}
	return NewPod(&pod, defaults, source, objects...)
}
func NewDefaultPod(meta kube.ObjectMeta, source string, objects ...deploy.KubeObject) (*Pod, error) {
	return NewPodFromPodSpec(meta, DefaultPodSpec, kube.ObjectMeta{}, source, objects...)
}