K9s/release v0.30.1 (#2369)
* [Bug] Fix #2368 * [Bug] Fix #2363 * [Bug] Fix #2364 * [Bug] Fix #2366 * [Bug] Fix #2367 * Release docs + rebase fixesmine
parent
f8ad4aa8c7
commit
f0d0e62b70
2
Makefile
2
Makefile
|
|
@ -11,7 +11,7 @@ DATE ?= $(shell TZ=UTC date -j -f "%s" ${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:
|
||||||
else
|
else
|
||||||
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")
|
||||||
endif
|
endif
|
||||||
VERSION ?= v0.30.0
|
VERSION ?= v0.30.1
|
||||||
IMG_NAME := derailed/k9s
|
IMG_NAME := derailed/k9s
|
||||||
IMAGE := ${IMG_NAME}:${VERSION}
|
IMAGE := ${IMG_NAME}:${VERSION}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s-xmas.png" align="center" width="800" height="auto"/>
|
||||||
|
|
||||||
|
# Release v0.30.1
|
||||||
|
|
||||||
|
## 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! 🎄
|
||||||
|
|
||||||
|
🎵 `On The twentyfouth day of Christmas my true love gave to me... Bugs!!` 🎵
|
||||||
|
|
||||||
|
Got to love the aftermath... Thank you all for pitch'in in and help flesh out bugs!! The gift that keeps on... giving?
|
||||||
|
|
||||||
|
🎅 Merry Christmas to all and Best wishes for the new year!!🧑🎄
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Videos Are In The Can!
|
||||||
|
|
||||||
|
Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...
|
||||||
|
|
||||||
|
* [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
|
||||||
|
* [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Resolved Issues
|
||||||
|
|
||||||
|
* [#2368](https://github.com/derailed/k9s/issues/2368) Pod CPU and MEM columns are empty in 0.30.0
|
||||||
|
* [#2367](https://github.com/derailed/k9s/issues/2367) k9s 0.30.0 issue loading plugins
|
||||||
|
* [#2366](https://github.com/derailed/k9s/issues/2366) List pods of deployment is now impossible
|
||||||
|
* [#2264](https://github.com/derailed/k9s/issues/2264) k9s 0.30.0 fields and values missed in action in the "namespace view"
|
||||||
|
* [#2263](https://github.com/derailed/k9s/issues/2263) Default 0.30.0 default skin on macOS is no good
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 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!!
|
||||||
|
|
||||||
|
* [#2360](https://github.com/derailed/k9s/pull/2360) adding cancelable launch prompts to NodeShell
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2023 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
|
@ -541,7 +541,6 @@ func (s *Styles) Load(path string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := yaml.Unmarshal(f, s); err != nil {
|
if err := yaml.Unmarshal(f, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,24 +17,24 @@ k9s:
|
||||||
bgColor: black
|
bgColor: black
|
||||||
suggestColor: dodgerblue
|
suggestColor: dodgerblue
|
||||||
border:
|
border:
|
||||||
default: seagreen
|
|
||||||
command: aqua
|
command: aqua
|
||||||
info:
|
default: seagreen
|
||||||
fgColor: orange
|
help:
|
||||||
sectionColor: white
|
fgColor: cadetblue
|
||||||
dialog:
|
|
||||||
fgColor: dodgerblue
|
|
||||||
bgColor: black
|
bgColor: black
|
||||||
buttonFgColor: black
|
sectionColor: green
|
||||||
buttonBgColor: dodgerblue
|
keyColor: dodgerblue
|
||||||
buttonFocusFgColor: white
|
numKeyColor: fuchsia
|
||||||
buttonFocusBgColor: fuchsia
|
|
||||||
labelFgColor: fuchsia
|
|
||||||
fieldFgColor: dodgerblue
|
|
||||||
frame:
|
frame:
|
||||||
|
title:
|
||||||
|
fgColor: aqua
|
||||||
|
bgColor: black
|
||||||
|
highlightColor: fuchsia
|
||||||
|
counterColor: papayawhip
|
||||||
|
filterColor: seagreen
|
||||||
border:
|
border:
|
||||||
fgColor: dodgerblue
|
fgColor: dodgerblue
|
||||||
focusColor: aqua
|
focusColor: lightskyblue
|
||||||
menu:
|
menu:
|
||||||
fgColor: white
|
fgColor: white
|
||||||
keyColor: dodgerblue
|
keyColor: dodgerblue
|
||||||
|
|
@ -46,52 +46,71 @@ k9s:
|
||||||
status:
|
status:
|
||||||
newColor: lightskyblue
|
newColor: lightskyblue
|
||||||
modifyColor: greenyellow
|
modifyColor: greenyellow
|
||||||
addColor: white
|
addColor: dodgerblue
|
||||||
errorColor: orangered
|
|
||||||
pendingColor: darkorange
|
pendingColor: darkorange
|
||||||
|
errorColor: orangered
|
||||||
highlightColor: aqua
|
highlightColor: aqua
|
||||||
killColor: mediumpurple
|
killColor: mediumpurple
|
||||||
completedColor: gray
|
completedColor: lightslategray
|
||||||
title:
|
info:
|
||||||
fgColor: aqua
|
sectionColor: white
|
||||||
highlightColor: fuchsia
|
fgColor: orange
|
||||||
counterColor: papayawhip
|
|
||||||
filterColor: steelblue
|
|
||||||
views:
|
views:
|
||||||
# Charts skins...
|
|
||||||
charts:
|
|
||||||
bgColor: black
|
|
||||||
defaultDialColors:
|
|
||||||
- linegreen
|
|
||||||
- orangered
|
|
||||||
defaultChartColors:
|
|
||||||
- linegreen
|
|
||||||
- orangered
|
|
||||||
table:
|
table:
|
||||||
fgColor: aqua
|
fgColor: aqua
|
||||||
bgColor: black
|
bgColor: black
|
||||||
cursorFgColor: white
|
cursorFgColor: black
|
||||||
cursorBgColor: black
|
cursorBgColor: aqua
|
||||||
markColor: darkgoldenrod
|
markColor: palegreen
|
||||||
header:
|
header:
|
||||||
fgColor: lightGray
|
fgColor: white
|
||||||
bgColor: black
|
bgColor: black
|
||||||
sorterColor: orange
|
sorterColor: aqua
|
||||||
xray:
|
xray:
|
||||||
fgColor: blue
|
fgColor: aqua
|
||||||
bgColor: black
|
bgColor: black
|
||||||
cursorColor: aqua
|
cursorColor: dodgerblue
|
||||||
graphicColor: darkgoldenrod
|
cursorTextColor: black
|
||||||
showIcons: false
|
graphicColor: cadetblue
|
||||||
|
charts:
|
||||||
|
bgColor: black
|
||||||
|
dialBgColor: black
|
||||||
|
chartBgColor: black
|
||||||
|
defaultDialColors:
|
||||||
|
- palegreen
|
||||||
|
- orangered
|
||||||
|
defaultChartColors:
|
||||||
|
- palegreen
|
||||||
|
- orangered
|
||||||
|
resourceColors:
|
||||||
|
cpu:
|
||||||
|
- dodgerblue
|
||||||
|
- darkslateblue
|
||||||
|
mem:
|
||||||
|
- yellow
|
||||||
|
- goldenrod
|
||||||
yaml:
|
yaml:
|
||||||
keyColor: steelblue
|
keyColor: steelblue
|
||||||
colonColor: white
|
|
||||||
valueColor: papayawhip
|
valueColor: papayawhip
|
||||||
|
colonColor: white
|
||||||
|
picker:
|
||||||
|
mainColor: white
|
||||||
|
focusColor: aqua
|
||||||
|
shortcutColor: aqua
|
||||||
logs:
|
logs:
|
||||||
fgColor: white
|
fgColor: lightskyblue
|
||||||
bgColor: black
|
bgColor: black
|
||||||
indicator:
|
indicator:
|
||||||
fgColor: dodgerblue
|
fgColor: dodgerblue
|
||||||
bgColor: black
|
bgColor: black
|
||||||
toggleOnColor: limegreen
|
toggleOnColor: limegreen
|
||||||
toggleOffColor: steelblue
|
toggleOffColor: gray
|
||||||
|
dialog:
|
||||||
|
fgColor: cadetblue
|
||||||
|
bgColor: black
|
||||||
|
buttonFgColor: black
|
||||||
|
buttonBgColor: darkslateblue
|
||||||
|
buttonFocusFgColor: black
|
||||||
|
buttonFocusBgColor: dodgerblue
|
||||||
|
labelFgColor: white
|
||||||
|
fieldFgColor: white
|
||||||
|
|
@ -38,7 +38,7 @@ func (c *Container) List(ctx context.Context, _ string) ([]runtime.Object, error
|
||||||
cmx client.ContainersMetrics
|
cmx client.ContainersMetrics
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); withMx || !ok {
|
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); ok && withMx {
|
||||||
cmx, _ = client.DialMetrics(c.Client()).FetchContainersMetrics(ctx, fqn)
|
cmx, _ = client.DialMetrics(c.Client()).FetchContainersMetrics(ctx, fqn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ func (n *Node) Get(ctx context.Context, path string) (runtime.Object, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var nmx *mv1beta1.NodeMetrics
|
var nmx *mv1beta1.NodeMetrics
|
||||||
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); withMx || !ok {
|
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); ok && withMx {
|
||||||
nmx, _ = client.DialMetrics(n.Client()).FetchNodeMetrics(ctx, path)
|
nmx, _ = client.DialMetrics(n.Client()).FetchNodeMetrics(ctx, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ func (p *Pod) Get(ctx context.Context, path string) (runtime.Object, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var pmx *mv1beta1.PodMetrics
|
var pmx *mv1beta1.PodMetrics
|
||||||
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); withMx || !ok {
|
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); ok && withMx {
|
||||||
pmx, _ = client.DialMetrics(p.Client()).FetchPodMetrics(ctx, path)
|
pmx, _ = client.DialMetrics(p.Client()).FetchPodMetrics(ctx, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ func (p *Pod) List(ctx context.Context, ns string) ([]runtime.Object, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var pmx client.PodsMetricsMap
|
var pmx client.PodsMetricsMap
|
||||||
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); false && ok && withMx {
|
if withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); ok && withMx {
|
||||||
pmx, _ = client.DialMetrics(p.Client()).FetchPodsMetricsMap(ctx, ns)
|
pmx, _ = client.DialMetrics(p.Client()).FetchPodsMetricsMap(ctx, ns)
|
||||||
}
|
}
|
||||||
sel, _ := ctx.Value(internal.KeyLabels).(string)
|
sel, _ := ctx.Value(internal.KeyLabels).(string)
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,8 @@ func (Pod) Header(ns string) Header {
|
||||||
HeaderColumn{Name: "%CPU/L", Align: tview.AlignRight, MX: true},
|
HeaderColumn{Name: "%CPU/L", Align: tview.AlignRight, MX: true},
|
||||||
HeaderColumn{Name: "%MEM/R", Align: tview.AlignRight, MX: true},
|
HeaderColumn{Name: "%MEM/R", Align: tview.AlignRight, MX: true},
|
||||||
HeaderColumn{Name: "%MEM/L", Align: tview.AlignRight, MX: true},
|
HeaderColumn{Name: "%MEM/L", Align: tview.AlignRight, MX: true},
|
||||||
HeaderColumn{Name: "IP", Wide: true},
|
HeaderColumn{Name: "IP"},
|
||||||
HeaderColumn{Name: "NODE", Wide: true},
|
HeaderColumn{Name: "NODE"},
|
||||||
HeaderColumn{Name: "NOMINATED NODE", Wide: true},
|
HeaderColumn{Name: "NOMINATED NODE", Wide: true},
|
||||||
HeaderColumn{Name: "READINESS GATES", Wide: true},
|
HeaderColumn{Name: "READINESS GATES", Wide: true},
|
||||||
HeaderColumn{Name: "QOS", Wide: true},
|
HeaderColumn{Name: "QOS", Wide: true},
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,7 @@ func (c *Configurator) RefreshStyles(context string) {
|
||||||
var skin string
|
var skin string
|
||||||
if c.Config != nil {
|
if c.Config != nil {
|
||||||
skin = c.Config.K9s.UI.Skin
|
skin = c.Config.K9s.UI.Skin
|
||||||
ct, err := c.Config.K9s.ActiveContext()
|
if ct, err := c.Config.K9s.ActiveContext(); err != nil {
|
||||||
if err != nil {
|
|
||||||
log.Warn().Msgf("No active context found. Using default skin")
|
log.Warn().Msgf("No active context found. Using default skin")
|
||||||
} else if ct.Skin != "" {
|
} else if ct.Skin != "" {
|
||||||
skin = ct.Skin
|
skin = ct.Skin
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// Copyright Authors of K9s
|
||||||
|
|
||||||
package dialog
|
package dialog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// Copyright Authors of K9s
|
||||||
|
|
||||||
package dialog
|
package dialog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/derailed/k9s/internal/config"
|
"github.com/derailed/k9s/internal/config"
|
||||||
"github.com/derailed/k9s/internal/ui"
|
"github.com/derailed/k9s/internal/ui"
|
||||||
"github.com/derailed/tcell/v2"
|
"github.com/derailed/tcell/v2"
|
||||||
"github.com/derailed/tview"
|
"github.com/derailed/tview"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestShowPrompt(t *testing.T) {
|
func TestShowPrompt(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import (
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const maxTruncate = 50
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// ColorerFunc represents a row colorer.
|
// ColorerFunc represents a row colorer.
|
||||||
ColorerFunc func(ns string, evt render.RowEvent) tcell.Color
|
ColorerFunc func(ns string, evt render.RowEvent) tcell.Color
|
||||||
|
|
@ -469,9 +471,9 @@ func (t *Table) styleTitle() string {
|
||||||
|
|
||||||
buff := t.cmdBuff.GetText()
|
buff := t.cmdBuff.GetText()
|
||||||
if IsLabelSelector(buff) {
|
if IsLabelSelector(buff) {
|
||||||
buff = TrimLabelSelector(buff)
|
buff = truncate(TrimLabelSelector(buff), maxTruncate)
|
||||||
} else if l := t.GetModel().GetLabelFilter(); l != "" {
|
} else if l := t.GetModel().GetLabelFilter(); l != "" {
|
||||||
buff = l
|
buff = truncate(l, maxTruncate)
|
||||||
}
|
}
|
||||||
|
|
||||||
if buff == "" {
|
if buff == "" {
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,14 @@ func TrimLabelSelector(s string) string {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func truncate(s string, max int) string {
|
||||||
|
if len(s) < max {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
return s[:max] + "..."
|
||||||
|
}
|
||||||
|
|
||||||
// SkinTitle decorates a title.
|
// SkinTitle decorates a title.
|
||||||
func SkinTitle(fmat string, style config.Frame) string {
|
func SkinTitle(fmat string, style config.Frame) string {
|
||||||
bgColor := style.Title.BgColor
|
bgColor := style.Title.BgColor
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,29 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestTruncate(t *testing.T) {
|
||||||
|
uu := map[string]struct {
|
||||||
|
s, e string
|
||||||
|
}{
|
||||||
|
"empty": {},
|
||||||
|
"max": {
|
||||||
|
s: "/app.kubernetes.io/instance=prom,app.kubernetes.io/name=prometheus,app.kubernetes.io/component=server",
|
||||||
|
e: "/app.kubernetes.io/instance=prom,app.kubernetes.io...",
|
||||||
|
},
|
||||||
|
"less": {
|
||||||
|
s: "app=fred,env=blee",
|
||||||
|
e: "app=fred,env=blee",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for k := range uu {
|
||||||
|
u := uu[k]
|
||||||
|
t.Run(k, func(t *testing.T) {
|
||||||
|
assert.Equal(t, u.e, truncate(u.s, 50))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestIsLabelSelector(t *testing.T) {
|
func TestIsLabelSelector(t *testing.T) {
|
||||||
uu := map[string]struct {
|
uu := map[string]struct {
|
||||||
s string
|
s string
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ func newArgs(p *Interpreter, aa []string) args {
|
||||||
args[filterKey] = a[1:]
|
args[filterKey] = a[1:]
|
||||||
|
|
||||||
case strings.Contains(a, labelFlag):
|
case strings.Contains(a, labelFlag):
|
||||||
if ll := toLabels(a); len(ll) != 0 {
|
if ll := ToLabels(a); len(ll) != 0 {
|
||||||
args[labelKey] = a
|
args[labelKey] = a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func toLabels(s string) map[string]string {
|
func ToLabels(s string) map[string]string {
|
||||||
ll := strings.Split(s, ",")
|
ll := strings.Split(s, ",")
|
||||||
lbls := make(map[string]string, len(ll))
|
lbls := make(map[string]string, len(ll))
|
||||||
for _, l := range ll {
|
for _, l := range ll {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func Test_toLabels(t *testing.T) {
|
||||||
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) {
|
||||||
assert.Equal(t, u.ll, toLabels(u.s))
|
assert.Equal(t, u.ll, ToLabels(u.s))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,5 +196,5 @@ func (c *Interpreter) LabelsArg() (map[string]string, bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return toLabels(ll), true
|
return ToLabels(ll), true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"github.com/derailed/k9s/internal/model"
|
"github.com/derailed/k9s/internal/model"
|
||||||
"github.com/derailed/k9s/internal/render"
|
"github.com/derailed/k9s/internal/render"
|
||||||
"github.com/derailed/k9s/internal/ui"
|
"github.com/derailed/k9s/internal/ui"
|
||||||
|
"github.com/derailed/k9s/internal/view/cmd"
|
||||||
"github.com/derailed/tcell/v2"
|
"github.com/derailed/tcell/v2"
|
||||||
"github.com/derailed/tview"
|
"github.com/derailed/tview"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
@ -116,13 +117,9 @@ func toLabelsStr(labels map[string]string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func showPods(app *App, path, labelSel, fieldSel string) {
|
func showPods(app *App, path, labelSel, fieldSel string) {
|
||||||
// !!BOZO!! needed??
|
|
||||||
// if err := app.switchNS(client.BlankNamespace); err != nil {
|
|
||||||
// app.Flash().Err(err)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
v := NewPod(client.NewGVR("v1/pods"))
|
v := NewPod(client.NewGVR("v1/pods"))
|
||||||
v.SetContextFn(podCtx(app, path, labelSel, fieldSel))
|
v.SetContextFn(podCtx(app, path, fieldSel))
|
||||||
|
v.SetLabelFilter(cmd.ToLabels(labelSel))
|
||||||
|
|
||||||
ns, _ := client.Namespaced(path)
|
ns, _ := client.Namespaced(path)
|
||||||
if err := app.Config.SetActiveNamespace(ns); err != nil {
|
if err := app.Config.SetActiveNamespace(ns); err != nil {
|
||||||
|
|
@ -133,11 +130,9 @@ func showPods(app *App, path, labelSel, fieldSel string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func podCtx(app *App, path, labelSel, fieldSel string) ContextFunc {
|
func podCtx(app *App, path, fieldSel string) ContextFunc {
|
||||||
return func(ctx context.Context) context.Context {
|
return func(ctx context.Context) context.Context {
|
||||||
ctx = context.WithValue(ctx, internal.KeyPath, path)
|
ctx = context.WithValue(ctx, internal.KeyPath, path)
|
||||||
ctx = context.WithValue(ctx, internal.KeyLabels, labelSel)
|
|
||||||
|
|
||||||
return context.WithValue(ctx, internal.KeyFields, fieldSel)
|
return context.WithValue(ctx, internal.KeyFields, fieldSel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
|
|
||||||
"github.com/derailed/k9s/internal/config"
|
"github.com/derailed/k9s/internal/config"
|
||||||
"github.com/derailed/tview"
|
"github.com/derailed/tview"
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const spacer = " "
|
const spacer = " "
|
||||||
|
|
@ -155,7 +154,5 @@ func (l *LogIndicator) Refresh() {
|
||||||
l.indicator = append(l.indicator, fmt.Sprintf(toggleOffFmt, "Wrap", "")...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOffFmt, "Wrap", "")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Msgf("INDICATOR: %q", l.indicator)
|
|
||||||
|
|
||||||
_, _ = l.Write(l.indicator)
|
_, _ = l.Write(l.indicator)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ func TestLogIndicatorRefresh(t *testing.T) {
|
||||||
e string
|
e string
|
||||||
}{
|
}{
|
||||||
"all-containers": {
|
"all-containers": {
|
||||||
view.NewLogIndicator(config.NewConfig(nil), defaults, true), "[::b]AllContainers:[steelblue::d]Off[-::] [::b]Autoscroll:[limegreen::b]On[-::] [::b]FullScreen:[steelblue::d]Off[-::] [::b]Timestamps:[steelblue::d]Off[-::] [::b]Wrap:[steelblue::d]Off[-::]\n",
|
view.NewLogIndicator(config.NewConfig(nil), defaults, true), "[::b]AllContainers:[gray::d]Off[-::] [::b]Autoscroll:[limegreen::b]On[-::] [::b]FullScreen:[gray::d]Off[-::] [::b]Timestamps:[gray::d]Off[-::] [::b]Wrap:[gray::d]Off[-::]\n",
|
||||||
},
|
},
|
||||||
"plain": {
|
"plain": {
|
||||||
view.NewLogIndicator(config.NewConfig(nil), defaults, false), "[::b]Autoscroll:[limegreen::b]On[-::] [::b]FullScreen:[steelblue::d]Off[-::] [::b]Timestamps:[steelblue::d]Off[-::] [::b]Wrap:[steelblue::d]Off[-::]\n",
|
view.NewLogIndicator(config.NewConfig(nil), defaults, false), "[::b]Autoscroll:[limegreen::b]On[-::] [::b]FullScreen:[gray::d]Off[-::] [::b]Timestamps:[gray::d]Off[-::] [::b]Wrap:[gray::d]Off[-::]\n",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/derailed/k9s/internal/ui"
|
"github.com/derailed/k9s/internal/ui"
|
||||||
"github.com/derailed/k9s/internal/ui/dialog"
|
"github.com/derailed/k9s/internal/ui/dialog"
|
||||||
"github.com/derailed/tcell/v2"
|
"github.com/derailed/tcell/v2"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# $HOME/.k9s/plugin.yml
|
# $HOME/.k9s/plugin.yml
|
||||||
plugin:
|
plugins:
|
||||||
kapp-inspect:
|
kapp-inspect:
|
||||||
shortCut: Shift-Z
|
shortCut: Shift-Z
|
||||||
confirm: false
|
confirm: false
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
# List all the resources managed by a Composite Resource
|
# List all the resources managed by a Composite Resource
|
||||||
kube-lineage:
|
kube-lineage:
|
||||||
shortCut: Ctrl-X
|
shortCut: Ctrl-X
|
||||||
|
|
@ -11,11 +11,11 @@ plugin:
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
kubectl lineage
|
kubectl lineage
|
||||||
-d 6
|
-d 6
|
||||||
--exclude-types Event,ProviderConfigUsage.aws.upbound.io,ProviderConfigUsage.kubernetes.crossplane.io
|
--exclude-types Event,ProviderConfigUsage.aws.upbound.io,ProviderConfigUsage.kubernetes.crossplane.io
|
||||||
--show-group
|
--show-group
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
$RESOURCE_NAME
|
$RESOURCE_NAME
|
||||||
$NAME
|
$NAME
|
||||||
| less -K
|
| less -K
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
#--- Create debug container for selected pod in current namespace
|
#--- Create debug container for selected pod in current namespace
|
||||||
# See https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/#ephemeral-container
|
# See https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/#ephemeral-container
|
||||||
debug:
|
debug:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
dive:
|
dive:
|
||||||
shortCut: d
|
shortCut: d
|
||||||
confirm: false
|
confirm: false
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# move selected line to chosen resource in K9s, then:
|
# move selected line to chosen resource in K9s, then:
|
||||||
# Shift-T (with confirmation) to toggle helm releases or kustomizations suspend and resume
|
# Shift-T (with confirmation) to toggle helm releases or kustomizations suspend and resume
|
||||||
# Shift-R (no confirmation) to reconcile a git source or a helm release or a kustomization
|
# Shift-R (no confirmation) to reconcile a git source or a helm release or a kustomization
|
||||||
plugin:
|
plugins:
|
||||||
toggle-helmrelease:
|
toggle-helmrelease:
|
||||||
shortCut: Shift-T
|
shortCut: Shift-T
|
||||||
confirm: true
|
confirm: true
|
||||||
|
|
@ -19,7 +19,7 @@ plugin:
|
||||||
flux
|
flux
|
||||||
$verb helmrelease
|
$verb helmrelease
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
toggle-kustomization:
|
toggle-kustomization:
|
||||||
shortCut: Shift-T
|
shortCut: Shift-T
|
||||||
|
|
@ -34,10 +34,10 @@ plugin:
|
||||||
- >-
|
- >-
|
||||||
suspended=$(kubectl --context $CONTEXT get kustomizations -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1);
|
suspended=$(kubectl --context $CONTEXT get kustomizations -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1);
|
||||||
verb=$([ $suspended = "true" ] && echo "resume" || echo "suspend");
|
verb=$([ $suspended = "true" ] && echo "resume" || echo "suspend");
|
||||||
flux
|
flux
|
||||||
$verb kustomization
|
$verb kustomization
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
reconcile-git:
|
reconcile-git:
|
||||||
shortCut: Shift-R
|
shortCut: Shift-R
|
||||||
|
|
@ -53,7 +53,7 @@ plugin:
|
||||||
flux
|
flux
|
||||||
reconcile source git
|
reconcile source git
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
reconcile-hr:
|
reconcile-hr:
|
||||||
shortCut: Shift-R
|
shortCut: Shift-R
|
||||||
|
|
@ -66,10 +66,10 @@ plugin:
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
flux
|
flux
|
||||||
reconcile helmrelease
|
reconcile helmrelease
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
reconcile-helm-repo:
|
reconcile-helm-repo:
|
||||||
shortCut: Shift-Z
|
shortCut: Shift-Z
|
||||||
|
|
@ -82,10 +82,10 @@ plugin:
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
flux
|
flux
|
||||||
reconcile source helm
|
reconcile source helm
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
reconcile-oci-repo:
|
reconcile-oci-repo:
|
||||||
shortCut: Shift-Z
|
shortCut: Shift-Z
|
||||||
|
|
@ -98,10 +98,10 @@ plugin:
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
flux
|
flux
|
||||||
reconcile source oci
|
reconcile source oci
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
reconcile-ks:
|
reconcile-ks:
|
||||||
shortCut: Shift-R
|
shortCut: Shift-R
|
||||||
|
|
@ -133,7 +133,7 @@ plugin:
|
||||||
flux
|
flux
|
||||||
reconcile image repository
|
reconcile image repository
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
reconcile-iua:
|
reconcile-iua:
|
||||||
shortCut: Shift-R
|
shortCut: Shift-R
|
||||||
|
|
@ -146,10 +146,10 @@ plugin:
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
flux
|
flux
|
||||||
reconcile image update
|
reconcile image update
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
-n $NAMESPACE $NAME
|
-n $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
trace:
|
trace:
|
||||||
shortCut: Shift-A
|
shortCut: Shift-A
|
||||||
|
|
@ -163,12 +163,12 @@ plugin:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
resource=$(echo $RESOURCE_NAME | sed -E 's/ies$/y/' | sed -E 's/ses$/se/' | sed -E 's/(s|es)$//g')
|
resource=$(echo $RESOURCE_NAME | sed -E 's/ies$/y/' | sed -E 's/ses$/se/' | sed -E 's/(s|es)$//g')
|
||||||
flux
|
flux
|
||||||
trace
|
trace
|
||||||
--context $CONTEXT
|
--context $CONTEXT
|
||||||
--kind $resource
|
--kind $resource
|
||||||
--api-version $RESOURCE_GROUP/$RESOURCE_VERSION
|
--api-version $RESOURCE_GROUP/$RESOURCE_VERSION
|
||||||
--namespace $NAMESPACE $NAME
|
--namespace $NAMESPACE $NAME
|
||||||
| less -K
|
| less -K
|
||||||
# credits: https://github.com/fluxcd/flux2/discussions/2494
|
# credits: https://github.com/fluxcd/flux2/discussions/2494
|
||||||
get-suspended-helmreleases:
|
get-suspended-helmreleases:
|
||||||
|
|
@ -182,10 +182,10 @@ plugin:
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
kubectl get
|
kubectl get
|
||||||
--all-namespaces
|
--all-namespaces
|
||||||
helmreleases.helm.toolkit.fluxcd.io -o json
|
helmreleases.helm.toolkit.fluxcd.io -o json
|
||||||
| jq -r '.items[] | select(.spec.suspend==true) | [.metadata.namespace,.metadata.name,.spec.suspend] | @tsv'
|
| jq -r '.items[] | select(.spec.suspend==true) | [.metadata.namespace,.metadata.name,.spec.suspend] | @tsv'
|
||||||
| less
|
| less
|
||||||
get-suspended-kustomizations:
|
get-suspended-kustomizations:
|
||||||
shortCut: Shift-S
|
shortCut: Shift-S
|
||||||
|
|
@ -198,7 +198,7 @@ plugin:
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- >-
|
- >-
|
||||||
kubectl get
|
kubectl get
|
||||||
--all-namespaces
|
--all-namespaces
|
||||||
kustomizations.kustomize.toolkit.fluxcd.io -o json
|
kustomizations.kustomize.toolkit.fluxcd.io -o json
|
||||||
| jq -r '.items[] | select(.spec.suspend==true) | [.metadata.name,.spec.suspend] | @tsv'
|
| jq -r '.items[] | select(.spec.suspend==true) | [.metadata.name,.spec.suspend] | @tsv'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
#get all resources in a namespace using the krew get-all plugin
|
#get all resources in a namespace using the krew get-all plugin
|
||||||
get-all-namespace:
|
get-all-namespace:
|
||||||
shortCut: g
|
shortCut: g
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
helm-default-values:
|
helm-default-values:
|
||||||
shortCut: Shift-V
|
shortCut: Shift-V
|
||||||
confirm: false
|
confirm: false
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# $HOME/.k9s/plugin.yml
|
# $HOME/.k9s/plugin.yml
|
||||||
plugin:
|
plugins:
|
||||||
# Issues a helm delete --purge for the resource associated with the selected pod
|
# Issues a helm delete --purge for the resource associated with the selected pod
|
||||||
helm-purge:
|
helm-purge:
|
||||||
shortCut: Ctrl-P
|
shortCut: Ctrl-P
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# View user-supplied values when the helm chart was created
|
# View user-supplied values when the helm chart was created
|
||||||
|
|
||||||
plugin:
|
plugins:
|
||||||
helm-values:
|
helm-values:
|
||||||
shortCut: v
|
shortCut: v
|
||||||
confirm: false
|
confirm: false
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
# Suspends/Resumes a cronjob
|
# Suspends/Resumes a cronjob
|
||||||
toggleCronjob:
|
toggleCronjob:
|
||||||
shortCut: Ctrl-S
|
shortCut: Ctrl-S
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
# Opens a shell to k3d container as root
|
# Opens a shell to k3d container as root
|
||||||
k3d-root-shell:
|
k3d-root-shell:
|
||||||
shortCut: Shift-S
|
shortCut: Shift-S
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
# See https://k9scli.io/topics/plugins/
|
# See https://k9scli.io/topics/plugins/
|
||||||
raw-logs-follow:
|
raw-logs-follow:
|
||||||
shortCut: Ctrl-L
|
shortCut: Ctrl-L
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
# Sends logs over to jq for processing. This leverages kubectl plugin kubectl-jq.
|
# Sends logs over to jq for processing. This leverages kubectl plugin kubectl-jq.
|
||||||
jqlogs:
|
jqlogs:
|
||||||
shortCut: Ctrl-J
|
shortCut: Ctrl-J
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
# Leverage stern (https://github.com/stern/stern) to output logs.
|
# Leverage stern (https://github.com/stern/stern) to output logs.
|
||||||
stern:
|
stern:
|
||||||
shortCut: Ctrl-L
|
shortCut: Ctrl-L
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
plugin:
|
plugins:
|
||||||
# remove finalizers from a stuck namespace
|
# remove finalizers from a stuck namespace
|
||||||
rm-ns:
|
rm-ns:
|
||||||
shortCut: n
|
shortCut: n
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# requires linux "watch" command
|
# requires linux "watch" command
|
||||||
# change '-n' to adjust refresh time in seconds
|
# change '-n' to adjust refresh time in seconds
|
||||||
|
|
||||||
plugin:
|
plugins:
|
||||||
watch-events:
|
watch-events:
|
||||||
shortCut: Shift-E
|
shortCut: Shift-E
|
||||||
confirm: false
|
confirm: false
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ apps:
|
||||||
|
|
||||||
parts:
|
parts:
|
||||||
build:
|
build:
|
||||||
plugin: go
|
plugins: go
|
||||||
source: https://github.com/derailed/k9s.git
|
source: https://github.com/derailed/k9s.git
|
||||||
source-tag: $SNAPCRAFT_PROJECT_VERSION
|
source-tag: $SNAPCRAFT_PROJECT_VERSION
|
||||||
override-build: |
|
override-build: |
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue