checkpoint
parent
175a16cfce
commit
cb456883ec
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/derailed/k9s/internal/client"
|
"github.com/derailed/k9s/internal/client"
|
||||||
|
"github.com/derailed/k9s/internal/config"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
|
@ -193,14 +193,14 @@ func k9sShellPodName() string {
|
||||||
return fmt.Sprintf("%s-%d", k9sShell, os.Getpid())
|
return fmt.Sprintf("%s-%d", k9sShell, os.Getpid())
|
||||||
}
|
}
|
||||||
|
|
||||||
func k9sShellPod(node, image string) v1.Pod {
|
func k9sShellPod(node string, cfg *config.ShellPod) v1.Pod {
|
||||||
var grace int64
|
var grace int64
|
||||||
var priv bool = true
|
var priv bool = true
|
||||||
|
|
||||||
return v1.Pod{
|
return v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: k9sShellPodName(),
|
Name: k9sShellPodName(),
|
||||||
Namespace: k9sShellNS,
|
Namespace: cfg.Namespace,
|
||||||
},
|
},
|
||||||
Spec: v1.PodSpec{
|
Spec: v1.PodSpec{
|
||||||
NodeName: node,
|
NodeName: node,
|
||||||
|
|
@ -221,7 +221,7 @@ func k9sShellPod(node, image string) v1.Pod {
|
||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: k9sShell,
|
Name: k9sShell,
|
||||||
Image: image,
|
Image: cfg.Image,
|
||||||
VolumeMounts: []v1.VolumeMount{
|
VolumeMounts: []v1.VolumeMount{
|
||||||
{
|
{
|
||||||
Name: "root-vol",
|
Name: "root-vol",
|
||||||
|
|
@ -229,12 +229,7 @@ func k9sShellPod(node, image string) v1.Pod {
|
||||||
ReadOnly: true,
|
ReadOnly: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Resources: v1.ResourceRequirements{
|
Resources: asResource(cfg.Limits),
|
||||||
Limits: v1.ResourceList{
|
|
||||||
v1.ResourceCPU: resource.MustParse("200m"),
|
|
||||||
v1.ResourceMemory: resource.MustParse("100Mi"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Stdin: true,
|
Stdin: true,
|
||||||
SecurityContext: &v1.SecurityContext{
|
SecurityContext: &v1.SecurityContext{
|
||||||
Privileged: &priv,
|
Privileged: &priv,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue