diff --git a/.gitignore b/.gitignore index 95e5abf7..69912fb6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ k9s.log cov.out execs k9s -samples +/k8s dist notes styles diff --git a/change_logs/release_0.4.4.md b/change_logs/release_0.4.4.md new file mode 100644 index 00000000..e99a5f92 --- /dev/null +++ b/change_logs/release_0.4.4.md @@ -0,0 +1,48 @@ + + +# Release v0.4.4 + +## Notes + +Thank you to all that contributed with flushing out issues with 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. + +Thank you so much for your support and awesome suggestions to make K9s better!! + +Also if you dig this tool, please make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer) + +--- + +## Change Logs + +### Exiting K9s + + There are a few debates about drathers on K9s key bindings. I have caved in + and decided to give up my beloved 'q' for quit which will no longer be bound. As of this release quitting K9s must be done via `:q` or `ctrl-c`. + +### Container Logs + + [Feature #147](https://github.com/derailed/k9s/issues/147). The default behavior was to pick the first available container. Which meant if the pod has an init container, the log view would choose that. + The view will now choose the first non init container. Most likely it + would be the wrong choice in pod's sidecar scenarios, but for the time + being showing log on one of the init containers just did not make much sense. You can still pick other containers via the menu options. We will implement a better solution for this soon... + +### Delete Dialog + + [Feature #146](https://github.com/derailed/k9s/issues/146) Tx @dperique! + Pressing `` on the delete dialog would delete the resource. Now + `cancel` is the default button. Hence you must use `` or `->` to + select `OK` then press `` to delete. + +--- + +## Resolved Bugs + ++ None + +--- + + © 2019 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0) diff --git a/internal/k8s/metrics.go b/internal/k8s/metrics.go index e75d35eb..d476b275 100644 --- a/internal/k8s/metrics.go +++ b/internal/k8s/metrics.go @@ -90,9 +90,9 @@ func (m *MetricsServer) ClusterLoad(nodes []v1.Node, metrics []mv1beta1.NodeMetr var cpu, tcpu, mem, tmem float64 for _, mx := range nodeMetrics { cpu += float64(mx.CurrentCPU) - tcpu += float64(mx.TotalCPU) + tcpu += float64(mx.AvailCPU) mem += mx.CurrentMEM - tmem += mx.TotalMEM + tmem += mx.AvailMEM } return ClusterMetrics{PercCPU: toPerc(cpu, tcpu), PercMEM: toPerc(mem, tmem)} diff --git a/internal/k8s/metrics_test.go b/internal/k8s/metrics_test.go index 1900cd5a..c2192cd1 100644 --- a/internal/k8s/metrics_test.go +++ b/internal/k8s/metrics_test.go @@ -122,8 +122,8 @@ func TestClusterLoad(t *testing.T) { } mx := m.ClusterLoad(nodes.Items, metrics.Items) - assert.Equal(t, 50.0, mx.PercCPU) - assert.Equal(t, 25.0, mx.PercMEM) + assert.Equal(t, 100.0, mx.PercCPU) + assert.Equal(t, 50.0, mx.PercMEM) } func BenchmarkClusterLoad(b *testing.B) { diff --git a/internal/k8s/pod.go b/internal/k8s/pod.go index ad104296..37bb7206 100644 --- a/internal/k8s/pod.go +++ b/internal/k8s/pod.go @@ -54,14 +54,15 @@ func (p *Pod) Containers(ns, n string, includeInit bool) ([]string, error) { } cc := []string{} + for _, c := range po.Spec.Containers { + cc = append(cc, c.Name) + } + if includeInit { for _, c := range po.Spec.InitContainers { cc = append(cc, c.Name) } } - for _, c := range po.Spec.Containers { - cc = append(cc, c.Name) - } return cc, nil } diff --git a/internal/resource/evt.go b/internal/resource/evt.go index bc25508d..8b4990eb 100644 --- a/internal/resource/evt.go +++ b/internal/resource/evt.go @@ -95,7 +95,7 @@ func (r *Event) Fields(ns string) Row { i.Reason, i.Source.Component, strconv.Itoa(int(i.Count)), - Truncate(i.Message, 50), + Truncate(i.Message, 80), toAge(i.LastTimestamp), ) } diff --git a/internal/views/app.go b/internal/views/app.go index 684b8dde..2131e60f 100644 --- a/internal/views/app.go +++ b/internal/views/app.go @@ -85,7 +85,7 @@ func NewApp(cfg *config.Config) *appView { v.actions[KeyColon] = newKeyAction("Cmd", v.activateCmd, false) v.actions[tcell.KeyCtrlR] = newKeyAction("Redraw", v.redrawCmd, false) - v.actions[KeyQ] = newKeyAction("Quit", v.quitCmd, false) + v.actions[tcell.KeyCtrlC] = newKeyAction("Quit", v.quitCmd, false) v.actions[KeyHelp] = newKeyAction("Help", v.helpCmd, false) v.actions[KeyA] = newKeyAction("Aliases", v.aliasCmd, true) v.actions[tcell.KeyEscape] = newKeyAction("Exit Cmd", v.deactivateCmd, false) @@ -93,9 +93,6 @@ func NewApp(cfg *config.Config) *appView { v.actions[tcell.KeyBackspace2] = newKeyAction("Erase", v.eraseCmd, false) v.actions[tcell.KeyBackspace] = newKeyAction("Erase", v.eraseCmd, false) v.actions[tcell.KeyDelete] = newKeyAction("Erase", v.eraseCmd, false) - v.actions[tcell.KeyTab] = newKeyAction("Focus", v.focusCmd, false) - - // v.actions[KeyO] = newKeyAction("RBAC", v.rbacCmd, false) return &v } diff --git a/internal/views/cluster_info.go b/internal/views/cluster_info.go index 2c8224ed..d89bff27 100644 --- a/internal/views/cluster_info.go +++ b/internal/views/cluster_info.go @@ -1,6 +1,8 @@ package views import ( + "strings" + "github.com/derailed/k9s/internal/k8s" "github.com/derailed/k9s/internal/resource" "github.com/derailed/tview" @@ -93,8 +95,12 @@ func (v *clusterInfoView) refresh() { mx := v.cluster.Metrics(nodes, mxNodes) c := v.GetCell(row, 1) - c.SetText(deltas(c.Text, toPerc(mx.PercCPU))) + cpu := toPerc(mx.PercCPU) + stripTxt := strings.Replace(c.Text, plus(), "", 1) + stripTxt = strings.Replace(stripTxt, minus(), "", 1) + c.SetText(cpu + deltas(stripTxt, cpu)) row++ c = v.GetCell(row, 1) - c.SetText(deltas(c.Text, toPerc(mx.PercMEM))) + mem := toPerc(mx.PercMEM) + c.SetText(mem + deltas(c.Text, mem)) } diff --git a/internal/views/resource.go b/internal/views/resource.go index 6d844ea7..35135e9d 100644 --- a/internal/views/resource.go +++ b/internal/views/resource.go @@ -69,7 +69,7 @@ func newResourceView(title string, app *appView, list resource.List) resourceVie v.AddPage("details", details, true, false) confirm := tview.NewModal(). - AddButtons([]string{"OK", "Cancel"}). + AddButtons([]string{"Cancel", "OK"}). SetTextColor(tcell.ColorFuchsia) v.AddPage("confirm", confirm, false, false)