Add labels configuration to Shell node pod (#1847)

* Add labels config to shell node pod spec

* Add labels to config tests
mine
Ruben Rodriguez 2022-12-03 20:42:56 +01:00 committed by GitHub
parent 82fecb9804
commit ff4bfe1162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -315,6 +315,7 @@ var expectedConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
fred:
namespace:
@ -338,6 +339,7 @@ var expectedConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
minikube:
namespace:
@ -361,6 +363,7 @@ var expectedConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
thresholds:
cpu:
@ -411,6 +414,7 @@ var resetConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
thresholds:
cpu:

View File

@ -12,11 +12,12 @@ 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"`
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"`
}
// NewShellPod returns a new instance.

View File

@ -331,6 +331,7 @@ func k9sShellPod(node string, cfg *config.ShellPod) v1.Pod {
ObjectMeta: metav1.ObjectMeta{
Name: k9sShellPodName(),
Namespace: cfg.Namespace,
Labels: cfg.Labels,
},
Spec: v1.PodSpec{
NodeName: node,