Skip to content

Commit 73fa008

Browse files
authored
Rel v0.50.14 (#3609)
* fix #3591 #3608 suggestions enter accept * fix#3606-xray busted * fix#3594-yaml busted * rel notes
1 parent 41acad3 commit 73fa008

File tree

12 files changed

+90
-31
lines changed

12 files changed

+90
-31
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NAME := k9s
2-
VERSION ?= v0.50.13
2+
VERSION ?= v0.50.14
33
PACKAGE := github.com/derailed/$(NAME)
44
OUTPUT_BIN ?= execs/${NAME}
55
GO_FLAGS ?=

change_logs/release_v0.50.14.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<img src="https://github.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>
2+
3+
# Release v0.50.14
4+
5+
## Notes
6+
7+
Thank you to all that contributed with flushing out issues and enhancements for K9s!
8+
I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev
9+
and see if we're happier with some of the fixes!
10+
If you've filed an issue please help me verify and close.
11+
12+
Your support, kindness and awesome suggestions to make K9s better are, as ever, very much noted and appreciated!
13+
Also big thanks to all that have allocated their own time to help others on both slack and on this repo!!
14+
15+
As you may know, K9s is not pimped out by big corporations with deep pockets, thus if you feel K9s is helping in your Kubernetes journey, please consider joining our [sponsorship program](https://github.com/sponsors/derailed) and/or make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
16+
17+
On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/zt-3360a389v-ElLHrb0Dp1kAXqYUItSAFA)
18+
19+
## Maintenance Release!
20+
21+
Sponsorships are dropping at an alarming rate which puts this project in the red. This is becoming a concern and sad not to mention unsustainable ;( If you dig `k9s` and want to help the project, please consider `paying it forward!` and don't become just another `satisfied, non paying customer!`. K9s does take a lot of my `free` time to maintain, enhance and keep the light on. Many cool ideas are making it straight to the `freezer` as I just can't budget them in.
22+
I know many of you work for big corporations, so please put in the word/work and have them help us out via sponsorships or other means.
23+
24+
Thank you!
25+
26+
## Resolved Issues
27+
28+
* [#3608](https://github.com/derailed/k9s/issues/3608) k9s crashes when :namespaces used
29+
* [#3606](https://github.com/derailed/k9s/issues/3606) Xray not working anymore on (possible) v0.50.X
30+
* [#3594](https://github.com/derailed/k9s/issues/3594) Show pod yaml - Boom!! cannot deep copy int
31+
* [#3591](https://github.com/derailed/k9s/issues/3591) Accept suggestion with enter (without having to "tab")
32+
* [#3576](https://github.com/derailed/k9s/issues/3576) Custom alias/view not working anymore since v0.50.10
33+
34+
---
35+
<img src="https://github.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2025 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)#

internal/config/alias.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (a *Aliases) Resolve(p *cmd.Interpreter) (*client.GVR, bool) {
8989
}
9090

9191
if gvr.IsK8sRes() {
92-
p.Reset(strings.Replace(p.GetLine(), p.Cmd(), gvr.String(), 1))
92+
p.Reset(strings.Replace(p.GetLine(), p.Cmd(), gvr.String(), 1), gvr.String())
9393
return gvr, true
9494
}
9595

@@ -100,7 +100,7 @@ func (a *Aliases) Resolve(p *cmd.Interpreter) (*client.GVR, bool) {
100100
return gvr, false
101101
}
102102
ap.Merge(p)
103-
p.Reset(strings.Replace(ap.GetLine(), ap.Cmd(), gvr.String(), 1))
103+
p.Reset(strings.Replace(ap.GetLine(), ap.Cmd(), gvr.String(), 1), ap.Cmd())
104104
}
105105

106106
return gvr, true

internal/dao/helpers.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,11 @@ func ToYAML(o runtime.Object, showManaged bool) (string, error) {
8686
if o == nil {
8787
return "", errors.New("no object to yamlize")
8888
}
89-
u, ok := o.(*unstructured.Unstructured)
90-
if !ok {
91-
return "", fmt.Errorf("expecting unstructured but got %T", o)
92-
}
93-
if u.Object == nil {
94-
return "", fmt.Errorf("expecting unstructured object but got nil")
95-
}
9689

9790
var p printers.ResourcePrinter = &printers.YAMLPrinter{}
91+
9892
if !showManaged {
93+
o = o.DeepCopyObject()
9994
p = &printers.OmitManagedFieldsPrinter{Delegate: p}
10095
}
10196

internal/ui/app.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ func (a *App) ActivateCmd(b bool) {
190190

191191
// GetCmd retrieves user command.
192192
func (a *App) GetCmd() string {
193+
if sugs := a.cmdBuff.Suggestions(); len(sugs) >= 1 {
194+
return a.cmdBuff.GetText() + sugs[0]
195+
}
193196
return a.cmdBuff.GetText()
194197
}
195198

internal/view/app.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,9 @@ func (a *App) toggleCrumbsCmd(evt *tcell.EventKey) *tcell.EventKey {
626626
}
627627

628628
func (a *App) gotoCmd(evt *tcell.EventKey) *tcell.EventKey {
629-
if a.CmdBuff().IsActive() && !a.CmdBuff().Empty() {
630-
a.gotoResource(a.GetCmd(), "", true, true)
629+
c := a.GetCmd()
630+
if a.CmdBuff().IsActive() && c != "" {
631+
a.gotoResource(c, "", true, true)
631632
a.ResetCmd()
632633
return nil
633634
}

internal/view/cmd/interpreter.go

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ import (
1414

1515
// Interpreter tracks user prompt input.
1616
type Interpreter struct {
17-
line string
18-
cmd string
19-
args args
17+
line string
18+
cmd string
19+
aliases []string
20+
args args
2021
}
2122

2223
// NewInterpreter returns a new instance.
23-
func NewInterpreter(s string) *Interpreter {
24+
func NewInterpreter(s string, aliases ...string) *Interpreter {
2425
c := Interpreter{
25-
line: s,
26-
args: make(args),
26+
line: s,
27+
args: make(args),
28+
aliases: aliases,
2729
}
2830
c.grok()
2931

@@ -38,11 +40,11 @@ func (c *Interpreter) ClearNS() {
3840
// SwitchNS replaces the current namespace with the provided one.
3941
func (c *Interpreter) SwitchNS(ns string) {
4042
if ons, ok := c.NSArg(); ok && ons != client.BlankNamespace {
41-
c.Reset(strings.TrimSpace(strings.Replace(c.line, " "+ons, " "+ns, 1)))
43+
c.Reset(strings.TrimSpace(strings.Replace(c.line, " "+ons, " "+ns, 1)), "")
4244
return
4345
}
4446
if ns != client.BlankNamespace {
45-
c.Reset(strings.TrimSpace(c.line) + " " + ns)
47+
c.Reset(strings.TrimSpace(c.line)+" "+ns, "")
4648
}
4749
}
4850

@@ -111,6 +113,10 @@ func (c *Interpreter) Cmd() string {
111113
return c.cmd
112114
}
113115

116+
func (c *Interpreter) Aliases() []string {
117+
return c.aliases
118+
}
119+
114120
func (c *Interpreter) Args() string {
115121
return strings.TrimSpace(strings.Replace(c.line, c.cmd, "", 1))
116122
}
@@ -134,13 +140,26 @@ func (c *Interpreter) Amend(c1 *Interpreter) {
134140
}
135141

136142
// Reset resets with new command.
137-
func (c *Interpreter) Reset(s string) *Interpreter {
138-
c.line = s
143+
func (c *Interpreter) Reset(line, alias string) *Interpreter {
144+
c.line = line
139145
c.grok()
140146

147+
if alias != "" && alias != c.cmd {
148+
c.addAlias(alias)
149+
}
150+
141151
return c
142152
}
143153

154+
func (c *Interpreter) addAlias(a string) {
155+
for _, v := range c.aliases {
156+
if v == a {
157+
return
158+
}
159+
}
160+
c.aliases = append(c.aliases, a)
161+
}
162+
144163
// GetLine returns the prompt.
145164
func (c *Interpreter) GetLine() string {
146165
return strings.TrimSpace(c.line)

internal/view/command.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (*Command) namespaceCmd(p *cmd.Interpreter) bool {
118118
}
119119

120120
if ns != "" {
121-
_ = p.Reset(client.PodGVR.String())
121+
_ = p.Reset(client.PodGVR.String(), "")
122122
p.SwitchNS(ns)
123123
}
124124

@@ -139,7 +139,7 @@ func (c *Command) xrayCmd(p *cmd.Interpreter, pushCmd bool) error {
139139
if !ok {
140140
return errors.New("invalid command. use `xray xxx`")
141141
}
142-
gvr, ok := c.alias.Resolve(p)
142+
gvr, ok := c.alias.Resolve(cmd.NewInterpreter(arg))
143143
if !ok {
144144
return fmt.Errorf("invalid resource name: %q", arg)
145145
}
@@ -240,15 +240,15 @@ func (c *Command) defaultCmd(isRoot bool) error {
240240
}
241241
p := cmd.NewInterpreter(c.app.Config.ActiveView())
242242
if p.IsBlank() {
243-
return c.run(p.Reset(defCmd), "", true, true)
243+
return c.run(p.Reset(defCmd, ""), "", true, true)
244244
}
245245

246246
if err := c.run(p, "", true, true); err != nil {
247247
slog.Error("Command exec failed. Using default command",
248248
slogs.Command, p.GetLine(),
249249
slogs.Error, err,
250250
)
251-
p = p.Reset(defCmd)
251+
p = p.Reset(defCmd, "")
252252
return c.run(p, "", true, true)
253253
}
254254

@@ -345,7 +345,7 @@ func (c *Command) exec(p *cmd.Interpreter, gvr *client.GVR, comp model.Component
345345
ci := cmd.NewInterpreter(podCmd)
346346
currentCommand, ok := c.app.cmdHistory.Top()
347347
if ok {
348-
ci = ci.Reset(currentCommand)
348+
ci = ci.Reset(currentCommand, "")
349349
}
350350
err = c.run(ci, "", true, true)
351351
}

internal/view/command_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ func Test_viewMetaFor(t *testing.T) {
4747
"custom-alias": {
4848
cmd: "pdl",
4949
gvr: client.PodGVR,
50-
p: cmd.NewInterpreter("v1/pods @fred 'app=blee' default"),
50+
p: cmd.NewInterpreter("v1/pods @fred 'app=blee' default", "pdl"),
5151
err: errors.New("blee"),
5252
},
5353

5454
"inception": {
5555
cmd: "pdal blee",
5656
gvr: client.PodGVR,
57-
p: cmd.NewInterpreter("v1/pods @fred 'app=blee' blee"),
57+
p: cmd.NewInterpreter("v1/pods @fred 'app=blee' blee", "pdal", "pod"),
5858
err: errors.New("blee"),
5959
},
6060
}

internal/view/live_view.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ func (v *LiveView) toggleManagedCmd(evt *tcell.EventKey) *tcell.EventKey {
276276
v.managedField = !v.managedField
277277
v.model.SetOptions(v.defaultCtx(), map[string]bool{model.ManagedFieldsOpts: v.managedField})
278278

279+
v.app.Flash().Info("toggled managed fields")
279280
return nil
280281
}
281282

0 commit comments

Comments
 (0)