mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-03 17:56:17 +00:00
Merge pull request #15 from StrongMonkey/add-registry
Add ability to support registryOverride
This commit is contained in:
commit
2c645b3680
@ -122,6 +122,7 @@ type PodOptions struct {
|
|||||||
ConfigMapsToCreate []*v1.ConfigMap
|
ConfigMapsToCreate []*v1.ConfigMap
|
||||||
SecretsToCreate []*v1.Secret
|
SecretsToCreate []*v1.Secret
|
||||||
Wait bool
|
Wait bool
|
||||||
|
ImageOverride string
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePod will create a pod with a service account that impersonates as user. Corresponding
|
// CreatePod will create a pod with a service account that impersonates as user. Corresponding
|
||||||
@ -338,7 +339,7 @@ func (s *PodImpersonation) createPod(ctx context.Context, user user.Info, role *
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pod = s.augmentPod(pod, sa)
|
pod = s.augmentPod(pod, sa, podOptions.ImageOverride)
|
||||||
|
|
||||||
if err := s.createConfigMaps(ctx, user, role, pod, podOptions, client); err != nil {
|
if err := s.createConfigMaps(ctx, user, role, pod, podOptions, client); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -488,7 +489,7 @@ func (s *PodImpersonation) adminKubeConfig(user user.Info, role *rbacv1.ClusterR
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PodImpersonation) augmentPod(pod *v1.Pod, sa *v1.ServiceAccount) *v1.Pod {
|
func (s *PodImpersonation) augmentPod(pod *v1.Pod, sa *v1.ServiceAccount, imageOverride string) *v1.Pod {
|
||||||
var (
|
var (
|
||||||
zero = int64(0)
|
zero = int64(0)
|
||||||
t = true
|
t = true
|
||||||
@ -547,9 +548,14 @@ func (s *PodImpersonation) augmentPod(pod *v1.Pod, sa *v1.ServiceAccount) *v1.Po
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image := imageOverride
|
||||||
|
if image == "" {
|
||||||
|
image = s.imageName()
|
||||||
|
}
|
||||||
|
|
||||||
pod.Spec.Containers = append(pod.Spec.Containers, v1.Container{
|
pod.Spec.Containers = append(pod.Spec.Containers, v1.Container{
|
||||||
Name: "proxy",
|
Name: "proxy",
|
||||||
Image: s.imageName(),
|
Image: image,
|
||||||
ImagePullPolicy: v1.PullIfNotPresent,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
Env: []v1.EnvVar{
|
Env: []v1.EnvVar{
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,7 @@ type Server struct {
|
|||||||
BaseSchemas *types.APISchemas
|
BaseSchemas *types.APISchemas
|
||||||
AccessSetLookup accesscontrol.AccessSetLookup
|
AccessSetLookup accesscontrol.AccessSetLookup
|
||||||
APIServer *apiserver.Server
|
APIServer *apiserver.Server
|
||||||
|
ClusterRegistry string
|
||||||
|
|
||||||
authMiddleware auth.Middleware
|
authMiddleware auth.Middleware
|
||||||
controllers *Controllers
|
controllers *Controllers
|
||||||
@ -57,6 +58,7 @@ type Options struct {
|
|||||||
Router router.RouterFunc
|
Router router.RouterFunc
|
||||||
AggregationSecretNamespace string
|
AggregationSecretNamespace string
|
||||||
AggregationSecretName string
|
AggregationSecretName string
|
||||||
|
ClusterRegistry string
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(ctx context.Context, restConfig *rest.Config, opts *Options) (*Server, error) {
|
func New(ctx context.Context, restConfig *rest.Config, opts *Options) (*Server, error) {
|
||||||
@ -74,6 +76,7 @@ func New(ctx context.Context, restConfig *rest.Config, opts *Options) (*Server,
|
|||||||
router: opts.Router,
|
router: opts.Router,
|
||||||
aggregationSecretNamespace: opts.AggregationSecretNamespace,
|
aggregationSecretNamespace: opts.AggregationSecretNamespace,
|
||||||
aggregationSecretName: opts.AggregationSecretName,
|
aggregationSecretName: opts.AggregationSecretName,
|
||||||
|
ClusterRegistry: opts.ClusterRegistry,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := setup(ctx, server); err != nil {
|
if err := setup(ctx, server); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user