rel v0.25.5 (#1334)

mine
Fernand Galiana 2021-11-23 09:51:40 -07:00 committed by GitHub
parent 165ffeab93
commit 4ae57817bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 61 additions and 15 deletions

View File

@ -5,7 +5,7 @@ PACKAGE := github.com/derailed/$(NAME)
GIT_REV ?= $(shell git rev-parse --short HEAD) GIT_REV ?= $(shell git rev-parse --short HEAD)
SOURCE_DATE_EPOCH ?= $(shell date +%s) SOURCE_DATE_EPOCH ?= $(shell date +%s)
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ") DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
VERSION ?= v0.25.4 VERSION ?= v0.25.5
IMG_NAME := derailed/k9s IMG_NAME := derailed/k9s
IMAGE := ${IMG_NAME}:${VERSION} IMAGE := ${IMG_NAME}:${VERSION}

View File

@ -0,0 +1,26 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s_small.png" align="right" width="200" height="auto"/>
# Release v0.25.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!
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!
---
## Resolved Issues
* [Issue #1327](https://github.com/derailed/k9s/issues/1327) Switching K8s resource changes view to all namespace
* [Issue #1326](https://github.com/derailed/k9s/issues/1326) Port forwarding not possible because of "invalid container port"
* [Issue #1325](https://github.com/derailed/k9s/issues/1325) Meaning of number in brackets after context name is unclear
* [Issue #1324](https://github.com/derailed/k9s/issues/1324) Problem with Configuration for macOS is can't find configuration directory
---
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2020 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

View File

@ -92,7 +92,7 @@ func (c *Config) SwitchContext(name string) error {
} }
context, err := c.GetContext(name) context, err := c.GetContext(name)
if err != nil { if err != nil {
return fmt.Errorf("context %s does not exist", name) return fmt.Errorf("context %q does not exist", name)
} }
c.flags.Context = &name c.flags.Context = &name
c.flags.ClusterName = &(context.Cluster) c.flags.ClusterName = &(context.Cluster)

View File

@ -84,7 +84,7 @@ func (l *LogItem) Render(paint string, showTime bool, bb *bytes.Buffer) {
} }
bb.WriteString("[" + paint + "::b]" + l.Container + "[-::-] ") bb.WriteString("[" + paint + "::b]" + l.Container + "[-::-] ")
} else if len(l.Pod) > 0 { } else if len(l.Pod) > 0 {
bb.WriteString("[-::]") bb.WriteString("[-::] ")
} }
if index > 0 { if index > 0 {

View File

@ -31,16 +31,19 @@ func TestLogItemEmpty(t *testing.T) {
func TestLogItemRender(t *testing.T) { func TestLogItemRender(t *testing.T) {
uu := map[string]struct { uu := map[string]struct {
opts dao.LogOptions opts dao.LogOptions
log string
e string e string
}{ }{
"empty": { "empty": {
opts: dao.LogOptions{}, opts: dao.LogOptions{},
log: fmt.Sprintf("%s %s\n", "2018-12-14T10:36:43.326972-07:00", "Testing 1,2,3..."),
e: "Testing 1,2,3...\n", e: "Testing 1,2,3...\n",
}, },
"container": { "container": {
opts: dao.LogOptions{ opts: dao.LogOptions{
Container: "fred", Container: "fred",
}, },
log: fmt.Sprintf("%s %s\n", "2018-12-14T10:36:43.326972-07:00", "Testing 1,2,3..."),
e: "[yellow::b]fred[-::-] Testing 1,2,3...\n", e: "[yellow::b]fred[-::-] Testing 1,2,3...\n",
}, },
"pod": { "pod": {
@ -49,6 +52,7 @@ func TestLogItemRender(t *testing.T) {
Container: "blee", Container: "blee",
SingleContainer: true, SingleContainer: true,
}, },
log: fmt.Sprintf("%s %s\n", "2018-12-14T10:36:43.326972-07:00", "Testing 1,2,3..."),
e: "[yellow::]fred [yellow::b]blee[-::-] Testing 1,2,3...\n", e: "[yellow::]fred [yellow::b]blee[-::-] Testing 1,2,3...\n",
}, },
"full": { "full": {
@ -58,15 +62,25 @@ func TestLogItemRender(t *testing.T) {
SingleContainer: true, SingleContainer: true,
ShowTimestamp: true, ShowTimestamp: true,
}, },
log: fmt.Sprintf("%s %s\n", "2018-12-14T10:36:43.326972-07:00", "Testing 1,2,3..."),
e: "[gray::]2018-12-14T10:36:43.326972-07:00 [yellow::]fred [yellow::b]blee[-::-] Testing 1,2,3...\n", e: "[gray::]2018-12-14T10:36:43.326972-07:00 [yellow::]fred [yellow::b]blee[-::-] Testing 1,2,3...\n",
}, },
"log-level": {
opts: dao.LogOptions{
Path: "blee/fred",
Container: "",
SingleContainer: false,
ShowTimestamp: false,
},
log: fmt.Sprintf("%s %s\n", "2018-12-14T10:36:43.326972-07:00", "2021-10-28T13:06:37Z [INFO] [blah-blah] Testing 1,2,3..."),
e: "[yellow::]fred[-::] 2021-10-28T13:06:37Z [INFO] [blah-blah] Testing 1,2,3...\n",
},
} }
s := []byte(fmt.Sprintf("%s %s\n", "2018-12-14T10:36:43.326972-07:00", "Testing 1,2,3..."))
for k := range uu { for k := range uu {
u := uu[k] u := uu[k]
t.Run(k, func(t *testing.T) { t.Run(k, func(t *testing.T) {
i := dao.NewLogItem(s) i := dao.NewLogItem([]byte(u.log))
_, n := client.Namespaced(u.opts.Path) _, n := client.Namespaced(u.opts.Path)
i.Pod, i.Container = n, u.opts.Container i.Pod, i.Container = n, u.opts.Container

View File

@ -22,6 +22,10 @@ func (c ContainerPortSpecs) Dump() string {
// InSpecs checks if given port matches a spec. // InSpecs checks if given port matches a spec.
func (c ContainerPortSpecs) MatchSpec(s string) bool { func (c ContainerPortSpecs) MatchSpec(s string) bool {
// No port are exposed
if len(c) == 0 {
return true
}
for _, spec := range c { for _, spec := range c {
if spec.MatchSpec(s) { if spec.MatchSpec(s) {
return true return true

View File

@ -127,7 +127,7 @@ func (b *Browser) SetInstance(path string) {
// Start initializes browser updates. // Start initializes browser updates.
func (b *Browser) Start() { func (b *Browser) Start() {
b.app.Config.ValidateFavorites() b.app.Config.ValidateFavorites()
if err := b.app.switchNS(b.GetModel().GetNamespace()); err != nil { if err := b.app.switchNS(b.app.Config.ActiveNamespace()); err != nil {
log.Error().Err(err).Msgf("ns switch failed") log.Error().Err(err).Msgf("ns switch failed")
} }
if err := b.app.Config.Save(); err != nil { if err := b.app.Config.Save(); err != nil {

View File

@ -2,7 +2,6 @@ package view
import ( import (
"fmt" "fmt"
"runtime"
"github.com/derailed/k9s/internal/client" "github.com/derailed/k9s/internal/client"
"github.com/derailed/k9s/internal/config" "github.com/derailed/k9s/internal/config"
@ -103,7 +102,7 @@ func (c *ClusterInfo) ClusterInfoChanged(prev, curr model.ClusterMeta) {
c.app.QueueUpdateDraw(func() { c.app.QueueUpdateDraw(func() {
c.Clear() c.Clear()
c.layout() c.layout()
row := c.setCell(0, fmt.Sprintf("%s [%d]", curr.Context, runtime.NumGoroutine())) row := c.setCell(0, curr.Context)
row = c.setCell(row, curr.Cluster) row = c.setCell(row, curr.Cluster)
row = c.setCell(row, curr.User) row = c.setCell(row, curr.User)
if curr.K9sLatest != "" { if curr.K9sLatest != "" {

View File

@ -156,12 +156,15 @@ func (c *Command) defaultCmd() error {
tokens := strings.Split(view, " ") tokens := strings.Split(view, " ")
cmd := view cmd := view
if len(tokens) == 1 { if len(tokens) == 1 {
if !isContextCmd(tokens[0]) {
cmd = tokens[0] + " " + c.app.Config.ActiveNamespace() cmd = tokens[0] + " " + c.app.Config.ActiveNamespace()
} }
}
if err := c.run(cmd, "", true); err != nil { if err := c.run(cmd, "", true); err != nil {
log.Error().Err(err).Msgf("Default run command failed") log.Error().Err(err).Msgf("Default run command failed %q", cmd)
return c.run("meow", err.Error(), true) c.app.cowCmd(err.Error())
return err
} }
return nil return nil
} }

View File

@ -41,7 +41,7 @@ func ShowPortForwards(v ResourceViewer, path string, ports port.ContainerPortSpe
f.AddInputField("Container Port:", p1, fieldLen, nil, nil) f.AddInputField("Container Port:", p1, fieldLen, nil, nil)
coField := f.GetFormItemByLabel("Container Port:").(*tview.InputField) coField := f.GetFormItemByLabel("Container Port:").(*tview.InputField)
if coField.GetText() == "" { if coField.GetText() == "" {
coField.SetPlaceholder("Enter a container name/port") coField.SetPlaceholder("Enter a container name::port")
} }
f.AddInputField("Local Port:", p2, fieldLen, nil, nil) f.AddInputField("Local Port:", p2, fieldLen, nil, nil)
loField := f.GetFormItemByLabel("Local Port:").(*tview.InputField) loField := f.GetFormItemByLabel("Local Port:").(*tview.InputField)