MCPcopy
hub / github.com/redspread/spread / data

Method data

pkg/entity/pod.go:151–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149}
150
151func (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
180type containers []*Container

Callers 4

DeploymentMethod · 0.95
TestPodNoContainersFunction · 0.95
TestPodNoImageFunction · 0.95

Calls 2

copyPodFunction · 0.85
AddDeploymentMethod · 0.80

Tested by 3

TestPodNoContainersFunction · 0.76
TestPodNoImageFunction · 0.76