Skip to content

Commit 268def2

Browse files
authored
K9s/release v0.31.3 (#2460)
* allow k9s to run with errors * fixes #2459 #2458 #2454 #2435 * v0.31.3 rel notes
1 parent 65100b0 commit 268def2

File tree

8 files changed

+72
-10
lines changed

8 files changed

+72
-10
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DATE ?= $(shell TZ=UTC date -j -f "%s" ${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:
1111
else
1212
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
1313
endif
14-
VERSION ?= v0.31.2
14+
VERSION ?= v0.31.3
1515
IMG_NAME := derailed/k9s
1616
IMAGE := ${IMG_NAME}:${VERSION}
1717

change_logs/release_v0.31.3.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>
2+
3+
# Release v0.31.3
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 corps with deep pockets, thus if you feel K9s is helping your Kubernetes journey,
16+
please consider joining our [sponsorship program](https://github.com/sponsors/derailed) and/or make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
17+
18+
On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)
19+
20+
## Maintenance Release!
21+
22+
The aftermath...
23+
24+
Thank you all for pitching in and helping flesh out issues!!
25+
26+
Please make sure to add gory details to issues ie relevant configs, debug logs, etc...
27+
28+
Comments like: `same here!` doesn't really help us zero in. Everyone has slightly different settings/platforms so every little bits of info helps with the resolves.
29+
Thank you!!
30+
31+
---
32+
33+
## Videos Are In The Can!
34+
35+
Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...
36+
37+
* [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
38+
* [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
39+
* [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)
40+
41+
---
42+
43+
## Resolved Issues
44+
45+
* [#2459](https://github.com/derailed/k9s/issues/2459) No permission to see deployments/statefulsets even though I have them
46+
* [#2458](https://github.com/derailed/k9s/issues/2458) panic on run without current context
47+
* [#2454](https://github.com/derailed/k9s/issues/2454) Invoking K9s ends in panic question
48+
* [#2435](https://github.com/derailed/k9s/issues/2435) "yaml: line 15: could not find expected ':'" error bug question (May be??)
49+
50+
---
51+
52+
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

cmd/root.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func run(cmd *cobra.Command, args []string) error {
9393

9494
cfg, err := loadConfiguration()
9595
if err != nil {
96-
return err
96+
log.Error().Err(err).Msgf("Fail to load global/context configuration")
9797
}
9898
app := view.NewApp(cfg)
9999
if err := app.Init(version, *k9sFlags.RefreshRate); err != nil {

internal/config/alias.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,6 @@ func (a *Aliases) SaveAliases(path string) error {
190190
if err != nil {
191191
return err
192192
}
193-
return os.WriteFile(path, cfg, 0644)
193+
194+
return os.WriteFile(path, cfg, data.DefaultFileMod)
194195
}

internal/config/config.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (c *Config) Refine(flags *genericclioptions.ConfigFlags, k9sFlags *Flags, c
7777
}
7878
_, err = c.K9s.ActivateContext(n)
7979
if err != nil {
80-
return fmt.Errorf("unable to activate context %q: %w", *flags.Context, err)
80+
return fmt.Errorf("unable to activate context %q: %w", n, err)
8181
}
8282
}
8383
log.Debug().Msgf("Active Context %q", c.K9s.ActiveContextName())
@@ -149,6 +149,10 @@ func (c *Config) FavNamespaces() []string {
149149

150150
// SetActiveNamespace set the active namespace in the current context.
151151
func (c *Config) SetActiveNamespace(ns string) error {
152+
if ns == client.NotNamespaced {
153+
log.Debug().Msgf("[SetNS] No namespace given. skipping!")
154+
return nil
155+
}
152156
ct, err := c.K9s.ActiveContext()
153157
if err != nil {
154158
return err
@@ -251,7 +255,7 @@ func (c *Config) SaveFile(path string) error {
251255
return err
252256
}
253257

254-
return os.WriteFile(path, cfg, 0644)
258+
return os.WriteFile(path, cfg, data.DefaultFileMod)
255259
}
256260

257261
// Validate the configuration.

internal/config/data/config.go

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"os"
10+
"sync"
1011

1112
"github.com/derailed/k9s/internal/client"
1213
"gopkg.in/yaml.v2"
@@ -16,6 +17,7 @@ import (
1617
// Config tracks a context configuration.
1718
type Config struct {
1819
Context *Context `yaml:"k9s"`
20+
mx sync.RWMutex
1921
}
2022

2123
// NewConfig returns a new config.
@@ -27,6 +29,9 @@ func NewConfig(ct *api.Context) *Config {
2729

2830
// Validate ensures config is in norms.
2931
func (c *Config) Validate(conn client.Connection, ks KubeSettings) {
32+
c.mx.Lock()
33+
defer c.mx.Unlock()
34+
3035
if c.Context == nil {
3136
c.Context = NewContext()
3237
}
@@ -42,6 +47,9 @@ func (c *Config) Dump(w io.Writer) {
4247

4348
// Save saves the config to disk.
4449
func (c *Config) Save(path string) error {
50+
c.mx.RLock()
51+
defer c.mx.RUnlock()
52+
4553
if err := EnsureDirPath(path, DefaultDirMod); err != nil {
4654
return err
4755
}

internal/config/k9s.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,12 @@ func (k *K9s) ActivateContext(n string) (*data.Context, error) {
191191
// If the context specifies a namespace, use it!
192192
if ns := ct.Namespace; ns != client.BlankNamespace {
193193
k.activeConfig.Context.Namespace.Active = ns
194-
} else {
194+
} else if k.activeConfig.Context.Namespace.Active == "" {
195195
k.activeConfig.Context.Namespace.Active = client.DefaultNamespace
196196
}
197197
if k.activeConfig.Context == nil {
198198
return nil, fmt.Errorf("context activation failed for: %s", n)
199199
}
200-
if k.activeConfig.Context == nil {
201-
return nil, fmt.Errorf("context activation failed for: %s", n)
202-
}
203200

204201
return k.activeConfig.Context, nil
205202
}

snap/snapcraft.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: k9s
22
base: core20
3-
version: 'v0.31.2'
3+
version: 'v0.31.3'
44
summary: K9s is a CLI to view and manage your Kubernetes clusters.
55
description: |
66
K9s is a CLI to view and manage your Kubernetes clusters. By leveraging a terminal UI, you can easily traverse Kubernetes resources and view the state of your clusters in a single powerful session.

0 commit comments

Comments
 (0)