Use container name to detect runner container in Pod
This commit is contained in:
parent
debf53c640
commit
ee7484ac91
|
|
@ -18,6 +18,7 @@ package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -64,9 +65,19 @@ func (r *RunnerPodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
||||||
return ctrl.Result{}, nil
|
return ctrl.Result{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var envvars []corev1.EnvVar
|
||||||
|
for _, container := range runnerPod.Spec.Containers {
|
||||||
|
if container.Name == "runner" {
|
||||||
|
envvars = container.Env
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(envvars) == 0 {
|
||||||
|
return ctrl.Result{}, errors.New("Could not determine env vars for runner Pod")
|
||||||
|
}
|
||||||
|
|
||||||
var enterprise, org, repo string
|
var enterprise, org, repo string
|
||||||
|
|
||||||
envvars := runnerPod.Spec.Containers[0].Env
|
|
||||||
for _, e := range envvars {
|
for _, e := range envvars {
|
||||||
switch e.Name {
|
switch e.Name {
|
||||||
case EnvVarEnterprise:
|
case EnvVarEnterprise:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue