From 3d4726d7264e37a2cbe4dfee57897b8e1ecd8949 Mon Sep 17 00:00:00 2001 From: derailed Date: Thu, 10 Sep 2020 14:36:00 -0600 Subject: [PATCH] maintenance drop for v0.21.8 --- Dockerfile | 6 ++-- Makefile | 2 +- README.md | 2 +- change_logs/release_v0.21.8.md | 52 ++++++++++++++++++++++++++++++++++ go.mod | 16 +++++------ go.sum | 31 +++++++++++++------- internal/config/config_test.go | 4 +-- internal/config/logger.go | 2 +- internal/config/styles.go | 4 +-- internal/dao/cronjob.go | 4 +-- internal/dao/popeye.go | 2 +- internal/model/cmd_buff.go | 2 +- internal/model/menu_hint.go | 8 ++++++ internal/ui/action.go | 2 +- internal/ui/app.go | 4 ++- internal/ui/dialog/confirm.go | 2 +- internal/ui/dialog/delete.go | 16 +++++------ internal/ui/prompt.go | 2 +- internal/ui/table_helper.go | 4 +-- internal/ui/tree.go | 2 +- internal/view/app.go | 9 ++---- internal/view/browser.go | 1 - internal/view/helpers.go | 1 - internal/view/node.go | 31 +++++++++++++------- internal/watch/factory.go | 1 + main.go | 2 -- 26 files changed, 143 insertions(+), 69 deletions(-) create mode 100644 change_logs/release_v0.21.8.md diff --git a/Dockerfile b/Dockerfile index 002059f6..f20d4b28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build... -FROM golang:1.14.4-alpine3.11 AS build +FROM golang:1.15.1-alpine3.12 AS build WORKDIR /k9s COPY go.mod go.sum main.go Makefile ./ @@ -10,10 +10,10 @@ RUN apk --no-cache add make git gcc libc-dev curl && make build # ----------------------------------------------------------------------------- # Build Image... -FROM alpine:3.10.0 +FROM alpine:3.12.0 COPY --from=build /k9s/execs/k9s /bin/k9s -ENV KUBE_LATEST_VERSION="v1.18.1" +ENV KUBE_LATEST_VERSION="v1.18.2" RUN apk add --update ca-certificates \ && apk add --update -t deps curl vim \ && curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \ diff --git a/Makefile b/Makefile index f3505c75..8f72c6d9 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ PACKAGE := github.com/derailed/$(NAME) GIT := $(shell git rev-parse --short HEAD) SOURCE_DATE_EPOCH ?= $(shell date +%s) DATE := $(shell date -u -d @${SOURCE_DATE_EPOCH} +%FT%T%Z) -VERSION ?= v0.21.7 +VERSION ?= v0.21.8 IMG_NAME := derailed/k9s IMAGE := ${IMG_NAME}:${VERSION} diff --git a/README.md b/README.md index 0fb5f0ae..32f23218 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ K9s uses aliases to navigate most K8s resources. | To bail out of K9s | `:q`, `ctrl-c` | | | View a Kubernetes resource using singular/plural or short-name | `:`po⏎ | accepts singular, plural, short-name or alias ie pod or pods | | View a Kubernetes resource in a given namespace | `:`alias namespace⏎ | | -| Filter out a resource view given a filter | `/`filter⏎ | | +| Filter out a resource view given a filter | `/`filter⏎ | Regex2 supported ie `fred|blee` to filter resources named fred or blee | | Filter resource view by labels | `/`-l label-selector⏎ | | | Fuzzy find a resource given a filter | `/`-f filter⏎ | | | Bails out of view/command/filter mode | `` | | diff --git a/change_logs/release_v0.21.8.md b/change_logs/release_v0.21.8.md new file mode 100644 index 00000000..ace4087c --- /dev/null +++ b/change_logs/release_v0.21.8.md @@ -0,0 +1,52 @@ + + +# Release v0.21.8 + +## 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 [sponsorhip 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! + +## ♫ The Sound Behind The Release ♭ + +I figured, why not share one of the tunes I was spinning when powering thru teh bugs? Might as well share the pain/pleasure while viewing this release notes roaght? + +[Strange Ritual - David Byrne](https://www.youtube.com/watch?v=gsramZ3sOjI) ;) + +## A Word From Our Sponsors... + +First off, I would like to send a `Big Thank You` to the following generous K9s friends for joining our sponsorship program and supporting this project! + +* [Jean-Luc Geering](https://github.com/jlgeering) +* [Takafumi Ikeda](https://github.com/ikeike443) + +Contrarily to popular belief, OSS is not free! We've now reached ~9k stars and 300k downloads! As you all know, this project is not pimped out by a big company with deep pockets and a large team. K9s is complex and does demand a lot of my time. So if this tool is useful to you and part of your daily lifecycle, please contribute! Your contribution whether financial, PRs, issues or shout-outs on social/blogs are crucial to keep K9s growing and powerful for all of us. Don't let OSS by individual contributors become an oxymoron! + +## Resolved Issues/Features + +* [Issue #871](https://github.com/derailed/k9s/issues/871) K9s memory leak when shell that launched k9s is terminated. +* [Issue #857](https://github.com/derailed/k9s/issues/857) Working in readonly mode. +* [Issue #855](https://github.com/derailed/k9s/issues/855) Some mouse support. +* [Issue #849](https://github.com/derailed/k9s/issues/849) Xray highlight color. +* [Issue #845](https://github.com/derailed/k9s/issues/845) CronJob trigger checks wrong permission. +* [Issue #837](https://github.com/derailed/k9s/issues/837) Hang after running plugin. + +## Resolved PRs + +* [PR #866](https://github.com/derailed/k9s/pull/866) Go 1.15 support convert int to string failure. Thank you [Trung](https://github.com/runlevel5)! +* [PR #864](https://github.com/derailed/k9s/pull/864) Add ppc64le target. Thank you once again [Trung](https://github.com/runlevel5)! +* [PR #863](https://github.com/derailed/k9s/pull/863) Update images in Dockerfile. Big thanks to [Peter Sutter](https://github.com/petersutter)! +* [PR #841](https://github.com/derailed/k9s/pull/841) Fix a type in bug report template. Thanks to [Jinsu Park](https://github.com/umi0410)! +* [PR #834](https://github.com/derailed/k9s/pull/834) Add Chocolatey installation. Thanks to [Romain](https://github.com/romch007)! +* [PR #828](https://github.com/derailed/k9s/pull/828) Add solarized dark skin. Big Thanks to [Dan Mikita](https://github.com/danmikita)! + +--- + + © 2020 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0) diff --git a/go.mod b/go.mod index 28043dcc..08d053a8 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/derailed/k9s -go 1.14 +go 1.15 require ( github.com/atotto/clipboard v0.1.2 - github.com/derailed/popeye v0.8.8 - github.com/derailed/tview v0.4.3 + github.com/derailed/popeye v0.8.10 + github.com/derailed/tview v0.4.5 github.com/drone/envsubst v1.0.2 // indirect github.com/fatih/color v1.9.0 github.com/fsnotify/fsnotify v1.4.7 @@ -31,13 +31,13 @@ require ( google.golang.org/grpc v1.29.1 // indirect gopkg.in/yaml.v2 v2.2.8 helm.sh/helm/v3 v3.2.0 - k8s.io/api v0.18.2 - k8s.io/apimachinery v0.18.2 - k8s.io/cli-runtime v0.18.2 - k8s.io/client-go v0.18.2 + k8s.io/api v0.18.8 + k8s.io/apimachinery v0.18.8 + k8s.io/cli-runtime v0.18.8 + k8s.io/client-go v0.18.8 k8s.io/klog v1.0.0 k8s.io/kubectl v0.18.2 - k8s.io/metrics v0.18.2 + k8s.io/metrics v0.18.8 rsc.io/letsencrypt v0.0.3 // indirect sigs.k8s.io/yaml v1.2.0 vbom.ml/util v0.0.0-20180919145318-efcd4e0f9787 diff --git a/go.sum b/go.sum index d30e2137..11cd37a9 100644 --- a/go.sum +++ b/go.sum @@ -145,16 +145,14 @@ github.com/deislabs/oras v0.8.1 h1:If674KraJVpujYR00rzdi0QAmW4BxzMJPVAZJKuhQ0c= github.com/deislabs/oras v0.8.1/go.mod h1:Mx0rMSbBNaNfY9hjpccEnxkOqJL6KGjtxNHPLC4G4As= github.com/denisenkom/go-mssqldb v0.0.0-20191001013358-cfbb681360f0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/derailed/popeye v0.8.8 h1:C17YTKOh1KOCBjy1SYPN/UAocFR4DKYCXfdCSvKUrSg= -github.com/derailed/popeye v0.8.8/go.mod h1:+u3tvVxADQQ2o6iJjgAO8cnQFq/GIWEUPXEWa1N6l54= -github.com/derailed/tview v0.4.0 h1:PQIuBqU9+XxiPjQ+7tJKyoxIMm/cZErqY4sZgJjxhL8= -github.com/derailed/tview v0.4.0/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII= -github.com/derailed/tview v0.4.1 h1:SJNEgmXxmbxKgaW9g0SfwsqNAPwKDpjyx7u4IFJ18Hc= -github.com/derailed/tview v0.4.1/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII= -github.com/derailed/tview v0.4.2 h1:sOeYbUjvNUHD6UCBsXdmVL1qFbKDC321y/98KXpJIiU= -github.com/derailed/tview v0.4.2/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII= +github.com/derailed/popeye v0.8.10 h1:V0767TmO+nOlzszU2zQIDwNzEg6Iw36RqciYL6/LvtA= +github.com/derailed/popeye v0.8.10/go.mod h1:yjWFWX32SD1eaS5uXuPZJQQgJTUr/DkV81939yJoFzM= github.com/derailed/tview v0.4.3 h1:etpvS/0FwUKMys0cCciNFl6xDTEcpV/3aoS4zxliOvs= github.com/derailed/tview v0.4.3/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII= +github.com/derailed/tview v0.4.4 h1:uQAeuC6XGSayDETw6oSoMtoPTzoW90WJHNclDC6ZfX4= +github.com/derailed/tview v0.4.4/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII= +github.com/derailed/tview v0.4.5 h1:DY9JVuavEUo+cA4DLTrjoelXBlBVfwcmq/wBRiFPh00= +github.com/derailed/tview v0.4.5/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII= github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= @@ -194,6 +192,7 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v0.0.0-20200808040245-162e5629780b/go.mod h1:NAJj0yf/KaRKURN6nyi7A9IZydMivZEm9oQLWNjfKDc= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -375,6 +374,7 @@ github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= @@ -850,25 +850,32 @@ k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ= k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= +k8s.io/api v0.18.8 h1:aIKUzJPb96f3fKec2lxtY7acZC9gQNDLVhfSGpxBAC4= +k8s.io/api v0.18.8/go.mod h1:d/CXqwWv+Z2XEG1LgceeDmHQwpUJhROPx16SlxJgERY= k8s.io/apiextensions-apiserver v0.18.0 h1:HN4/P8vpGZFvB5SOMuPPH2Wt9Y/ryX+KRvIyAkchu1Q= k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo= k8s.io/apimachinery v0.18.0 h1:fuPfYpk3cs1Okp/515pAf0dNhL66+8zk8RLbSX+EgAE= k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/apimachinery v0.18.8 h1:jimPrycCqgx2QPearX3to1JePz7wSbVLq+7PdBTTwQ0= +k8s.io/apimachinery v0.18.8/go.mod h1:6sQd+iHEqmOtALqOFjSWp2KZ9F0wlU/nWm0ZgsYWMig= k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw= k8s.io/cli-runtime v0.18.0 h1:jG8XpSqQ5TrV0N+EZ3PFz6+gqlCk71dkggWCCq9Mq34= k8s.io/cli-runtime v0.18.0/go.mod h1:1eXfmBsIJosjn9LjEBUd2WVPoPAY9XGTqTFcPMIBsUQ= k8s.io/cli-runtime v0.18.2 h1:JiTN5RgkFNTiMxHBRyrl6n26yKWAuNRlei1ZJALUmC8= k8s.io/cli-runtime v0.18.2/go.mod h1:yfFR2sQQzDsV0VEKGZtrJwEy4hLZ2oj4ZIfodgxAHWQ= +k8s.io/cli-runtime v0.18.8 h1:ycmbN3hs7CfkJIYxJAOB10iW7BVPmXGXkfEyiV9NJ+k= +k8s.io/cli-runtime v0.18.8/go.mod h1:7EzWiDbS9PFd0hamHHVoCY4GrokSTPSL32MA4rzIu0M= k8s.io/client-go v0.18.0 h1:yqKw4cTUQraZK3fcVCMeSa+lqKwcjZ5wtcOIPnxQno4= k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8= k8s.io/client-go v0.18.2 h1:aLB0iaD4nmwh7arT2wIn+lMnAq7OswjaejkQ8p9bBYE= k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= -k8s.io/client-go v1.5.1 h1:XaX/lo2/u3/pmFau8HN+sB5C/b4dc4Dmm2eXjBH4p1E= -k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwnJo9o= +k8s.io/client-go v0.18.8 h1:SdbLpIxk5j5YbFr1b7fq8S7mDgDjYmUxSbszyoesoDM= +k8s.io/client-go v0.18.8/go.mod h1:HqFqMllQ5NnQJNwjro9k5zMyfhZlOwpuTLVrxjkYSxU= k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/code-generator v0.18.8/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= k8s.io/component-base v0.18.0 h1:I+lP0fNfsEdTDpHaL61bCAqTZLoiWjEEP304Mo5ZQgE= k8s.io/component-base v0.18.0/go.mod h1:u3BCg0z1uskkzrnAKFzulmYaEpZF7XC9Pf/uFyb1v2c= k8s.io/component-base v0.18.2 h1:SJweNZAGcUvsypLGNPNGeJ9UgPZQ6+bW+gEHe8uyh/Y= @@ -881,6 +888,8 @@ k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= +k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY= +k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kubectl v0.18.0 h1:hu52Ndq/d099YW+3sS3VARxFz61Wheiq8K9S7oa82Dk= k8s.io/kubectl v0.18.0/go.mod h1:LOkWx9Z5DXMEg5KtOjHhRiC1fqJPLyCr3KtQgEolCkU= k8s.io/kubectl v0.18.2 h1:9jnGSOC2DDVZmMUTMi0D1aed438mfQcgqa5TAzVjA1k= @@ -890,6 +899,8 @@ k8s.io/metrics v0.18.0 h1:yTt/yuRVW1XfnBg8DcOGecW+rrR7VxrMUXYIiUqSELE= k8s.io/metrics v0.18.0/go.mod h1:8aYTW18koXqjLVKL7Ds05RPMX9ipJZI3mywYvBOxXd4= k8s.io/metrics v0.18.2 h1:v4J7WKu/Zo/htSH3w//UWJZT9/CpUThXWYyUbQ/F/jY= k8s.io/metrics v0.18.2/go.mod h1:qga8E7QfYNR9Q89cSCAjinC9pTZ7yv1XSVGUB0vJypg= +k8s.io/metrics v0.18.8 h1:Obf262GVd2Uy+WbPkOXNiZroI5mT8zYoKK3Y/8KF7Yc= +k8s.io/metrics v0.18.8/go.mod h1:j7JzZdiyhLP2BsJm/Fzjs+j5Lb1Y7TySjhPWqBPwRXA= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= rsc.io/letsencrypt v0.0.3 h1:H7xDfhkaFFSYEJlKeq38RwX2jYcnTeHuDQyT+mMNMwM= diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 353534cf..b57aa88e 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -267,7 +267,7 @@ var expectedConfig = `k9s: logger: tail: 500 buffer: 800 - sinceSeconds: -1 + sinceSeconds: 5 fullScreenLogs: false textWrap: false showTime: false @@ -347,7 +347,7 @@ var resetConfig = `k9s: logger: tail: 200 buffer: 2000 - sinceSeconds: -1 + sinceSeconds: 5 fullScreenLogs: false textWrap: false showTime: false diff --git a/internal/config/logger.go b/internal/config/logger.go index 66f0d1bb..1dc05d15 100644 --- a/internal/config/logger.go +++ b/internal/config/logger.go @@ -10,7 +10,7 @@ const ( // MaxLogThreshold sets the max value for log size. MaxLogThreshold = 5000 // DefaultSinceSeconds tracks default log age. - DefaultSinceSeconds = -1 // all logs + DefaultSinceSeconds = 5 // all logs ) // Logger tracks logger options diff --git a/internal/config/styles.go b/internal/config/styles.go index b81daa8b..46a917bc 100644 --- a/internal/config/styles.go +++ b/internal/config/styles.go @@ -341,9 +341,9 @@ func newXray() Xray { return Xray{ FgColor: "aqua", BgColor: "black", - CursorColor: "whitesmoke", + CursorColor: "aqua", CursorTextColor: "black", - GraphicColor: "floralwhite", + GraphicColor: "cadetblue", } } diff --git a/internal/dao/cronjob.go b/internal/dao/cronjob.go index 2c2b34d9..865576b3 100644 --- a/internal/dao/cronjob.go +++ b/internal/dao/cronjob.go @@ -31,12 +31,12 @@ type CronJob struct { // Run a CronJob. func (c *CronJob) Run(path string) error { ns, _ := client.Namespaced(path) - auth, err := c.Client().CanI(ns, "batch/v1beta1/cronjobs", []string{client.GetVerb, client.CreateVerb}) + auth, err := c.Client().CanI(ns, "batch/v1/jobs", []string{client.GetVerb, client.CreateVerb}) if err != nil { return err } if !auth { - return fmt.Errorf("user is not authorize to run cronjobs") + return fmt.Errorf("user is not authorized to run jobs") } o, err := c.Factory.Get("batch/v1beta1/cronjobs", path, true, labels.Everything()) diff --git a/internal/dao/popeye.go b/internal/dao/popeye.go index f536b4a3..0fd8130b 100644 --- a/internal/dao/popeye.go +++ b/internal/dao/popeye.go @@ -84,7 +84,7 @@ 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 { + if _, err = popeye.Sanitize(); err != nil { log.Debug().Msgf("BOOM %#v", *flags.Sections) return nil, err } diff --git a/internal/model/cmd_buff.go b/internal/model/cmd_buff.go index 4ab8011c..654c3d31 100644 --- a/internal/model/cmd_buff.go +++ b/internal/model/cmd_buff.go @@ -67,7 +67,7 @@ func (c *CmdBuff) SetText(cmd string) { c.fireBufferChanged() } -// Add adds a new charater to the buffer. +// Add adds a new character to the buffer. func (c *CmdBuff) Add(r rune) { c.buff = append(c.buff, r) c.fireBufferChanged() diff --git a/internal/model/menu_hint.go b/internal/model/menu_hint.go index 4e1f0123..25234520 100644 --- a/internal/model/menu_hint.go +++ b/internal/model/menu_hint.go @@ -17,17 +17,25 @@ func (m MenuHint) IsBlank() bool { return m.Mnemonic == "" && m.Description == "" && !m.Visible } +// String returns a string representation. +func (h MenuHint) String() string { + return h.Mnemonic +} + // MenuHints represents a collection of hints. type MenuHints []MenuHint +// Len returns the hints length func (h MenuHints) Len() int { return len(h) } +// Swap swaps to elements. func (h MenuHints) Swap(i, j int) { h[i], h[j] = h[j], h[i] } +// Less returns true if first hint is less than second. func (h MenuHints) Less(i, j int) bool { n, err1 := strconv.Atoi(h[i].Mnemonic) m, err2 := strconv.Atoi(h[j].Mnemonic) diff --git a/internal/ui/action.go b/internal/ui/action.go index a98da5ef..0491ee30 100644 --- a/internal/ui/action.go +++ b/internal/ui/action.go @@ -83,7 +83,7 @@ func (a KeyActions) Hints() model.MenuHints { }, ) } else { - log.Error().Msgf("Unable to locate KeyName for %#v", string(k)) + log.Error().Msgf("Unable to locate KeyName for %#v", k) } } return hh diff --git a/internal/ui/app.go b/internal/ui/app.go index 543b3ef0..1eaff1d9 100644 --- a/internal/ui/app.go +++ b/internal/ui/app.go @@ -1,6 +1,7 @@ package ui import ( + "os" "sync" "github.com/derailed/k9s/internal/client" @@ -54,7 +55,7 @@ func (a *App) Init() { a.cmdModel.AddListener(a) a.Styles.AddListener(a) - a.SetRoot(a.Main, true) + a.SetRoot(a.Main, true).EnableMouse(true) } // QueueUpdate queues up a ui action. @@ -144,6 +145,7 @@ func (a *App) bindKeys() { // BailOut exists the application. func (a *App) BailOut() { a.Stop() + os.Exit(0) } // ResetPrompt reset the prompt model and marks buffer as active. diff --git a/internal/ui/dialog/confirm.go b/internal/ui/dialog/confirm.go index 30aca5ec..6e8a6310 100644 --- a/internal/ui/dialog/confirm.go +++ b/internal/ui/dialog/confirm.go @@ -38,7 +38,7 @@ func ShowConfirm(styles config.Dialog, pages *ui.Pages, title, msg string, ack c b.SetBackgroundColorActivated(styles.ButtonFocusBgColor.Color()) b.SetLabelColorActivated(styles.ButtonFocusFgColor.Color()) } - + f.SetFocus(0) modal := tview.NewModalForm("<"+title+">", f) modal.SetText(msg) modal.SetTextColor(styles.FgColor.Color()) diff --git a/internal/ui/dialog/delete.go b/internal/ui/dialog/delete.go index 169270bd..20adc915 100644 --- a/internal/ui/dialog/delete.go +++ b/internal/ui/dialog/delete.go @@ -38,14 +38,14 @@ func ShowDelete(styles config.Dialog, pages *ui.Pages, msg string, ok okFunc, ca dismissDelete(pages) cancel() }) - for i := 0; i < 2; i++ { - b := f.GetButton(i) - if b == nil { - continue - } - b.SetBackgroundColorActivated(styles.ButtonFocusBgColor.Color()) - b.SetLabelColorActivated(styles.ButtonFocusFgColor.Color()) - } + // for i := 0; i < 2; i++ { + // b := f.GetButton(i) + // if b == nil { + // continue + // } + // b.SetBackgroundColorActivated(styles.ButtonFocusBgColor.Color()) + // b.SetLabelColorActivated(styles.ButtonFocusFgColor.Color()) + // } f.SetFocus(2) confirm := tview.NewModalForm("", f) diff --git a/internal/ui/prompt.go b/internal/ui/prompt.go index 4851447b..36628042 100644 --- a/internal/ui/prompt.go +++ b/internal/ui/prompt.go @@ -157,7 +157,7 @@ func (p *Prompt) keyboard(evt *tcell.EventKey) *tcell.EventKey { } } - return evt + return nil } // StylesChanged notifies skin changed. diff --git a/internal/ui/table_helper.go b/internal/ui/table_helper.go index 2e1662aa..294bed2c 100644 --- a/internal/ui/table_helper.go +++ b/internal/ui/table_helper.go @@ -138,7 +138,7 @@ func filterToast(data render.TableData) render.TableData { } func rxFilter(q string, data render.TableData) (render.TableData, error) { - rx, err := regexp.Compile(`(?i)` + q) + rx, err := regexp.Compile(`(?i)(` + q + `)`) if err != nil { return data, err } @@ -149,7 +149,7 @@ func rxFilter(q string, data render.TableData) (render.TableData, error) { Namespace: data.Namespace, } for _, re := range data.RowEvents { - fields := strings.Join(re.Row.Fields, " ") + fields := strings.Join(re.Row.Fields[:2], " ") if rx.MatchString(fields) { filtered.RowEvents = append(filtered.RowEvents, re) } diff --git a/internal/ui/tree.go b/internal/ui/tree.go index 77915f7e..84bad3cb 100644 --- a/internal/ui/tree.go +++ b/internal/ui/tree.go @@ -40,7 +40,7 @@ func (t *Tree) Init(ctx context.Context) error { t.SetBorderAttributes(tcell.AttrBold) t.SetBorderPadding(0, 0, 1, 1) t.SetGraphics(true) - t.SetGraphicsColor(tcell.ColorFloralWhite) + t.SetGraphicsColor(tcell.ColorCadetBlue) t.SetInputCapture(t.keyboard) return nil diff --git a/internal/view/app.go b/internal/view/app.go index 8a4e5344..705d6e6f 100644 --- a/internal/view/app.go +++ b/internal/view/app.go @@ -138,16 +138,11 @@ func (a *App) layout(ctx context.Context, version string) { func (a *App) initSignals() { sig := make(chan os.Signal, 1) - signal.Notify(sig, syscall.SIGABRT, syscall.SIGINT, syscall.SIGHUP, syscall.SIGQUIT) + signal.Notify(sig, syscall.SIGTERM, syscall.SIGABRT, syscall.SIGINT, syscall.SIGHUP, syscall.SIGQUIT) go func(sig chan os.Signal) { - signal := <-sig - if signal == syscall.SIGHUP { + if syscall.SIGHUP == <-sig { a.BailOut() - return - } - if err := nukeK9sShell(a); err != nil { - log.Error().Err(err).Msg("nuking k9s shell pod") } }(sig) } diff --git a/internal/view/browser.go b/internal/view/browser.go index bc62be20..dd638640 100644 --- a/internal/view/browser.go +++ b/internal/view/browser.go @@ -134,7 +134,6 @@ func (b *Browser) Start() { func (b *Browser) Stop() { log.Debug().Msgf("BRO-STOP %v", b.GVR()) if b.cancelFn != nil { - log.Debug().Msgf("Canceling!!") b.cancelFn() b.cancelFn = nil } diff --git a/internal/view/helpers.go b/internal/view/helpers.go index e3d68206..fd18e8a9 100644 --- a/internal/view/helpers.go +++ b/internal/view/helpers.go @@ -51,7 +51,6 @@ func k8sEnv(c *client.Config) Env { func defaultEnv(c *client.Config, path string, header render.Header, row render.Row) Env { env := k8sEnv(c) - log.Debug().Msgf("PATH %q::%q", path, row.Fields[1]) env["NAMESPACE"], env["NAME"] = client.Namespaced(path) for _, col := range header.Columns(true) { env["COL-"+col] = row.Fields[header.IndexOf(col, true)] diff --git a/internal/view/node.go b/internal/view/node.go index 254668a1..e30fa1bd 100644 --- a/internal/view/node.go +++ b/internal/view/node.go @@ -32,19 +32,12 @@ func NewNode(gvr client.GVR) ResourceViewer { return &n } -func (n *Node) bindKeys(aa ui.KeyActions) { - aa.Delete(ui.KeySpace, tcell.KeyCtrlSpace, tcell.KeyCtrlD) +func (n *Node) bindDangerousKeys(aa ui.KeyActions) { aa.Add(ui.KeyActions{ - ui.KeyY: ui.NewKeyAction("YAML", n.yamlCmd, true), - ui.KeyC: ui.NewKeyAction("Cordon", n.toggleCordonCmd(true), true), - ui.KeyU: ui.NewKeyAction("Uncordon", n.toggleCordonCmd(false), true), - ui.KeyR: ui.NewKeyAction("Drain", n.drainCmd, true), - ui.KeyShiftC: ui.NewKeyAction("Sort CPU", n.GetTable().SortColCmd(cpuCol, false), false), - ui.KeyShiftM: ui.NewKeyAction("Sort MEM", n.GetTable().SortColCmd(memCol, false), false), - ui.KeyShiftX: ui.NewKeyAction("Sort CPU%", n.GetTable().SortColCmd("%CPU", false), false), - ui.KeyShiftZ: ui.NewKeyAction("Sort MEM%", n.GetTable().SortColCmd("%MEM", false), false), + ui.KeyC: ui.NewKeyAction("Cordon", n.toggleCordonCmd(true), true), + ui.KeyU: ui.NewKeyAction("Uncordon", n.toggleCordonCmd(false), true), + ui.KeyR: ui.NewKeyAction("Drain", n.drainCmd, true), }) - cl := n.App().Config.K9s.CurrentCluster if n.App().Config.K9s.Clusters[cl].FeatureGates.NodeShell { aa.Add(ui.KeyActions{ @@ -53,6 +46,22 @@ func (n *Node) bindKeys(aa ui.KeyActions) { } } +func (n *Node) bindKeys(aa ui.KeyActions) { + aa.Delete(ui.KeySpace, tcell.KeyCtrlSpace, tcell.KeyCtrlD) + + if !n.App().Config.K9s.GetReadOnly() { + n.bindDangerousKeys(aa) + } + + aa.Add(ui.KeyActions{ + ui.KeyY: ui.NewKeyAction("YAML", n.yamlCmd, true), + ui.KeyShiftC: ui.NewKeyAction("Sort CPU", n.GetTable().SortColCmd(cpuCol, false), false), + ui.KeyShiftM: ui.NewKeyAction("Sort MEM", n.GetTable().SortColCmd(memCol, false), false), + ui.KeyShiftX: ui.NewKeyAction("Sort CPU%", n.GetTable().SortColCmd("%CPU", false), false), + ui.KeyShiftZ: ui.NewKeyAction("Sort MEM%", n.GetTable().SortColCmd("%MEM", false), false), + }) +} + func (n *Node) showPods(a *App, _ ui.Tabular, _, path string) { showPods(a, n.GetTable().GetSelectedItem(), client.AllNamespaces, "spec.nodeName="+path) } diff --git a/internal/watch/factory.go b/internal/watch/factory.go index 300081aa..ee53181f 100644 --- a/internal/watch/factory.go +++ b/internal/watch/factory.go @@ -141,6 +141,7 @@ func (f *Factory) waitForCacheSync(ns string) { // Hang for a sec for the cache to refresh if still not done bail out! c := make(chan struct{}) go func(c chan struct{}) { + defer log.Debug().Msgf("CacheSync done!") <-time.After(defaultWaitTime) close(c) }(c) diff --git a/main.go b/main.go index 77751e55..a040a539 100644 --- a/main.go +++ b/main.go @@ -3,8 +3,6 @@ package main import ( "os" - _ "net/http/pprof" - "github.com/derailed/k9s/cmd" "github.com/derailed/k9s/internal/config" "github.com/rs/zerolog"