MCPcopy Index your code
hub / github.com/cortexlabs/cortex / TaskContainers

Function TaskContainers

pkg/workloads/k8s.go:252–279  ·  view source on GitHub ↗
(api spec.API, job *spec.JobKey)

Source from the content-addressed store, hash-verified

250}
251
252func TaskContainers(api spec.API, job *spec.JobKey) ([]kcore.Container, []kcore.Volume) {
253 containers, volumes := userPodContainers(api)
254 k8sName := job.K8sName()
255
256 volumes = append(volumes,
257 KubexitVolume(),
258 APIConfigVolume(k8sName),
259 )
260
261 containerNames := userconfig.GetContainerNames(api.Pod.Containers)
262 for i, c := range containers {
263 containers[i].VolumeMounts = append(containers[i].VolumeMounts,
264 KubexitMount(),
265 APIConfigMount(k8sName),
266 )
267
268 containerDeathDependencies := containerNames.Copy()
269 containerDeathDependencies.Remove(c.Name)
270 containerDeathEnvVars := getKubexitEnvVars(c.Name, containerDeathDependencies.SliceSorted(), nil)
271 containers[i].Env = append(containers[i].Env, containerDeathEnvVars...)
272
273 if c.Command[0] != "/cortex/kubexit" {
274 containers[i].Command = append([]string{"/cortex/kubexit"}, c.Command...)
275 }
276 }
277
278 return containers, volumes
279}
280
281func BatchContainers(api spec.API, job *spec.BatchJob) ([]kcore.Container, []kcore.Volume) {
282 userContainers, userVolumes := userPodContainers(api)

Callers 1

k8sJobSpecFunction · 0.92

Calls 11

GetContainerNamesFunction · 0.92
userPodContainersFunction · 0.85
KubexitVolumeFunction · 0.85
APIConfigVolumeFunction · 0.85
KubexitMountFunction · 0.85
APIConfigMountFunction · 0.85
getKubexitEnvVarsFunction · 0.85
K8sNameMethod · 0.80
CopyMethod · 0.45
RemoveMethod · 0.45
SliceSortedMethod · 0.45

Tested by

no test coverage detected