Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow scaling custom resource #2833

Merged
merged 1 commit into from
Feb 16, 2025
Merged

Conversation

wjiec
Copy link
Contributor

@wjiec wjiec commented Aug 19, 2024

This PR implements the features described in #2779.

Comment on lines 145 to 146
// we must block until all started informers' caches were synced
_ = fac.WaitForCacheSync(f.stopChan)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for blocking here is that command call the internal/dao/registry::Meta.loadCRDs method during initialization (and as part of the init of the whole app), and if it doesn't block here, it will result in an incorrect list of CRDs being read (and theoretically, other resources will have the same problem...).

But this also creates additional problems, in my cluster with a slightly higher load, a total of 96 CRDs takes about ~2s to synchronize.

I didn't think of any good way (or I'm missing something) to solve this problem, does anyone have any ideas?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjiec This could indeed be a problem. As you've noted any cluster with lots of resources will become a pb.
The idea here is to leverage k9s eventual consistance so we would not have to block til all caches are updated.

I think we could perhaps lazy eval the crd instead to gauge whether it is scalable once the user decides to actually view it.
Would this make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@derailed I've also considered checking if the crd is scalable when the view is created, but consider a scenario where if k9s needs to display a crd resource that supports scalable as soon as it starts up, and at that point the cache may not have finished synced, then factory.Get will either return a NotFound error or will need to block until that crd finish synced. Doesn't seem like an optimal approach in this case either?

The current logic decides whether to wait for the cache to finish sync based on the wait parameter, which I see is false in most cases, and only in some special cases does it have wait = true, which I think might be acceptable?

Or we make the key binding dynamic, and when the crds sync is done, we update the view to add the scale cmd.

What do you think?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjiec Thank you for your input and sorry for the delay... I like the idea of eventually enabling the scaling option once the resource is synced. This allows for a non blocking approach.

Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjiec Thank you for taking this on Jayson!

Comment on lines 145 to 146
// we must block until all started informers' caches were synced
_ = fac.WaitForCacheSync(f.stopChan)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjiec This could indeed be a problem. As you've noted any cluster with lots of resources will become a pb.
The idea here is to leverage k9s eventual consistance so we would not have to block til all caches are updated.

I think we could perhaps lazy eval the crd instead to gauge whether it is scalable once the user decides to actually view it.
Would this make sense?

@wjiec wjiec force-pushed the feat/scale-crd branch 4 times, most recently from 07f9053 to afa4070 Compare December 1, 2024 11:00
@wjiec
Copy link
Contributor Author

wjiec commented Dec 1, 2024

@derailed I spent some time looking into the logic in Meta, and I found that all resources (including CRDs) are actually loaded during loadPreferred, and that loadCRDs don't bring any additional changes (even the previous assignment of meta.Name = crd.Name resulted in the wrong GVRs being registered to Meta. resMetas).

loadCRDs now wait for the cache to sync and add scaleCat for the corresponding CRD. In scale_extender it is dynamically decided whether to add a Scale command to the view based on the presence or absence of a scaleCat.

What do you think of this?

@derailed
Copy link
Owner

derailed commented Dec 7, 2024

@wjiec Thank you for taking another pass Jayson!! The catch here is crd loads are currently async. waitForCacheSync will halt the load until all caches are refreshed (not just crds!). This could be a pb on larger clusters and hence I had initially opted to load async thus relying of eventual consistency. Does this make sense or am I missing it?

@derailed derailed added enhancement New feature or request question Further information is requested labels Dec 7, 2024
@wjiec
Copy link
Contributor Author

wjiec commented Dec 8, 2024

@derailed Thank you very much for your reply and reminder, I think I understand what you mean! Sorry, it's my understanding that's wrong. I always thought loadCRDs would only be executed once on k9s startup 😅 I just now understand that the eventual consistency you're talking about says that loadCRDs load a portion at a time until the caches are done synchronizing.

@derailed
Copy link
Owner

@wjiec Thank you Jayson! No worries. I am glad you've asked!!
These can indeed get a little bit tricky ;(

@derailed
Copy link
Owner

@wjiec Looks like we have some conflicts. Could you take a peek? Thank you Jayson!

@derailed derailed added needs-tlc Pr needs additional updates conflicts labels Feb 16, 2025
@wjiec wjiec force-pushed the feat/scale-crd branch 3 times, most recently from d8fecb9 to d76da70 Compare February 16, 2025 05:21
@wjiec
Copy link
Contributor Author

wjiec commented Feb 16, 2025

Hi @derailed, I have resolved these conflicts, please take a look when you have time.

btw, it seems that Dynamic.Get in internal/dao/dynamic.go has not been implemented, which will break the Jump to Owner feature.

@derailed
Copy link
Owner

@wjiec Nice! Thank you for this update and the heads up on Dynamic!!

I think we should be ok here since I have not yet moved other resources to dynamic.
I think the jump to uses the generic dao vs dynamic.
Am I wrong about that?

In any case, I'll add the get accessor in the next drop.

Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjiec Thank you for the updates! Wondering if we should just roll up this logic in loadPreferred?? ie tune the crd name and add tag as scalable if warranted...

Name: crd.Spec.Names.Plural,
Version: v.Name,
ShortNames: crd.Spec.Names.ShortNames,
SingularName: crd.Spec.Names.Plural,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use Names.Singular.
Also I think the crd name needs to be unique ie crd.Name+"."+meta.Group

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm late, actually there should be no impact on PR correctness here as client.NewGVRFromMeta only needs Group, Version, VersionName and that's enough. Also, according to [Extend the Kubernetes API with CustomResourceDefinitions](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/ custom-resource-definitions/) the description of name is name must match the spec fields below, and be in the form: <plural>. <group>, so crd.Spec.Names.Plural should be correct here.

meta.Version = v.Name
break
if gvr, version, ok := newGVRFromCRD(&crd); ok {
if meta, ok := m[gvr]; ok && version.Subresources != nil && version.Subresources.Scale != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add logic here to also update the meta if we have a non-scalabe crd since we need to track the updated meta definition. This is the case where vendorA and vendorB provide CRD named fred.
Perhaps we should rollup this logic in loadPreferred and axe loadCRD all together.
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think loadCRD should still be necessary, loadPreferred is similar to kubectl api-resources, while loadCRD actually only handles crd resources, if put the logic of loadCRD into loadPreferred maybe still need list + for + process, so I think we can change the name of loadCRD?

@derailed derailed merged commit 6881892 into derailed:master Feb 16, 2025
3 checks passed
@derailed derailed mentioned this pull request Feb 16, 2025
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 25, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [derailed/k9s](https://github.com/derailed/k9s) | minor | `v0.32.7` -> `v0.40.5` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>derailed/k9s (derailed/k9s)</summary>

### [`v0.40.5`](https://github.com/derailed/k9s/releases/tag/v0.40.5)

[Compare Source](derailed/k9s@v0.40.4...v0.40.5)

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

### Release v0.40.5
#### 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! [@&#8203;kitesurfer](https://twitter.com/kitesurfer)

On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)

#### Maintenance Release!

😳 Aye! Continued Buzz kill on the 0.40.0 aftermath 🙀 👻

Likely additional `disturbance in the farce` might be observed.
Thank you all for giving this drop a rinse and reporting back!! 😍

***

#### Videos Are In The Can!

Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...

-   [K9s v0.40.0 -Column Blow- Sneak peek](https://youtu.be/iy6RDozAM4A)
-   [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
-   [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
-   [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)

***

#### Resolved Issues

-   [#&#8203;3131](derailed/k9s#3131) Singular versions of native Kubernetes resource names no longer work
-   [#&#8203;3119](derailed/k9s#3119) Custom Views Fail to Load with % in Column Names (with feelings!)

***

#### Contributed MRs

Please be sure to give `Big Thanks!` and `ATTA Girls/Boys!` to all the fine contributors for making K9s better for all of us!!

-   [#&#8203;3123](derailed/k9s#3123) update regex to allow '%' and '/' in column names

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

### [`v0.40.4`](https://github.com/derailed/k9s/releases/tag/v0.40.4)

[Compare Source](derailed/k9s@v0.40.3...v0.40.4)

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

### Release v0.40.4
#### 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! [@&#8203;kitesurfer](https://twitter.com/kitesurfer)

On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)

#### Maintenance Release!

😳 Aye! Continued Buzz kill on the 0.40.0 aftermath 🙀 👻

Likely additional `disturbance in the farce` might be observed.
Thank you all for giving this drop a rinse and reporting back!! 😍

***

#### Videos Are In The Can!

Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...

-   [K9s v0.40.0 -Column Blow- Sneak peek](https://youtu.be/iy6RDozAM4A)
-   [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
-   [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
-   [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)

***

#### Resolved Issues

-   [#&#8203;3122](derailed/k9s#3122) Viewing events is no longer sorted by LAST SEEN
-   [#&#8203;3120](derailed/k9s#3120) Custom View Column Mismatch in K9s: Shuffled Values in Pods View
-   [#&#8203;3119](derailed/k9s#3119) Custom Views Fail to Load with % in Column Names
-   [#&#8203;3118](derailed/k9s#3118)  selecting an alias, the wrong resources are being shown

***

#### Contributed MRs

Please be sure to give `Big Thanks!` and `ATTA Girls/Boys!` to all the fine contributors for making K9s better for all of us!!

-   [#&#8203;3123](derailed/k9s#3123) update regex to allow '%' and '/' in column names

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

### [`v0.40.3`](https://github.com/derailed/k9s/releases/tag/v0.40.3)

[Compare Source](derailed/k9s@v0.40.2...v0.40.3)

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

### Release v0.40.3
#### 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! [@&#8203;kitesurfer](https://twitter.com/kitesurfer)

On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)

#### Maintenance Release!

😳 Aye! Buzz kill on the 0.40.0 aftermath ;( Hot fix in progress...🙀 👻

Likely additional `disturbance in the farce` might be observed.
Thank you all for giving this drop a rinse and reporting back!! 😍

***

#### Videos Are In The Can!

Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...

-   [K9s v0.40.0 -Column Blow- Sneak peek](https://youtu.be/iy6RDozAM4A)
-   [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
-   [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
-   [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)

***

#### Resolved Issues

-   [#&#8203;3116](derailed/k9s#3116) Cannot list custom CRD's since v0.40.1 (with feelings!)

***

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

### [`v0.40.2`](https://github.com/derailed/k9s/releases/tag/v0.40.2)

[Compare Source](derailed/k9s@v0.40.1...v0.40.2)

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

### Release v0.40.2
#### 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! [@&#8203;kitesurfer](https://twitter.com/kitesurfer)

On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)

#### Maintenance Release!

😳 Aye! Buzz kill on the 0.40.0 aftermath ;( Hot fix in progress...🙀 👻

Likely additional `disturbance in the farce` might be observed.
Thank you all for giving this drop a rinse and reporting back!! 😍

***

#### Videos Are In The Can!

Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...

-   [K9s v0.40.0 -Column Blow- Sneak peek](https://youtu.be/iy6RDozAM4A)
-   [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
-   [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
-   [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)

***

#### Resolved Issues

-   [#&#8203;3116](derailed/k9s#3116) Cannot list custom CRD's since v0.40.1

***

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

### [`v0.40.1`](https://github.com/derailed/k9s/releases/tag/v0.40.1)

[Compare Source](derailed/k9s@v0.40.0...v0.40.1)

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

### Release v0.40.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! [@&#8203;kitesurfer](https://twitter.com/kitesurfer)

On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)

#### Maintenance Release!

😳 Aye! Buzz kill on the 0.40.0 aftermath... 🙀 👻

Likely additional `disturbance in the farce` might be observed.
Thank you all for giving v0.40.0 a rinse and reporting back!! 😍

***

#### Videos Are In The Can!

Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...

-   [K9s v0.40.0 -Column Blow- Sneak peek](https://youtu.be/iy6RDozAM4A)
-   [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
-   [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
-   [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)

***

#### Resolved Issues

-   [#&#8203;3113](derailed/k9s#3113) 0.40.0 can't retain temporary view sort
-   [#&#8203;3111](derailed/k9s#3111) k9s can't describe or print YAML for HPAs in all namespaces view
-   [#&#8203;2966](derailed/k9s#2966) Go to the Contexts page and filter, contexts that are matched will be filtered ou
-   [#&#8203;2962](derailed/k9s#2962) Small colour/filtering related bug
-   [#&#8203;2961](derailed/k9s#2961) Drain node with the -disable-eviction
-   [#&#8203;2958](derailed/k9s#2958) Restart count in container view associated with the wrong container
-   [#&#8203;2945](derailed/k9s#2945) Could we add ServiceAccount Column in v1/POD view

***

#### Contributed MRs

Please be sure to give `Big Thanks!` and `ATTA Girls/Boys!` to all the fine contributors for making K9s better for all of us!!

-   [#&#8203;3094](derailed/k9s#3094) Log in as root to the node.
-   [#&#8203;3033](derailed/k9s#3033) Skip cache invalidation on failed connection
-   [#&#8203;2965](derailed/k9s#2965) Make menu foreground style configurable through skins
-   [#&#8203;2952](derailed/k9s#2952) A modest attempt to improve the logo aesthetics
-   [#&#8203;2833](derailed/k9s#2833) allow scaling custom resource
-   [#&#8203;2799](derailed/k9s#2799) feat(app): add history navigation with \[ and ], most recent command with -
-   [#&#8203;2719](derailed/k9s#2719) fix: stop table header cells from being selectable
-   [#&#8203;2865](derailed/k9s#2865) Feature/DisableAutoscroll

***

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

### [`v0.40.0`](https://github.com/derailed/k9s/releases/tag/v0.40.0)

[Compare Source](derailed/k9s@v0.32.7...v0.40.0)

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

### Release v0.40.0
#### 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! [@&#8203;kitesurfer](https://twitter.com/kitesurfer)

On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)

***

#### ♫ Sounds Behind The Release ♭

-   [Glory Box - Portishead](https://www.youtube.com/watch?v=4qQyUi4zfDs)
-   [Hit Me With Your Rhythm Stick - Ian Dury And The BlockHeads](https://www.youtube.com/watch?v=0WGVgfjnLqc)
-   [Cupidon s'en fout! - George Brassens](https://www.youtube.com/watch?v=a-RlZLfIeKM)
-   [Shipbuilding - Elvis Costello](https://www.youtube.com/watch?v=dVhjRqBM5uw)
-   [Low Sun - Hermanos Gutierrez](https://www.youtube.com/watch?v=ubaJbw7hkeQ)

***

#### A Word From Our Sponsors...

To all the good folks below that opted to `pay it forward` and join our sponsorship program, I salute you!!

-   [Panfactum](https://github.com/Panfactum)
-   [Bastian Pätzold](https://github.com/bastianpaetzold)
-   [Mikita Vazhnik](https://github.com/Vazhnik)
-   [Jacob Salway](https://github.com/jacobsalway)
-   [Eckard Mühlich](https://github.com/eckardnet)
-   [Luke](https://github.com/lukepatrick)
-   [tomasbanet](https://github.com/tomasbanet)
-   [Robin Opletal](https://github.com/fourstepper)
-   [Euroblaze](https://github.com/euroblaze)
-   [Jack Daniels](https://github.com/dkr91)
-   [decafcode](https://github.com/decafcode)
-   [Guillaume Copin](https://github.com/GuillaumeCo)
-   [Lokalise](https://github.com/lokalise)
-   [Gustavo Bini](https://github.com/gustavobini)
-   [JMSwag](https://github.com/JMSwag)
-   [Daniel Gospodinow](https://github.com/danielgospodinow)
-   [Klaviyo](https://github.com/klaviyo)
-   [Paul Farver](https://github.com/PaulFarver)

> Sponsorship cancellations since the last release: **12!** 🥹

#### 🎉 Feature Release code name: Colon Blow! 🎈

We are pretty stocked about this drop (hopefully...) as we've fully enabled custom columns support in K9s!
Historically, one could customize the view for a given resource by adding a definition in `views.yaml`.
From there one could change sort order and re-arrange the standard column layout.
Several folks voiced the need to add a column for a given label/annotation or any other fields available on a resource.
To date, this wasn't possible 😳

So... without further ado, let see what we can now do with `Custom Views` ding dang deal!
It all starts with a few new directives available in `views.yaml`

##### A Refresher...

Customize a pod view and ensure age, ns and name appear first and sort by age descending.

> NOTE! You no longer need to list out all columns.
> The remaining columns will be automatically filled from the standard columns.

```yaml

### Usual biz...
views:
  v1/pods:                         # specify the gvr you want to customize aka group/version/resource
    sortColumn: AGE:desc           # set the default ordering to ascending (asc) or descending (desc)
    columns:                       # tell the view which columns to display and in which order
      - AGE                        # ensure age, ns and name are the first 3 cols and backfill the rest
      - NAMESPACE
      - NAME
      - READY|H                    # => NEW! Do not display the READY column
      - NODE|W                     # => NEW! Show node column only on wide
      - IP|WR                      # => NEW! Pull the ip column and right align it in wide mode only
```

#### Colon Blow!

Say your pods comes standard with a label `blee` and you want to show it while in pod view.

```yaml

### Pull labels/annotations
views:
  v3/freds:
    sortColumn: NAMESPACE:dsc
    columns:
      - NAMESPACE
      - NAME
      - BLEE:.metadata.labels.blee                        # => NEW! Pull values from a label or an annotation using json parser

### expression similar mechanic as kubectl -o custom-columns
      - ZORG:.spec.zips[?(@&#8203;.type == 'zorg')].ip|WR        # => NEW! Same deal with a json exp + but align right and show wide only
```

#### TLDR...

As you can see the CustomView feature adds a few new semantics on this drop.

You can now use the following shape for columns definition `COL_NAME<:json_parse_expression><|column attributes>`

The `:json_parse_expression` is optional.

The column attributes are as follows:

-   `T` -> time column indicator
-   `N` -> number column indicator
-   `W` -> turns on wide column aka only shows while in wide mode. Defaults to the standard resource definition when present.
-   `H` -> Hides the column
-   `L` -> Left align (default)
-   `R` -> Right align

When certain columns are not present in the custom view, K9s will pull the standard column definition and merge the columns.
This allows user to specify and order which columns they want to see first without having to define every single columns from the default resource representation. If you do not wish to see all these columns you can add them to your custom view definition and either specify `|W` or `|H` to `wide` it or `hide` it.

> 📢 Still work in progress so your mileage may vary!
> This feature will likely need additional TLC.
> Your feedback on this will be much appreciated and we will iterate as usual to ensure it vorks as prescribed... 🙀

***

#### Videos Are In The Can!

Please dial [K9s Channel](https://www.youtube.com/channel/UC897uwPygni4QIjkPCpgjmw) for up coming content...

-   [K9s v0.40.0 Colon Blow Sneak peek](https://youtu.be/iy6RDozAM4A)
-   [K9s v0.31.0 Configs+Sneak peek](https://youtu.be/X3444KfjguE)
-   [K9s v0.30.0 Sneak peek](https://youtu.be/mVBc1XneRJ4)
-   [Vulnerability Scans](https://youtu.be/ULkl0MsaidU)

***

#### Resolved Issues

-   [#&#8203;3064](derailed/k9s#3064) Question: brew formula k9s vs derailed/k9s/k9s
-   [#&#8203;3061](derailed/k9s#3061) k9s not opening active namespace or namespace specified via -n
-   [#&#8203;3044](derailed/k9s#3044) CRDs are loaded incorrectly into metadata registry, cause sporadic "Jump Owner" issues
-   [#&#8203;2995](derailed/k9s#2995) Latest image on quay.io contains "failed" kubectl binary

***

#### Contributed MRs

Please be sure to give `Big Thanks!` and `ATTA Girls/Boys!` to all the fine contributors for making K9s better for all of us!!

-   [#&#8203;3065](derailed/k9s#3065) Fixed trimming of favorite namespaces in Config
-   [#&#8203;3063](derailed/k9s#3063) Updating CVE dependencies
-   [#&#8203;3062](derailed/k9s#3062) feat: use kubectl events for plugin watch-events
-   [#&#8203;3060](derailed/k9s#3060) Rename "delete local data" checkbox description in drain dialog
-   [#&#8203;3046](derailed/k9s#3046) Strict unmarshal for plugin files
-   [#&#8203;3045](derailed/k9s#3045) fix: CRD loading: trim group suffix from CRD name
-   [#&#8203;3043](derailed/k9s#3043) Fix K9S_EDITOR
-   [#&#8203;3041](derailed/k9s#3041) Fix Flux trace plugin command
-   [#&#8203;3038](derailed/k9s#2038) fix check e != nil but return a nil value error err
-   [#&#8203;3026](derailed/k9s#3026) Fix typos
-   [#&#8203;3018](derailed/k9s#3018) fix: coloring of rose-pine for values of log options
-   [#&#8203;3017](derailed/k9s#3017) feat: add helm diff plugin
-   [#&#8203;3009](derailed/k9s#3009) fix(argo-rollouts plugin): resolve improper piping in watch command
-   [#&#8203;2996](derailed/k9s#2996) Bump version of netshoot image in debug-container plugin
-   [#&#8203;2994](derailed/k9s#2994) fix kubectl url and fail build on download errors
-   [#&#8203;2986](derailed/k9s#2986) plugin/trace-dns: Trace DNS requests using Inspektor Gadget
-   [#&#8203;2985](derailed/k9s#2985) feat(plugins/crossplane): change to crossplane cli & add crossplane-watch
-   [#&#8203;2986](derailed/k9s#2986) plugin/trace-dns: Trace DNS requests using Inspektor Gadget

***

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNzAuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts enhancement New feature or request needs-tlc Pr needs additional updates question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants