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

feat(inputs.kube_inventory): Support filtering pods and nodes by node name #13993

Merged
merged 13 commits into from
Oct 4, 2023

Conversation

Noy-Simon
Copy link
Contributor

@Noy-Simon Noy-Simon commented Sep 26, 2023

resolves #13878
superseeds #13893

Add the option to filter nodes and pods by node name in the kuberetes_inventory input plugin

@telegraf-tiger telegraf-tiger bot added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Sep 26, 2023
@srebhan
Copy link
Member

srebhan commented Sep 26, 2023

@Noy-Simon first of all thank you for your contribution!

It see like this PR does two things at the same time, filtering by name and getting the data from kubelet. It is better to have one PR per feature if possible to easier track down problems and revert changes if they do have unintended side-effects. I think in your case splitting the two is possible, so please submit one PR with the filtering and one PR with getting the the data from kubelet.
You can reuse this PR for one of the two.

@srebhan srebhan self-assigned this Sep 26, 2023
@Noy-Simon
Copy link
Contributor Author

@srebhan done
the second pr is here

@telegraf-tiger
Copy link
Contributor

@srebhan srebhan changed the title feat(inputs.kube_inventory): Support filtering pods and nodes by node name and support getting pods data from kubelet feat(inputs.kube_inventory): Support filtering pods and nodes by node name Sep 26, 2023
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks for the split @Noy-Simon! One suggestion in the code from my side...

plugins/inputs/kube_inventory/client.go Show resolved Hide resolved
@Noy-Simon Noy-Simon requested a review from srebhan September 27, 2023 19:48
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks for your work @Noy-Simon!

@srebhan srebhan added area/k8s ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Oct 2, 2023
@srebhan srebhan assigned powersj and unassigned srebhan Oct 2, 2023
Comment on lines +58 to +59
## Node name to filter to. No filtering by default.
# node_name = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you plan on using this? Do you have a plugin for every single node you want to monitor? My concern is how does that scale?

Copy link
Contributor Author

@Noy-Simon Noy-Simon Oct 3, 2023

Choose a reason for hiding this comment

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

i use it as a daemonset and give it a node name using an env var from Kubernetes fieldPath: spec.nodeName

Copy link
Contributor

Choose a reason for hiding this comment

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

So each daemonset is monitoring a single node? Is there a scenario where someone wants to pass multiple nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not that i can think of
monitoring multiple nodes and not all nodes will require the client to use permanent node names and its a bad practice
maybe in the future, someone would want to add some kind of prefix search but it will not be as efficient

Copy link
Contributor

Choose a reason for hiding this comment

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

ok thanks!

@Noy-Simon Noy-Simon requested a review from powersj October 3, 2023 07:49
@powersj powersj merged commit 01b5834 into influxdata:master Oct 4, 2023
@github-actions github-actions bot added this to the v1.29.0 milestone Oct 4, 2023
@Noy-Simon Noy-Simon deleted the filter_inventory_node_by_name branch October 4, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/k8s feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter kuberetes_inventory input plugin nodes and pods by node name
3 participants