Skip to content

Commit

Permalink
Add labels configuration to Shell node pod (#1847)
Browse files Browse the repository at this point in the history
* Add labels config to shell node pod spec

* Add labels to config tests
  • Loading branch information
ruben-rodriguez committed Dec 3, 2022
1 parent 82fecb9 commit ff4bfe1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions internal/config/config_test.go
Expand Up @@ -315,6 +315,7 @@ var expectedConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
fred:
namespace:
Expand All @@ -338,6 +339,7 @@ var expectedConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
minikube:
namespace:
Expand All @@ -361,6 +363,7 @@ var expectedConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
thresholds:
cpu:
Expand Down Expand Up @@ -411,6 +414,7 @@ var resetConfig = `k9s:
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
thresholds:
cpu:
Expand Down
11 changes: 6 additions & 5 deletions internal/config/shell_pod.go
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions internal/view/exec.go
Expand Up @@ -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,
Expand Down

0 comments on commit ff4bfe1

Please sign in to comment.