Skip to content

Commit ee0ff68

Browse files
authored
Merge branch 'master' into 1875-make-menu-foreground-brighter
2 parents 267d870 + cc1c86c commit ee0ff68

File tree

225 files changed

+4207
-1731
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+4207
-1731
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: K9s Lint
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [ master ]
66

77
jobs:
88
golangci:
@@ -12,13 +12,13 @@ jobs:
1212
uses: actions/[email protected]
1313

1414
- name: Install Go
15-
uses: actions/setup-go@v5.1.0
15+
uses: actions/setup-go@v5.3.0
1616
with:
1717
go-version-file: go.mod
1818
cache-dependency-path: go.sum
1919

2020
- name: Lint
21-
uses: golangci/golangci-lint-action@v6.1.1
21+
uses: golangci/golangci-lint-action@v6.3.2
2222
with:
2323
github_token: ${{ secrets.GITHUB_TOKEN }}
2424
reporter: github-pr-check

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/[email protected]
2020

2121
- name: Install Go
22-
uses: actions/setup-go@v5.1.0
22+
uses: actions/setup-go@v5.3.0
2323
with:
2424
go-version-file: go.mod
2525
cache-dependency-path: go.sum

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ demos
2424
kind
2525
*.snap
2626
/stresser
27+
__debug_bin*

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# options for analysis running
22
run:
3-
# default concurrency is a available CPU number
3+
# default concurrency is an available CPU number
44
concurrency: 8
55

66
# timeout for analysis, e.g. 30s, 5m, default is 1m

Dockerfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# -----------------------------------------------------------------------------
22
# The base image for building the k9s binary
33

4-
FROM golang:1.23-alpine3.20 AS build
4+
FROM golang:1.23.6-alpine3.20 AS build
55

66
WORKDIR /k9s
77
COPY go.mod go.sum main.go Makefile ./
88
COPY internal internal
99
COPY cmd cmd
10-
RUN apk --no-cache add --update make libx11-dev git gcc libc-dev curl && make build
10+
RUN apk --no-cache add --update make libx11-dev git gcc libc-dev curl \
11+
&& make build
1112

1213
# -----------------------------------------------------------------------------
1314
# Build the final Docker image
1415

15-
FROM alpine:3.20.3
16-
ARG KUBECTL_VERSION="v1.29.0"
16+
FROM alpine:3.21.2
17+
ARG KUBECTL_VERSION="v1.31.2"
1718

1819
COPY --from=build /k9s/execs/k9s /bin/k9s
19-
RUN apk add --update ca-certificates \
20-
&& apk add --update -t deps curl vim \
20+
RUN apk --no-cache add --update ca-certificates \
21+
&& apk --no-cache add --update -t deps curl vim \
2122
&& TARGET_ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) \
22-
&& curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${TARGET_ARCH}/kubectl -o /usr/local/bin/kubectl \
23+
&& curl -f -L https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGET_ARCH}/kubectl -o /usr/local/bin/kubectl \
2324
&& chmod +x /usr/local/bin/kubectl \
24-
&& apk del --purge deps \
25-
&& rm /var/cache/apk/*
25+
&& apk del --purge deps
2626

2727
ENTRYPOINT [ "/bin/k9s" ]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DATE ?= $(shell TZ=UTC date -j -f "%s" ${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:
1111
else
1212
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
1313
endif
14-
VERSION ?= v0.32.6
14+
VERSION ?= v0.40.0
1515
IMG_NAME := derailed/k9s
1616
IMAGE := ${IMG_NAME}:${VERSION}
1717

README.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Please refer to our [K9s documentation](https://k9scli.io) site for installation
6868

6969
Wanna discuss K9s features with your fellow `K9sers` or simply show your support for this tool?
7070

71-
* Channel: [K9ersSlack](https://k9sers.slack.com/)
71+
* Channel: [K9sersSlack](https://k9sers.slack.com/)
7272
* Invite: [K9slackers Invite](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)
7373

7474
## Installation
@@ -115,7 +115,7 @@ Binaries for Linux, Windows and Mac are available as tarballs in the [release pa
115115
* On Ubuntu
116116

117117
```shell
118-
wget https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_linux_amd64.deb && apt install ./k9s_linux_amd64.deb && rm k9s_linux_amd64.deb
118+
wget https://github.com/derailed/k9s/releases/download/v0.32.7/k9s_linux_amd64.deb && apt install ./k9s_linux_amd64.deb && rm k9s_linux_amd64.deb
119119
```
120120

121121
* Via [Winget](https://github.com/microsoft/winget-cli) for Windows
@@ -171,7 +171,7 @@ Binaries for Linux, Windows and Mac are available as tarballs in the [release pa
171171

172172
## Building From Source
173173

174-
K9s is currently using GO v1.22.X or above.
174+
K9s is currently using GO v1.23.X or above.
175175
In order to build K9s from source you must:
176176

177177
1. Clone the repo
@@ -362,6 +362,8 @@ K9s uses aliases to navigate most K8s resources.
362362
| To view and switch to another Kubernetes context (Pod view) | `:`ctx⏎ | |
363363
| To view and switch directly to another Kubernetes context (Last used view) | `:`ctx context-name⏎ | |
364364
| To view and switch to another Kubernetes namespace | `:`ns⏎ | |
365+
| To switch back to the last active command (like how "cd -" works) | `-` | Navigation that adds breadcrumbs to the bottom are not commands |
366+
| To go back and forward through the command history | back: `[`, forward: `]` | Same as above |
365367
| To view all saved resources | `:`screendump or sd⏎ | |
366368
| To delete a resource (TAB and ENTER to confirm) | `ctrl-d` | |
367369
| To kill a resource (no confirmation dialog, equivalent to kubectl delete --now) | `ctrl-k` | |
@@ -396,7 +398,7 @@ You can now override the context portForward default address configuration by se
396398
maxConnRetry: 5
397399
# Indicates whether modification commands like delete/kill/edit are disabled. Default is false
398400
readOnly: false
399-
# Toggles whether k9s should exit when CTRL-C is pressed. When set to true, you will need to exist k9s via the :quit command. Default is false.
401+
# Toggles whether k9s should exit when CTRL-C is pressed. When set to true, you will need to exit k9s via the :quit command. Default is false.
400402
noExitOnCtrlC: false
401403
#UI settings
402404
ui:
@@ -411,13 +413,13 @@ You can now override the context portForward default address configuration by se
411413
noIcons: false
412414
# Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live Defaults to false.
413415
reactive: false
414-
# By default all contexts wil use the dracula skin unless explicitly overridden in the context config file.
416+
# By default all contexts will use the dracula skin unless explicitly overridden in the context config file.
415417
skin: dracula # => assumes the file skins/dracula.yaml is present in the $XDG_DATA_HOME/k9s/skins directory
416418
# Allows to set certain views default fullscreen mode. (yaml, helm history, describe, value_extender, details, logs) Default false
417419
defaultsToFullScreen: false
418420
# Toggles icons display as not all terminal support these chars.
419421
noIcons: false
420-
# Toggles whether k9s should check for the latest revision from the Github repository releases. Default is false.
422+
# Toggles whether k9s should check for the latest revision from the GitHub repository releases. Default is false.
421423
skipLatestRevCheck: false
422424
# When altering kubeconfig or using multiple kube configs, k9s will clean up clusters configurations that are no longer in use. Setting this flag to true will keep k9s from cleaning up inactive cluster configs. Defaults to false.
423425
keepMissingClusters: false
@@ -431,6 +433,8 @@ You can now override the context portForward default address configuration by se
431433
sinceSeconds: 300 # => tail the last 5 mins.
432434
# Toggles log line wrap. Default false
433435
textWrap: false
436+
# Autoscroll in logs will be disabled. Default is false.
437+
disableAutoscroll: false
434438
# Toggles log line timestamp info. Default false
435439
showTime: false
436440
# Provide shell pod customization when nodeShell feature gate is enabled!
@@ -563,6 +567,13 @@ In order to surface hotkeys globally please follow these steps:
563567

564568
---
565569

570+
## Port Forwarding over websockets
571+
572+
K9s follows `kubectl` feature flag environment variables to enable/disable port-forwarding over websockets. (default enabled in >1.30)
573+
To disable Websocket support, set `KUBECTL_PORT_FORWARD_WEBSOCKETS=false`
574+
575+
---
576+
566577
## FastForwards
567578

568579
As of v0.25.0, you can leverage the `FastForwards` feature to tell K9s how to default port-forwards. In situations where you are dealing with multiple containers or containers exposing multiple ports, it can be cumbersome to specify the desired port-forward from the dialog as in most cases, you already know which container/port tuple you desire. For these use cases, you can now annotate your manifests with the following annotations:
@@ -620,7 +631,25 @@ The annotation value must specify a container to forward to as well as a local p
620631

621632
You can change which columns shows up for a given resource via custom views. To surface this feature, you will need to create a new configuration file, namely `$XDG_CONFIG_HOME/k9s/views.yaml`. This file leverages GVR (Group/Version/Resource) to configure the associated table view columns. If no GVR is found for a view the default rendering will take over (ie what we have now). Going wide will add all the remaining columns that are available on the given resource after your custom columns. To boot, you can edit your views config file and tune your resources views live!
622633

623-
> NOTE: This is experimental and will most likely change as we iron this out!
634+
📢 🎉 As of `release v0.40.0` you can specify json parse expressions to further customize your resources rendering.
635+
636+
The new column syntax is as follows:
637+
638+
> COLUMN_NAME<:json_parse_expression><|column_attributes>
639+
640+
Where `:json_parse_expression` represents an expression to pull a specific snippet out of the resource manifest.
641+
Similar to `kubectl -o custom-columns` command. This expression is optional.
642+
643+
Additionally, you can specify column attributes to further tailor the column rendering.
644+
To use this you will need to add a `|` indicator followed by your rendering bits.
645+
You can have one or more of the following attributes:
646+
647+
* `T` -> time column indicator
648+
* `N` -> number column indicator
649+
* `W` -> turns on wide column aka only shows while in wide mode. Defaults to the standard resource definition when present.
650+
* `H` -> Hides the column
651+
* `L` -> Left align (default)
652+
* `R` -> Right align
624653

625654
Here is a sample views configuration that customize a pods and services views.
626655

@@ -630,7 +659,9 @@ views:
630659
v1/pods:
631660
columns:
632661
- AGE
633-
- NAMESPACE
662+
- NAMESPACE|WR # => 🌚 Specifies the NAMESPACE column to be right aligned and only visible while in wide mode
663+
- ZORG:.metadata.labels.fred\.io\.kubernetes\.blee # => 🌚 extract fred.io.kubernetes.blee label into it's own column
664+
- BLEE:.metadata.annotations.blee|R # => 🌚 extract annotation blee into it's own column and right align it
634665
- NAME
635666
- IP
636667
- NODE
@@ -645,6 +676,8 @@ views:
645676
- CLUSTER-IP
646677
```
647678

679+
> 🩻 NOTE: This is experimental and will most likely change as we iron this out!
680+
648681
---
649682

650683
## Plugins
@@ -654,15 +687,15 @@ K9s allows you to extend your command line and tooling by defining your very own
654687
A plugin is defined as follows:
655688

656689
* Shortcut option represents the key combination a user would type to activate the plugin. Valid values are [a-z], Shift-[A-Z], Ctrl-[A-Z].
657-
* Override option make that the default action related to the shortcut will be overrided by the plugin
690+
* Override option make that the default action related to the shortcut will be overridden by the plugin
658691
* Confirm option (when enabled) lets you see the command that is going to be executed and gives you an option to confirm or prevent execution
659692
* Description will be printed next to the shortcut in the k9s menu
660693
* Scopes defines a collection of resources names/short-names for the views associated with the plugin. You can specify `all` to provide this shortcut for all views.
661694
* Command represents ad-hoc commands the plugin runs upon activation
662695
* Background specifies whether or not the command runs in the background
663696
* Args specifies the various arguments that should apply to the command above
664697
* OverwriteOutput boolean option allows plugin developers to provide custom messages on plugin stdout execution. See example in [#2644](https://github.com/derailed/k9s/pull/2644)
665-
* Dangerous boolean option enables disabling the plugin when read-only mode is set. See [#2604](https://github.com/derailed/k9s/issues/2604)
698+
* Dangerous boolean option enables disabling the plugin when read-only mode is set. See [#2604](https://github.com/derailed/k9s/issues/2604)
666699

667700
K9s does provide additional environment variables for you to customize your plugins arguments. Currently, the available environment variables are as follows:
668701

@@ -694,9 +727,9 @@ plugins:
694727
fred:
695728
shortCut: Ctrl-L
696729
override: false
697-
overwriteOutput: false
730+
overwriteOutput: false
698731
confirm: false
699-
dangerous: false
732+
dangerous: false
700733
description: Pod logs
701734
scopes:
702735
- pods
@@ -937,7 +970,7 @@ k9s:
937970
noIcons: false
938971
# Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live Defaults to false.
939972
reactive: false
940-
# By default all contexts wil use the dracula skin unless explicitly overridden in the context config file.
973+
# By default all contexts will use the dracula skin unless explicitly overridden in the context config file.
941974
skin: dracula # => assumes the file skins/dracula.yaml is present in the $XDG_DATA_HOME/k9s/skins directory
942975
defaultsToFullScreen: false
943976
skipLatestRevCheck: false
@@ -958,6 +991,7 @@ k9s:
958991
buffer: 5000
959992
sinceSeconds: -1
960993
textWrap: false
994+
disableAutoscroll: false
961995
showTime: false
962996
thresholds:
963997
cpu:
@@ -1083,12 +1117,12 @@ to make this project a reality!
10831117
10841118
## Meet The Core Team!
10851119
1120+
If you have chops in GO and K8s and would like to offer your time to help maintain and enhance this project, please reach out to me.
1121+
10861122
* [Fernand Galiana](https://github.com/derailed)
10871123
* <img src="assets/mail.png" width="16" height="auto" alt="email"/> [email protected]
10881124
* <img src="assets/twitter.png" width="16" height="auto" alt="twitter"/> [@kitesurfer](https://twitter.com/kitesurfer?lang=en)
10891125
1090-
* [Aleksei Romanenko](https://github.com/slimus)
1091-
10921126
We always enjoy hearing from folks who benefit from our work!
10931127
10941128
## Contributions Guideline

change_logs/release_0.1.2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ rev and see if we're happier with some of the fixes!
2222
```text
2323
>po<ENTER>
2424
```
25-
+ Similarly to filter on a given resource you can use `/' and type your filter.
25+
+ Similarly to filter on a given resource you can use `/` and type your filter.
2626
+ In both instances `<ESC>` will back you out of command mode and into navigation mode.
2727
2828
<br/>

change_logs/release_0.10.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Most of the refactors are around K8s resource fetching and viewing as well as na
2424

2525
## Custom Skins Per Cluster
2626

27-
In this release, we've added support for skins at the cluster level. Do you want K9s to look differently based on which cluster you're connecting to? All you'll need is to name the skin file in the K9s home directory as follows `mycluster_skin.yml`. If no cluster specific skin file is found, the standard `skin.yml` file will be loaded if present. Please checkout the `skins` directory in this repo or PR me if you have cool skins you'd like to share with your fellow K9ers as they will be featured in these release notes and in the project README.
27+
In this release, we've added support for skins at the cluster level. Do you want K9s to look differently based on which cluster you're connecting to? All you'll need is to name the skin file in the K9s home directory as follows `mycluster_skin.yml`. If no cluster specific skin file is found, the standard `skin.yml` file will be loaded if present. Please checkout the `skins` directory in this repo or PR me if you have cool skins you'd like to share with your fellow K9sers as they will be featured in these release notes and in the project README.
2828

2929
## Hot(Ness)?
3030

change_logs/release_0.12.0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Also if you dig this tool, please make some noise on social! [@kitesurfer](https
1212

1313
### Searchable Logs
1414

15-
There has been quiet a few demands for this feature. It should now be generally available in this drop. It works the same as the resource view ie `/fred`, you can also specify a fuzzy filter using `/-f blee-duh`. The paint is still fresh on that deal and not super confident that it will work nominally as I had to rework the logs to enable. So totally possible I've hosed something in the process.
15+
There has been quite a few demands for this feature. It should now be generally available in this drop. It works the same as the resource view ie `/fred`, you can also specify a fuzzy filter using `/-f blee-duh`. The paint is still fresh on that deal and not super confident that it will work nominally as I had to rework the logs to enable. So totally possible I've hosed something in the process.
1616

1717
### APIServer Dud
1818

@@ -38,7 +38,7 @@ k9s:
3838

3939
### K9s Slackers
4040

41-
I've enabled a [K9s slack channel](https://join.slack.com/t/k9sers/shared_invite/enQtOTAzNTczMDYwNjc5LWJlZjRkNzE2MzgzYWM0MzRiYjZhYTE3NDc1YjNhYmM2NTk2MjUxMWNkZGMzNjJiYzEyZmJiODBmZDYzOGQ5NWM) dedicated to all K9ers. This would be a place for us to meet and discuss ideas and use cases. I'll be honest here I am not a big slack afficionado as I don't do very well with interrupt drive workflows. But I think it would be a great resource for us all.
41+
I've enabled a [K9s slack channel](https://join.slack.com/t/k9sers/shared_invite/enQtOTAzNTczMDYwNjc5LWJlZjRkNzE2MzgzYWM0MzRiYjZhYTE3NDc1YjNhYmM2NTk2MjUxMWNkZGMzNjJiYzEyZmJiODBmZDYzOGQ5NWM) dedicated to all K9sers. This would be a place for us to meet and discuss ideas and use cases. I'll be honest here I am not a big slack aficionado as I don't do very well with interrupt drive workflows. But I think it would be a great resource for us all.
4242

4343
NOTE: Please be kind to each others and threat everyone with respect as I would like this to be a safe and fun place for folks to hangout. Thank you for you support and understanding!!
4444

change_logs/release_0.2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Thank you so much for your support!!
1616

1717
+ [Feature #97](https://github.com/derailed/k9s/issues/97)
1818
Changed log view to now use kubectl logs shell command.
19-
There was some issues with the previous implementation with missing info and panics.
19+
There were some issues with the previous implementation with missing info and panics.
2020
NOTE! User must type Ctrl-C to exit the logs and navigate back to K9s
2121
+ Reordered containers to show spec.containers first vs spec.initcontainers.
2222
+ [Feature #29](https://github.com/derailed/k9s/issues/29)

change_logs/release_0.3.2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Thank you so much for your support!!
1616

1717
1. [Feature #124](https://github.com/derailed/k9s/issues/124)
1818
1. *NodeView* Add current cpu/memory percentages to track current load on nodes.
19-
2. *NodeView* Add requested cpu/memory percentages to track how much containers
19+
2. *NodeView* Add requested cpu/memory percentages to track how many container
2020
resources are requested on the cluster.
2121
3. *NodeView* Add requested cpu/memory raw metrics
2222
4. *NodeView* Add corresponding column sorters

0 commit comments

Comments
 (0)