From af8aa5fc41b3db202941a264a3011f490bede97b Mon Sep 17 00:00:00 2001 From: Fernand Galiana Date: Tue, 18 Feb 2025 08:47:33 -0700 Subject: [PATCH] Rel 0.40.5 (#3136) * update linter * fix#3131 * fix#3119 * rel v0.40.5 --- .golangci.yml | 11 ++++--- Makefile | 2 +- change_logs/release_v0.40.5.md | 54 ++++++++++++++++++++++++++++++++ internal/client/gvr.go | 9 ++++++ internal/config/alias.go | 2 +- internal/dao/alias.go | 16 +++++----- internal/render/cust_col.go | 4 ++- internal/render/cust_col_test.go | 2 ++ snap/snapcraft.yaml | 2 +- 9 files changed, 84 insertions(+), 18 deletions(-) create mode 100644 change_logs/release_v0.40.5.md diff --git a/.golangci.yml b/.golangci.yml index 6e9908fba1..052163af7c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,10 +12,6 @@ run: # include test files or not, default is true tests: true - # default is true. Enables skipping of directories: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: true - # which dirs to skip: they won't be analyzed; # can use regexp here: generated.*, regexp is applied on full path; # default value is empty list, but next dirs are always skipped independently @@ -38,7 +34,7 @@ run: # won't be reported. Default value is empty list, but there is # no need to include all autogenerated files, we confidently recognize # autogenerated files. If it's not please let us know. - skip-files: + # skip-files: # - ".*\\.my\\.go$" # - lib/bad.go @@ -83,6 +79,11 @@ linters-settings: reason: "Go 1.20+ has support for combining multiple errors, see https://go.dev/doc/go1.20#errors" issues: + + # default is true. Enables skipping of directories: + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + skip-dirs-use-default: true + # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - linters: [staticcheck] diff --git a/Makefile b/Makefile index 71f89c677d..75659c9531 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.40.4 +VERSION ?= v0.40.5 IMG_NAME := derailed/k9s IMAGE := ${IMG_NAME}:${VERSION} diff --git a/change_logs/release_v0.40.5.md b/change_logs/release_v0.40.5.md new file mode 100644 index 0000000000..c5e5b90ae0 --- /dev/null +++ b/change_logs/release_v0.40.5.md @@ -0,0 +1,54 @@ + + +# Release v0.40.5 + +## 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! + +😳 Aye! Continued Buzz kill on the 0.40.0 aftermath 🙀 👻 + +Likely additional `disturbance in the farce` might be observed. +Thank you all for giving this drop a rinse and reporting back!! 😍 + +--- + +## Videos Are In The Can! + +Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content... + +* [K9s v0.40.0 -Column Blow- Sneak peek](https://youtu.be/iy6RDozAM4A) +* [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 + +* [#3131](https://github.com/derailed/k9s/issues/3131) Singular versions of native Kubernetes resource names no longer work +* [#3119](https://github.com/derailed/k9s/issues/3119) Custom Views Fail to Load with % in Column Names (with feelings!) + +--- + +## Contributed PRs + +Please be sure to give `Big Thanks!` and `ATTA Girls/Boys!` to all the fine contributors for making K9s better for all of us!! + +* [#3123](https://github.com/derailed/k9s/pull/3123) update regex to allow '%' and '/' in column names + + + © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0) \ No newline at end of file diff --git a/internal/client/gvr.go b/internal/client/gvr.go index a4a3d18279..ebb7fffdb9 100644 --- a/internal/client/gvr.go +++ b/internal/client/gvr.go @@ -111,6 +111,15 @@ func (g GVR) GVR() schema.GroupVersionResource { } } +// GVSub returns group vervion sub path. +func (g GVR) GVSub() string { + if g.G() == "" { + return g.V() + } + + return g.G() + "/" + g.V() +} + // GR returns a full schema representation. func (g GVR) GR() *schema.GroupResource { return &schema.GroupResource{ diff --git a/internal/config/alias.go b/internal/config/alias.go index ec2b9bd1e2..f189e86e1d 100644 --- a/internal/config/alias.go +++ b/internal/config/alias.go @@ -108,7 +108,7 @@ func (a *Aliases) Define(gvr string, aliases ...string) { } for _, alias := range aliases { - if _, ok := a.Alias[alias]; !ok { + if _, ok := a.Alias[alias]; !ok && alias != "" { a.Alias[alias] = gvr } } diff --git a/internal/dao/alias.go b/internal/dao/alias.go index 3fb8b6220a..a129528632 100644 --- a/internal/dao/alias.go +++ b/internal/dao/alias.go @@ -119,13 +119,12 @@ func (a *Alias) load(path string) error { a.Define(gvrStr, gvr.AsResourceName()) // Allow single shot commands for k8s resources only! - if isStandardGroup(gvr.String()) { + if isStandardGroup(gvr.GVSub()) { a.Define(gvrStr, strings.ToLower(meta.Kind), meta.Name) - if meta.SingularName != "" { - a.Define(gvrStr, meta.SingularName) - } + a.Define(gvrStr, meta.SingularName) + } - if meta.ShortNames != nil { + if len(meta.ShortNames) > 0 { a.Define(gvrStr, meta.ShortNames...) } a.Define(gvrStr, gvrStr) @@ -138,10 +137,9 @@ func (a *Alias) load(path string) error { } gvrStr := gvr.String() a.Define(gvrStr, strings.ToLower(meta.Kind), meta.Name) - if meta.SingularName != "" { - a.Define(gvrStr, meta.SingularName) - } - if meta.ShortNames != nil { + a.Define(gvrStr, meta.SingularName) + + if len(meta.ShortNames) > 0 { a.Define(gvrStr, meta.ShortNames...) } a.Define(gvrStr, gvrStr) diff --git a/internal/render/cust_col.go b/internal/render/cust_col.go index a309f62de2..b7ceefc399 100644 --- a/internal/render/cust_col.go +++ b/internal/render/cust_col.go @@ -12,7 +12,7 @@ import ( "k8s.io/kubectl/pkg/cmd/get" ) -var fullRX = regexp.MustCompile(`\A([\w\s%\/-]+)\:?([^\|]*)\|?([T|N|W|L|R|H]{0,3})\b`) +var fullRX = regexp.MustCompile(`^([\w\s%\/-]+)\:?([\w\d\S\W]*?)\|?([N|T|W|R|L|H]{0,3})$`) type colAttr byte @@ -69,6 +69,8 @@ type colDef struct { spec string } +// TAG:.spec.containers[0].image|split(":")|.[-1]|TW + func parse(s string) (colDef, error) { mm := fullRX.FindStringSubmatch(s) if len(mm) == 4 { diff --git a/internal/render/cust_col_test.go b/internal/render/cust_col_test.go index adf316c54d..b52972436f 100644 --- a/internal/render/cust_col_test.go +++ b/internal/render/cust_col_test.go @@ -189,8 +189,10 @@ func TestCustCol_parse(t *testing.T) { e: colDef{ name: "fred", idx: -1, + spec: "{.||.metadata.name}", colAttrs: colAttrs{ align: tview.AlignLeft, + wide: true, }, }, }, diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 79cbf935d7..0cf21c95f3 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: k9s base: core22 -version: 'v0.40.4' +version: 'v0.40.5' 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.