Skip to content

Commit

Permalink
fix #1203 #1206
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Aug 5, 2021
1 parent a034251 commit c04e886
Show file tree
Hide file tree
Showing 7 changed files with 288 additions and 127 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -----------------------------------------------------------------------------
# The base image for building the k9s binary

FROM golang:1.16.5-alpine3.13 AS build
FROM golang:1.16.6-alpine3.13 AS build

WORKDIR /k9s
COPY go.mod go.sum main.go Makefile ./
Expand Down
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ replace (
require (
github.com/atotto/clipboard v0.1.4
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cenkalti/backoff/v4 v4.1.0
github.com/derailed/popeye v0.9.0
github.com/cenkalti/backoff/v4 v4.1.1
github.com/derailed/popeye v0.9.7
github.com/derailed/tview v0.6.1
github.com/drone/envsubst v1.0.2 // indirect
github.com/fatih/color v1.10.0
github.com/drone/envsubst v1.0.3 // indirect
github.com/fatih/color v1.12.0
github.com/fsnotify/fsnotify v1.4.9
github.com/fvbommel/sortorder v1.0.2
github.com/gdamore/tcell/v2 v2.3.1
github.com/ghodss/yaml v1.0.0
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.12
github.com/mattn/go-runewidth v0.0.13
github.com/openfaas/faas v0.0.0-20200207215241-6afae214e3ec
github.com/openfaas/faas-cli v0.0.0-20200124160744-30b7cec9634c
github.com/openfaas/faas-provider v0.15.0
github.com/petergtz/pegomock v2.9.0+incompatible
github.com/rakyll/hey v0.1.4
github.com/rs/zerolog v1.22.0
github.com/rs/zerolog v1.23.0
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sahilm/fuzzy v0.1.0
github.com/spf13/cobra v1.1.3
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
golang.org/x/text v0.3.6
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.6.1
k8s.io/api v0.21.2
k8s.io/apimachinery v0.21.2
k8s.io/cli-runtime v0.21.2
k8s.io/client-go v0.21.2
k8s.io/klog/v2 v2.8.0
k8s.io/kubectl v0.21.2
k8s.io/metrics v0.21.2
helm.sh/helm/v3 v3.6.3
k8s.io/api v0.21.3
k8s.io/apimachinery v0.21.3
k8s.io/cli-runtime v0.21.3
k8s.io/client-go v0.21.3
k8s.io/klog/v2 v2.10.0
k8s.io/kubectl v0.21.3
k8s.io/metrics v0.21.3
sigs.k8s.io/yaml v1.2.0
)
362 changes: 259 additions & 103 deletions go.sum

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,16 @@ func (c *Config) Refine(flags *genericclioptions.ConfigFlags, k9sFlags *Flags) e
ns, override = client.NamespaceAll, true
} else if isSet(flags.Namespace) {
ns, override = *flags.Namespace, true
} else if len(context.Namespace) != 0 {
} else if context.Namespace != "" {
ns = context.Namespace
}
if err := c.SetActiveNamespace(ns); err != nil {
return err

if ns != "" {
if err := c.SetActiveNamespace(ns); err != nil {
return err
}
flags.Namespace, c.overrideNS = &ns, override
}
flags.Namespace, c.overrideNS = &ns, override

if isSet(flags.ClusterName) {
c.K9s.CurrentCluster = *flags.ClusterName
Expand Down
4 changes: 2 additions & 2 deletions internal/dao/popeye.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func (p *Popeye) List(ctx context.Context, ns string) ([]runtime.Object, error)

buff := readWriteCloser{Buffer: bytes.NewBufferString("")}
popeye.SetOutputTarget(buff)
if _, err = popeye.Sanitize(); err != nil {
log.Debug().Msgf("BOOM %#v", *flags.Sections)
if _, _, err = popeye.Sanitize(); err != nil {
log.Error().Err(err).Msgf("BOOM %#v", *flags.Sections)
return nil, err
}

Expand Down
2 changes: 2 additions & 0 deletions internal/view/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"os"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -272,6 +273,7 @@ var EOL = []byte{'\n'}

// Flush write logs to viewer.
func (l *Log) Flush(lines [][]byte) {
log.Debug().Msgf("LINES [%d]%d", runtime.NumGoroutine(), len(strings.Split(l.logs.GetText(true), "\n")))
if !l.indicator.AutoScroll() {
return
}
Expand Down
4 changes: 2 additions & 2 deletions internal/view/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ func (s *Service) showPods(a *App, _ ui.Tabular, gvr, path string) {
a.Flash().Err(err)
return
}

if svc.Spec.Type == v1.ServiceTypeExternalName {
a.Flash().Warnf("No pod view available. Service %s is an external service.", path)
a.Flash().Warnf("No matching pods. Service %s is an external service.", path)
return
}

showPodsWithLabels(a, path, svc.Spec.Selector)
}

Expand Down

0 comments on commit c04e886

Please sign in to comment.