Skip to content

Commit

Permalink
K9s/release v0.31.7 (#2491)
Browse files Browse the repository at this point in the history
* fix #2488

* rel v0.31.7
  • Loading branch information
derailed authored Jan 18, 2024
1 parent a543f47 commit ecb2536
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.6
VERSION ?= v0.31.7
IMG_NAME := derailed/k9s
IMAGE := ${IMG_NAME}:${VERSION}

Expand Down
49 changes: 49 additions & 0 deletions change_logs/release_v0.31.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

# Release v0.31.7

## 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!

😱 More 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!` or `me to!` doesn't really cut it for us to zero in ;(
Everyone has slightly different settings/platforms so every little bits of info helps with the resolves even if seemingly irrelevant.

---

## 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

* [#2488](https://github.com/derailed/k9s/issues/2488) linux_amd64 "--kubeconfig" not working on v0.31.6

---

<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)
23 changes: 10 additions & 13 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,25 +357,20 @@ type (
)

func initK8sFlagCompletion() {
conn := client.NewConfig(k8sFlags)
cfg, err := conn.RawConfig()
if err != nil {
log.Error().Err(err).Msgf("k8s config getter failed")
}

_ = rootCmd.RegisterFlagCompletionFunc("context", k8sFlagCompletion(&cfg, func(cfg *api.Config) map[string]*api.Context {
_ = rootCmd.RegisterFlagCompletionFunc("context", k8sFlagCompletion(func(cfg *api.Config) map[string]*api.Context {
return cfg.Contexts
}))

_ = rootCmd.RegisterFlagCompletionFunc("cluster", k8sFlagCompletion(&cfg, func(cfg *api.Config) map[string]*api.Cluster {
_ = rootCmd.RegisterFlagCompletionFunc("cluster", k8sFlagCompletion(func(cfg *api.Config) map[string]*api.Cluster {
return cfg.Clusters
}))

_ = rootCmd.RegisterFlagCompletionFunc("user", k8sFlagCompletion(&cfg, func(cfg *api.Config) map[string]*api.AuthInfo {
_ = rootCmd.RegisterFlagCompletionFunc("user", k8sFlagCompletion(func(cfg *api.Config) map[string]*api.AuthInfo {
return cfg.AuthInfos
}))

_ = rootCmd.RegisterFlagCompletionFunc("namespace", func(cmd *cobra.Command, args []string, s string) ([]string, cobra.ShellCompDirective) {
conn := client.NewConfig(k8sFlags)
if c, err := client.InitConnection(conn); err == nil {
if nss, err := c.ValidNamespaceNames(); err == nil {
return filterFlagCompletions(nss, s)
Expand All @@ -386,13 +381,15 @@ func initK8sFlagCompletion() {
})
}

func k8sFlagCompletion[T any](cfg *api.Config, picker k8sPickerFn[T]) completeFn {
func k8sFlagCompletion[T any](picker k8sPickerFn[T]) completeFn {
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if cfg == nil {
return nil, cobra.ShellCompDirectiveError
conn := client.NewConfig(k8sFlags)
cfg, err := conn.RawConfig()
if err != nil {
log.Error().Err(err).Msgf("k8s config getter failed")
}

return filterFlagCompletions(picker(cfg), toComplete)
return filterFlagCompletions(picker(&cfg), toComplete)
}
}

Expand Down
7 changes: 3 additions & 4 deletions internal/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ const (
// Config tracks a kubernetes configuration.
type Config struct {
flags *genericclioptions.ConfigFlags
mutex *sync.RWMutex
mx sync.RWMutex
}

// NewConfig returns a new k8s config or an error if the flags are invalid.
func NewConfig(f *genericclioptions.ConfigFlags) *Config {
return &Config{
flags: f,
mutex: &sync.RWMutex{},
}
}

Expand Down Expand Up @@ -299,8 +298,8 @@ func (c *Config) CurrentNamespaceName() (string, error) {

// ConfigAccess return the current kubeconfig api server access configuration.
func (c *Config) ConfigAccess() (clientcmd.ConfigAccess, error) {
c.mutex.RLock()
defer c.mutex.RUnlock()
c.mx.RLock()
defer c.mx.RUnlock()

return c.clientConfig().ConfigAccess(), nil
}
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: k9s
base: core20
version: 'v0.31.6'
version: 'v0.31.7'
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.
Expand Down

0 comments on commit ecb2536

Please sign in to comment.