| 149 | } |
| 150 | |
| 151 | func (c *Pod) data() (pod *kube.Pod, objects deploy.Deployment, err error) { |
| 152 | containers := []kube.Container{} |
| 153 | for _, container := range c.containers { |
| 154 | kubeContainer, cObj, err := container.data() |
| 155 | if err != nil { |
| 156 | return nil, objects, err |
| 157 | } |
| 158 | containers = append(containers, kubeContainer) |
| 159 | // add containers objects |
| 160 | objects.AddDeployment(cObj) |
| 161 | } |
| 162 | |
| 163 | if len(containers) == 0 { |
| 164 | return nil, objects, ErrMissingContainer |
| 165 | } |
| 166 | |
| 167 | // add own objects |
| 168 | objects.AddDeployment(c.objects) |
| 169 | |
| 170 | pod, err = copyPod(c.pod) |
| 171 | if err != nil { |
| 172 | return nil, objects, err |
| 173 | } |
| 174 | |
| 175 | pod.Spec.Containers = containers |
| 176 | return pod, objects, nil |
| 177 | } |
| 178 | |
| 179 | // containers implements sort.Interface |
| 180 | type containers []*Container |