removed q binding + temp fix for container logs

mine
derailed 2019-04-02 00:05:45 -06:00
parent 99c3088cc3
commit 4fc925873c
9 changed files with 68 additions and 16 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@ k9s.log
cov.out
execs
k9s
samples
/k8s
dist
notes
styles

View File

@ -0,0 +1,48 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s_small.png" align="right" width="200" height="auto"/>
# 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 `<enter>` on the delete dialog would delete the resource. Now
`cancel` is the default button. Hence you must use `<tab>` or `->` to
select `OK` then press `<enter>` to delete.
---
## Resolved Bugs
+ None
---
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2019 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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