diff --git a/README.md b/README.md index b3c0ad13..3e78f7b8 100644 --- a/README.md +++ b/README.md @@ -385,6 +385,11 @@ K9s uses aliases to navigate most K8s resources. image: killerAdmin # The namespace to launch to shell pod into. namespace: fred + # imagePullPolicy defaults to Always + imagePullPolicy: Always + # imagePullSecrets defaults to no secret + imagePullSecrets: + - name: my-regcred # The resource limit to set on the shell pod. limits: cpu: 100m @@ -429,6 +434,12 @@ k9s: shellPod: image: cool_kid_admin:42 namespace: blee + # imagePullPolicy defaults to Always + imagePullPolicy: Always + # imagePullSecrets defaults to no secret + imagePullSecrets: + - name: my-regcred + # The resource limit to set on the shell pod. limits: cpu: 100m memory: 100Mi diff --git a/internal/config/shell_pod.go b/internal/config/shell_pod.go index f1e21692..f4efe0bb 100644 --- a/internal/config/shell_pod.go +++ b/internal/config/shell_pod.go @@ -15,12 +15,14 @@ type Limits map[v1.ResourceName]string // ShellPod represents k9s shell configuration. type ShellPod struct { - Image string `json:"image"` - Command []string `json:"command,omitempty"` - Args []string `json:"args,omitempty"` - Namespace string `json:"namespace"` - Limits Limits `json:"resources,omitempty"` - Labels map[string]string `json:"labels,omitempty"` + Image string `json:"image"` + ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"` + ImagePullPolicy v1.PullPolicy `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"` + Command []string `json:"command,omitempty"` + Args []string `json:"args,omitempty"` + Namespace string `json:"namespace"` + Limits Limits `json:"resources,omitempty"` + Labels map[string]string `json:"labels,omitempty"` } // NewShellPod returns a new instance. diff --git a/internal/view/exec.go b/internal/view/exec.go index 691afc8a..2a74dd1e 100644 --- a/internal/view/exec.go +++ b/internal/view/exec.go @@ -360,8 +360,9 @@ func k9sShellPod(node string, cfg *config.ShellPod) *v1.Pod { log.Debug().Msgf("Shell Config %#v", cfg) c := v1.Container{ - Name: k9sShell, - Image: cfg.Image, + Name: k9sShell, + Image: cfg.Image, + ImagePullPolicy: cfg.ImagePullPolicy, VolumeMounts: []v1.VolumeMount{ { Name: "root-vol", @@ -393,6 +394,7 @@ func k9sShellPod(node string, cfg *config.ShellPod) *v1.Pod { RestartPolicy: v1.RestartPolicyNever, HostPID: true, HostNetwork: true, + ImagePullSecrets: cfg.ImagePullSecrets, TerminationGracePeriodSeconds: &grace, Volumes: []v1.Volume{ {