Inject Env Vars into Runner defined Container Spec (#127)

The runner token is now injected into the `runner` container defined within Runner.Spec.Containers[]
This commit is contained in:
Brendan Galloway 2020-10-20 01:43:53 +02:00 committed by GitHub
parent c4074130e8
commit 7d0bfb77e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -382,6 +382,11 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
if len(runner.Spec.Containers) != 0 {
pod.Spec.Containers = runner.Spec.Containers
for i := 0; i < len(pod.Spec.Containers); i++ {
if pod.Spec.Containers[i].Name == containerName {
pod.Spec.Containers[i].Env = append(pod.Spec.Containers[i].Env, env...)
}
}
}
if len(runner.Spec.VolumeMounts) != 0 {