(api spec.API, job *spec.JobKey)
| 250 | } |
| 251 | |
| 252 | func 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 | |
| 281 | func BatchContainers(api spec.API, job *spec.BatchJob) ([]kcore.Container, []kcore.Volume) { |
| 282 | userContainers, userVolumes := userPodContainers(api) |
no test coverage detected