-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
store: add kube_node_role metric #877
Conversation
Welcome @abursavich! |
Nominally this is not really aligned with how kube state metrics works, however I’m inclined to accept something like this as node labels are treated with stability guarantees in kubernetes (at least this label) and it is indeed difficult to do what you are trying to accomplish. |
@brancz, I'm not sure this would be more palatable, but in the interest of exploration... another option would be to export a
I have actually wished it was that way for the purposes of other queries in the past, but not just for nodes... for deployments, pods, etc. As an additional benefit, you would get the real label names without special characters replaced. |
I am on the fence here on this. While I wish this was made more contractually bound via APIObject, I also don't want it to be a blocker. I'll leave it to @lilic to provide her opinions on this. |
I agree! Asking the node team on this, to see if they have plans to change this. If it will stay this way I would say let's add it, unless there is any other place in k8s we think this metric might be better off?
Dear @kubernetes/sig-node-api-reviews can you let us know if you have any plans to change the |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
I would like to be very explicit that this is a specific case of two generic issues which are the result of mapping dynamic object labels to dynamic metric dimensions, instead of fixing the dimensions and allowing the series cardinality to be dynamic per object.
Reiterating my previous comment, this is an alternative solution to the underlying problems without tying kube-state-metrics to any particular label conventions:
One downside would be that queries on multiple labels would become more complicated joins:
|
Related discussion about appropriate use of node role labels: |
The tldr is that the node role label is not going away, but its an implementation detail of the cluster topology and not something that kubernetes components should imply behavior around in favor of more intent based labels (exclude-disruption, etc.). That said, the role of the node should be stable for the life of the node. |
Got it, thanks @derekwaynecarr. I think we're good with moving forward with this. The only thing I would like to do as this is a new metric and in general a new method for kube-state-metrics, mark this as experimental for now. Then this lgtm to merge. Can you mark this metric as experimental in the docs @abursavich ? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments but we decided we want to proceed with this, thank you so much for the PR!
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abursavich, brancz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This adds a
kube_node_role
metric for node roles based onnode-role.kubernetes.io/<ROLE>
node labels.This is implemented like
kube_node_spec_taint
where each taint is a separate metric in the same family, as opposed tokube_node_labels
where each label is mapped to the same metric and family.I've tried to implement this with recording rules on top of
kube_node_labels
, but an emptynode-role.kubernetes.io/<ROLE>
label value is valid and, as far as i can tell, there's no way to differentiate between a missing label and an empty value in a query. Further, every possible role must be known in advance to query for the expected labels.Which issue(s) this PR fixes
N/A