K9s 1186: prev logs (#1190)

* fix cron triggers

* fix cron triggers again...

* fix #1186

* update rel notes
mine
Fernand Galiana 2021-07-08 07:11:35 -06:00 committed by GitHub
parent 97e6c4b75a
commit 026adfbfbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 13 deletions

View File

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

View File

@ -0,0 +1,24 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s_small.png" align="right" width="200" height="auto"/>
# Release v0.24.14
## 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 #1186](https://github.com/derailed/k9s/issues/1186) Viewing previous logs does not work
* [Issue #1167](https://github.com/derailed/k9s/issues/1167) Cronjob trigger busted with feelings!
---
<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

@ -91,7 +91,7 @@ func (c *Container) k9sEnv() Env {
return env
}
func (c *Container) logOptions() (*dao.LogOptions, error) {
func (c *Container) logOptions(prev bool) (*dao.LogOptions, error) {
path := c.GetTable().GetSelectedItem()
if path == "" {
return nil, errors.New("nothing selected")
@ -105,6 +105,7 @@ func (c *Container) logOptions() (*dao.LogOptions, error) {
SinceSeconds: cfg.SinceSeconds,
SingleContainer: true,
ShowTimestamp: cfg.ShowTime,
Previous: prev,
}
return &opts, nil

View File

@ -45,7 +45,7 @@ func (d *Deploy) bindKeys(aa ui.KeyActions) {
})
}
func (d *Deploy) logOptions() (*dao.LogOptions, error) {
func (d *Deploy) logOptions(prev bool) (*dao.LogOptions, error) {
path := d.GetTable().GetSelectedItem()
if path == "" {
return nil, errors.New("you must provide a selection")
@ -78,6 +78,7 @@ func (d *Deploy) logOptions() (*dao.LogOptions, error) {
SingleContainer: len(cc) == 1,
AllContainers: allCos,
ShowTimestamp: cfg.ShowTime,
Previous: prev,
}
if co == "" {
opts.AllContainers = true

View File

@ -63,11 +63,12 @@ func (l *LogsExtender) showLogs(path string, prev bool) {
opts := l.buildLogOpts(path, "", prev)
if l.optionsFn != nil {
if opts, err = l.optionsFn(); err != nil {
if opts, err = l.optionsFn(prev); err != nil {
l.App().Flash().Err(err)
return
}
}
if err := l.App().inject(NewLog(l.GVR(), opts)); err != nil {
l.App().Flash().Err(err)
}

View File

@ -85,7 +85,7 @@ func (p *Pod) bindKeys(aa ui.KeyActions) {
aa.Add(resourceSorters(p.GetTable()))
}
func (p *Pod) logOptions() (*dao.LogOptions, error) {
func (p *Pod) logOptions(prev bool) (*dao.LogOptions, error) {
path := p.GetTable().GetSelectedItem()
if path == "" {
return nil, errors.New("you must provide a selection")
@ -96,16 +96,14 @@ func (p *Pod) logOptions() (*dao.LogOptions, error) {
return nil, err
}
cc := fetchContainers(pod.Spec, true)
cfg := p.App().Config.K9s.Logger
cc, cfg := fetchContainers(pod.Spec, true), p.App().Config.K9s.Logger
opts := dao.LogOptions{
Path: path,
Lines: int64(cfg.TailCount),
SinceSeconds: cfg.SinceSeconds,
SingleContainer: len(cc) == 1,
AllContainers: false,
ShowTimestamp: cfg.ShowTime,
Previous: prev,
}
if c, ok := dao.GetDefaultLogContainer(pod.ObjectMeta, pod.Spec); ok {
opts.Container, opts.DefaultContainer = c, c

View File

@ -138,6 +138,9 @@ func batchViewers(vv MetaViewers) {
vv[client.NewGVR("batch/v1beta1/cronjobs")] = MetaViewer{
viewerFn: NewCronJob,
}
vv[client.NewGVR("batch/v1/cronjobs")] = MetaViewer{
viewerFn: NewCronJob,
}
vv[client.NewGVR("batch/v1/jobs")] = MetaViewer{
viewerFn: NewJob,
}

View File

@ -102,9 +102,9 @@ func (s *ScaleExtender) makeScaleForm(sel string) (*tview.Form, error) {
if err := s.scale(ctx, sel, count); err != nil {
log.Error().Err(err).Msgf("DP %s scaling failed", sel)
s.App().Flash().Err(err)
} else {
s.App().Flash().Infof("Resource %s:%s scaled successfully", s.GVR(), sel)
return
}
s.App().Flash().Infof("Resource %s:%s scaled successfully", s.GVR(), sel)
})
f.AddButton("Cancel", func() {

View File

@ -34,7 +34,7 @@ func NewStatefulSet(gvr client.GVR) ResourceViewer {
return &s
}
func (s *StatefulSet) logOptions() (*dao.LogOptions, error) {
func (s *StatefulSet) logOptions(prev bool) (*dao.LogOptions, error) {
path := s.GetTable().GetSelectedItem()
if path == "" {
return nil, errors.New("you must provide a selection")
@ -67,6 +67,7 @@ func (s *StatefulSet) logOptions() (*dao.LogOptions, error) {
SinceSeconds: cfg.SinceSeconds,
AllContainers: allCos,
ShowTimestamp: cfg.ShowTime,
Previous: prev,
}
if co == "" {
opts.AllContainers = true

View File

@ -31,7 +31,7 @@ type (
EnterFunc func(app *App, model ui.Tabular, gvr, path string)
// LogOptionsFunc returns the active log options.
LogOptionsFunc func() (*dao.LogOptions, error)
LogOptionsFunc func(bool) (*dao.LogOptions, error)
// ContextFunc enhances a given context.
ContextFunc func(context.Context) context.Context