K9s/release v0.31.3 (#2460)

* allow k9s to run with errors

* fixes #2459 #2458 #2454 #2435

* v0.31.3 rel notes
mine
Fernand Galiana 2024-01-10 09:38:26 -07:00 committed by GitHub
parent 65100b05d9
commit 268def2834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 72 additions and 10 deletions

View File

@ -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}

View File

@ -0,0 +1,52 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>
# 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??)
---
<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)

View File

@ -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 {

View File

@ -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)
}

View File

@ -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.

View File

@ -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
}

View File

@ -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
}

View File

@ -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.