diff --git a/Makefile b/Makefile
index 74fffb26..15447574 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ DATE ?= $(shell TZ=UTC date -j -f "%s" ${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:
else
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
endif
-VERSION ?= v0.31.2
+VERSION ?= v0.31.3
IMG_NAME := derailed/k9s
IMAGE := ${IMG_NAME}:${VERSION}
diff --git a/change_logs/release_v0.31.3.md b/change_logs/release_v0.31.3.md
new file mode 100644
index 00000000..00a37b67
--- /dev/null
+++ b/change_logs/release_v0.31.3.md
@@ -0,0 +1,52 @@
+
+
+# Release v0.31.3
+
+## Notes
+
+Thank you to all that contributed with flushing out issues and enhancements for K9s!
+I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev
+and see if we're happier with some of the fixes!
+If you've filed an issue please help me verify and close.
+
+Your support, kindness and awesome suggestions to make K9s better are, as ever, very much noted and appreciated!
+Also big thanks to all that have allocated their own time to help others on both slack and on this repo!!
+
+As you may know, K9s is not pimped out by corps with deep pockets, thus if you feel K9s is helping 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)
+
+On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)
+
+## Maintenance Release!
+
+The aftermath...
+
+Thank you all for pitching in and helping flesh out issues!!
+
+Please make sure to add gory details to issues ie relevant configs, debug logs, etc...
+
+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.
+Thank you!!
+
+---
+
+## Videos Are In The Can!
+
+Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...
+
+* [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
+* [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
+* [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)
+
+---
+
+## Resolved Issues
+
+* [#2459](https://github.com/derailed/k9s/issues/2459) No permission to see deployments/statefulsets even though I have them
+* [#2458](https://github.com/derailed/k9s/issues/2458) panic on run without current context
+* [#2454](https://github.com/derailed/k9s/issues/2454) Invoking K9s ends in panic question
+* [#2435](https://github.com/derailed/k9s/issues/2435) "yaml: line 15: could not find expected ':'" error bug question (May be??)
+
+---
+
+
© 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)
diff --git a/cmd/root.go b/cmd/root.go
index c7412fa5..e0c208b7 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -93,7 +93,7 @@ func run(cmd *cobra.Command, args []string) error {
cfg, err := loadConfiguration()
if err != nil {
- return err
+ log.Error().Err(err).Msgf("Fail to load global/context configuration")
}
app := view.NewApp(cfg)
if err := app.Init(version, *k9sFlags.RefreshRate); err != nil {
diff --git a/internal/config/alias.go b/internal/config/alias.go
index 798a0576..21cf26ba 100644
--- a/internal/config/alias.go
+++ b/internal/config/alias.go
@@ -190,5 +190,6 @@ func (a *Aliases) SaveAliases(path string) error {
if err != nil {
return err
}
- return os.WriteFile(path, cfg, 0644)
+
+ return os.WriteFile(path, cfg, data.DefaultFileMod)
}
diff --git a/internal/config/config.go b/internal/config/config.go
index ea78be80..c4d5109b 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -77,7 +77,7 @@ func (c *Config) Refine(flags *genericclioptions.ConfigFlags, k9sFlags *Flags, c
}
_, err = c.K9s.ActivateContext(n)
if err != nil {
- return fmt.Errorf("unable to activate context %q: %w", *flags.Context, err)
+ return fmt.Errorf("unable to activate context %q: %w", n, err)
}
}
log.Debug().Msgf("Active Context %q", c.K9s.ActiveContextName())
@@ -149,6 +149,10 @@ func (c *Config) FavNamespaces() []string {
// SetActiveNamespace set the active namespace in the current context.
func (c *Config) SetActiveNamespace(ns string) error {
+ if ns == client.NotNamespaced {
+ log.Debug().Msgf("[SetNS] No namespace given. skipping!")
+ return nil
+ }
ct, err := c.K9s.ActiveContext()
if err != nil {
return err
@@ -251,7 +255,7 @@ func (c *Config) SaveFile(path string) error {
return err
}
- return os.WriteFile(path, cfg, 0644)
+ return os.WriteFile(path, cfg, data.DefaultFileMod)
}
// Validate the configuration.
diff --git a/internal/config/data/config.go b/internal/config/data/config.go
index 234adc31..6b821bb1 100644
--- a/internal/config/data/config.go
+++ b/internal/config/data/config.go
@@ -7,6 +7,7 @@ import (
"fmt"
"io"
"os"
+ "sync"
"github.com/derailed/k9s/internal/client"
"gopkg.in/yaml.v2"
@@ -16,6 +17,7 @@ import (
// Config tracks a context configuration.
type Config struct {
Context *Context `yaml:"k9s"`
+ mx sync.RWMutex
}
// NewConfig returns a new config.
@@ -27,6 +29,9 @@ func NewConfig(ct *api.Context) *Config {
// Validate ensures config is in norms.
func (c *Config) Validate(conn client.Connection, ks KubeSettings) {
+ c.mx.Lock()
+ defer c.mx.Unlock()
+
if c.Context == nil {
c.Context = NewContext()
}
@@ -42,6 +47,9 @@ func (c *Config) Dump(w io.Writer) {
// Save saves the config to disk.
func (c *Config) Save(path string) error {
+ c.mx.RLock()
+ defer c.mx.RUnlock()
+
if err := EnsureDirPath(path, DefaultDirMod); err != nil {
return err
}
diff --git a/internal/config/k9s.go b/internal/config/k9s.go
index 95f52e1b..21453ce4 100644
--- a/internal/config/k9s.go
+++ b/internal/config/k9s.go
@@ -191,15 +191,12 @@ func (k *K9s) ActivateContext(n string) (*data.Context, error) {
// If the context specifies a namespace, use it!
if ns := ct.Namespace; ns != client.BlankNamespace {
k.activeConfig.Context.Namespace.Active = ns
- } else {
+ } else if k.activeConfig.Context.Namespace.Active == "" {
k.activeConfig.Context.Namespace.Active = client.DefaultNamespace
}
if k.activeConfig.Context == nil {
return nil, fmt.Errorf("context activation failed for: %s", n)
}
- if k.activeConfig.Context == nil {
- return nil, fmt.Errorf("context activation failed for: %s", n)
- }
return k.activeConfig.Context, nil
}
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 98655392..84565fe6 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,6 +1,6 @@
name: k9s
base: core20
-version: 'v0.31.2'
+version: 'v0.31.3'
summary: K9s is a CLI to view and manage your Kubernetes clusters.
description: |
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.