1
0
mirror of https://github.com/rancher/steve.git synced 2025-08-10 02:37:17 +00:00

Make podimpersonation image configurable

This commit is contained in:
Darren Shepherd 2020-09-10 23:56:18 -07:00
parent e106b9e16b
commit cfede8c002

View File

@ -5,10 +5,9 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/rancher/wrangler/pkg/randomtoken"
"github.com/rancher/steve/pkg/stores/proxy" "github.com/rancher/steve/pkg/stores/proxy"
"github.com/rancher/wrangler/pkg/condition" "github.com/rancher/wrangler/pkg/condition"
"github.com/rancher/wrangler/pkg/randomtoken"
"github.com/rancher/wrangler/pkg/schemas/validation" "github.com/rancher/wrangler/pkg/schemas/validation"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
@ -35,13 +34,15 @@ type PodImpersonation struct {
roleTimeout time.Duration roleTimeout time.Duration
cg proxy.ClientGetter cg proxy.ClientGetter
key string key string
imageName func() string
} }
func New(key string, cg proxy.ClientGetter, roleTimeout time.Duration) *PodImpersonation { func New(key string, cg proxy.ClientGetter, roleTimeout time.Duration, imageName func() string) *PodImpersonation {
return &PodImpersonation{ return &PodImpersonation{
roleTimeout: roleTimeout, roleTimeout: roleTimeout,
cg: cg, cg: cg,
key: key, key: key,
imageName: imageName,
} }
} }
@ -510,7 +511,7 @@ func (s *PodImpersonation) augmentPod(pod *v1.Pod, sa *v1.ServiceAccount) *v1.Po
pod.Spec.Containers = append(pod.Spec.Containers, v1.Container{ pod.Spec.Containers = append(pod.Spec.Containers, v1.Container{
Name: "proxy", Name: "proxy",
Image: "ibuildthecloud/shell:v0.0.10", Image: s.imageName(),
ImagePullPolicy: v1.PullIfNotPresent, ImagePullPolicy: v1.PullIfNotPresent,
Env: []v1.EnvVar{ Env: []v1.EnvVar{
{ {