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

Add env var to disable node pod counts #2168

Merged
merged 3 commits into from
Nov 12, 2023

Conversation

Fizzadar
Copy link
Contributor

Some of our clusters are really big with tens of thousands of pods running. The pod counting fetches them all which consumes multiple GB's of memory to do plus a significant load on the API side. This adds a simple env var to disable it.

I did have a quick look to see if it would be passable as a config option but couldn't figure out how!

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.

@Fizzadar Thank you for this PR Nick! I think we should try to handle this via k9s config and potentially having a one off override via a CLI arg.

@@ -145,6 +146,8 @@ func (n *Node) List(ctx context.Context, ns string) ([]runtime.Object, error) {
nmx, _ = client.DialMetrics(n.Client()).FetchNodesMetricsMap(ctx)
}

shouldCountPods := os.Getenv("K9S_DISABLE_POD_COUNTING") != "true"
Copy link
Owner

Choose a reason for hiding this comment

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

Right not keen on putting env var. Best handled as a k9s config option as you've pointed out.
We typically propagate these kind of configuration via the context that list takes as a param.
Please take a peek at how we do this in the code ie dao.Alias and view.Alias as an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the pointer! f272068

@Fizzadar Fizzadar requested a review from derailed August 2, 2023 19:03
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.

@Fizzadar Thank you Nick to these updates! Just a small pick...


return &n
}

func (n *Node) aliasContext(ctx context.Context) context.Context {
Copy link
Owner

Choose a reason for hiding this comment

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

This method should be called something like nodeContext or the likes...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦 2c0defc

@Fizzadar Fizzadar requested a review from derailed August 7, 2023 15:24
@Fizzadar
Copy link
Contributor Author

Fizzadar commented Aug 7, 2023

@derailed should be good to go now, thank you for the speedy reivews!

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.

@Fizzadar Thank you for the updates Nick!!

@derailed derailed merged commit 9d804c6 into derailed:master Nov 12, 2023
2 checks passed
derailed added a commit that referenced this pull request Nov 12, 2023
derailed added a commit that referenced this pull request Nov 12, 2023
rm-hull added a commit to rm-hull/k9s that referenced this pull request Nov 12, 2023
* 'master' of github.com:derailed/k9s: (130 commits)
  added flux suspended resources retrieval plugin (derailed#1584)
  Provide white blur so images work in dark modes (derailed#1597)
  Add context to get-all (derailed#1701)
  fix brew command in the readme (derailed#2012)
  Add support for using custom kubeconfig with log_full plugin (derailed#2014)
  feat: allow for multiple plugin files in $XDG_DATA_DIRS/k9s/plugins (derailed#2029)
  Clean up issues introduced by derailed#2125 (derailed#2289)
  Pod view resembles more the output of kubectl get pods -o wide (derailed#2125)
  Update README.md with snap install (derailed#2262)
  Add snapcraft config (derailed#2123)
  storageclasses view keeps the same output as kubectl get sc (derailed#2132)
  Fix merge issues with PR derailed#2168 (derailed#2288)
  Add colour config for container picker (derailed#2140)
  Add env var to disable node pod counts (derailed#2168)
  Use current k9s NS if new context has no default NS (derailed#2197)
  Bump actions/setup-go from 4.0.1 to 4.1.0 (derailed#2200)
  fix: trigger a single log refresh after changing 'since' (derailed#2202)
  Add crossplane plugin (derailed#2204)
  fix(derailed#1359): add option to keep missing clusters in config (derailed#2213)
  K9s release v0.28.2
  ...
@Fizzadar Fizzadar deleted the option-disable-pod-counts branch November 24, 2023 16:54
@derailed derailed mentioned this pull request Dec 7, 2023
thejoeejoee pushed a commit to thejoeejoee/k9s that referenced this pull request Feb 23, 2024
* Add env var to disable node pod counts

* Move disabling pod counting to config

* Correct alias context function name
thejoeejoee pushed a commit to thejoeejoee/k9s that referenced this pull request Feb 23, 2024
placintaalexandru pushed a commit to placintaalexandru/k9s that referenced this pull request Apr 3, 2024
* Add env var to disable node pod counts

* Move disabling pod counting to config

* Correct alias context function name
placintaalexandru pushed a commit to placintaalexandru/k9s that referenced this pull request Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants