k9s: fix config files not generated correctly & improve options (#7262)

This commit is contained in:
Josef Hofer 2025-06-23 05:55:09 +02:00 committed by GitHub
parent 6fa01d524b
commit 520fc4b50a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 144 additions and 101 deletions

View file

@ -16,11 +16,60 @@
};
};
};
hotkey = {
shift-0 = {
shortCut = "Shift-0";
description = "Viewing pods";
command = "pods";
};
};
plugin = {
fred = {
shortCut = "Ctrl-L";
description = "Pod logs";
scopes = [ "po" ];
command = "kubectl";
background = false;
args = [
"logs"
"-f"
"$NAME"
"-n"
"$NAMESPACE"
"--context"
"$CLUSTER"
];
};
};
views = {
k9s.views = {
"v1/services" = {
columns = [
"NAME"
"TYPE"
];
};
};
"v1/pods" = {
columns = [
"AGE"
"NAMESPACE"
"NAME"
"IP"
"NODE"
"STATUS"
"READY"
];
};
};
};
test.asserts.warnings.enable = true;
test.asserts.warnings.expected = [
"The option `programs.k9s.plugin' defined in ${lib.showFiles options.programs.k9s.plugin.files} has been renamed to `programs.k9s.plugins'."
"The option `programs.k9s.hotkey' defined in ${lib.showFiles options.programs.k9s.hotkey.files} has been renamed to `programs.k9s.hotKeys'."
"The option `programs.k9s.skin' defined in ${lib.showFiles options.programs.k9s.skin.files} has been renamed to `programs.k9s.skins.skin'."
"Nested 'k9s.views' structure in programs.k9s.views is deprecated, move the contents directly under programs.k9s.views"
];
nmt.script = ''
assertFileExists home-files/.config/k9s/skins/skin.yaml

View file

@ -1,2 +1,2 @@
alias:
aliases:
pp: v1/pods

View file

@ -1,4 +1,4 @@
hotKey:
hotKeys:
shift-0:
command: pods
description: Viewing pods

View file

@ -21,13 +21,11 @@
ui.skin = "default";
};
};
hotkey = {
hotKey = {
shift-0 = {
shortCut = "Shift-0";
description = "Viewing pods";
command = "pods";
};
hotKeys = {
shift-0 = {
shortCut = "Shift-0";
description = "Viewing pods";
command = "pods";
};
};
skins = {
@ -60,45 +58,37 @@
};
};
aliases = {
alias = {
pp = "v1/pods";
};
pp = "v1/pods";
};
plugin = {
plugin = {
fred = {
shortCut = "Ctrl-L";
description = "Pod logs";
scopes = [ "po" ];
command = "kubectl";
background = false;
args = [
"logs"
"-f"
"$NAME"
"-n"
"$NAMESPACE"
"--context"
"$CLUSTER"
];
};
plugins = {
fred = {
shortCut = "Ctrl-L";
description = "Pod logs";
scopes = [ "po" ];
command = "kubectl";
background = false;
args = [
"logs"
"-f"
"$NAME"
"-n"
"$NAMESPACE"
"--context"
"$CLUSTER"
];
};
};
views = {
k9s = {
views = {
"v1/pods" = {
columns = [
"AGE"
"NAMESPACE"
"NAME"
"IP"
"NODE"
"STATUS"
"READY"
];
};
};
"v1/pods" = {
columns = [
"AGE"
"NAMESPACE"
"NAME"
"IP"
"NODE"
"STATUS"
"READY"
];
};
};
};
@ -124,18 +114,16 @@
assertFileContent \
"home-files/${configDir}/skins/alt-skin.yaml" \
${./example-skin-expected-alt.yaml}
assertFileExists "home-files/${configDir}/hotkeys.yaml"
assertFileContent \
"home-files/${configDir}/hotkeys.yaml" \
${./example-hotkey-expected.yaml}
${./example-hotkeys-expected.yaml}
assertFileExists "home-files/${configDir}/aliases.yaml"
assertFileContent \
"home-files/${configDir}/aliases.yaml" \
${./example-aliases-expected.yaml}
assertFileExists "home-files/${configDir}/plugins.yaml"
assertFileContent \
"home-files/${configDir}/plugins.yaml" \
${./example-plugin-expected.yaml}
${./example-plugins-expected.yaml}
assertFileExists "home-files/${configDir}/views.yaml"
assertFileContent \
"home-files/${configDir}/views.yaml" \

View file

@ -1,11 +1,10 @@
k9s:
views:
v1/pods:
columns:
- AGE
- NAMESPACE
- NAME
- IP
- NODE
- STATUS
- READY
views:
v1/pods:
columns:
- AGE
- NAMESPACE
- NAME
- IP
- NODE
- STATUS
- READY