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

expose the PodCIDR in node info #963

Merged
merged 2 commits into from
Nov 1, 2019

Conversation

jacobstr
Copy link
Contributor

What this PR does / why we need it:

It can be helpful to know the PodCIDR of nodes in order to predict IP
space utilization. In GKE for example, one typically uses a Secondary
Alias IP range that doles out PodCIDRs dynamically. When this is
exhausted, nodes will fail to boot with messages such as:

Instance 'gke-test-ingre-43fd70d6-9v77' creation failed: IP space of 'projects/network-project/regions/us-central1/subnetworks/pod-alias-b85f82b0bca36afa' is exhausted.

Although not comprehensive, on could use this label to construct a query
such as:

count(kube_node_info(pod_cidr~="/24")) * 256

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 30, 2019
@jacobstr jacobstr changed the title WIP: expose the PodCIDR in node info expose the PodCIDR in node info Oct 30, 2019
@k8s-ci-robot
Copy link
Contributor

Welcome @jacobstr!

It looks like this is your first PR to kubernetes/kube-state-metrics 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kube-state-metrics has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Oct 30, 2019
It can be helpful to know the PodCIDR of nodes in order to predict IP
space utilization. In GKE for example, one typically uses a Secondary
Alias IP range that doles out PodCIDRs dynamically. When this is
exhausted, nodes will fail to boot with messages such as:

```
Instance 'gke-test-ingre-43fd70d6-9v77' creation failed: IP space of 'projects/network-project/regions/us-central1/subnetworks/pod-alias-b85f82b0bca36afa' is exhausted.
```

Although not comprehensive, on could use this label to construct a query
such as:

```
count(kube_node_info(pod_cidr~="/24")) * 256
```
Copy link
Member

@lilic lilic 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 PR!

@@ -59,6 +60,7 @@ var (
n.Status.NodeInfo.KubeletVersion,
n.Status.NodeInfo.KubeProxyVersion,
n.Spec.ProviderID,
n.Spec.PodCIDR,
Copy link
Member

Choose a reason for hiding this comment

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

This is an optional label, not sure how we usually handle optional labels cc @brancz @tariq1890

Copy link
Member

Choose a reason for hiding this comment

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

It’s not a pointer so at worst this is the empty string in which case Prometheus just drops the label so it’s fine as is.

@@ -46,6 +46,7 @@ func TestNodeStore(t *testing.T) {
},
Spec: v1.NodeSpec{
ProviderID: "provider://i-uniqueid",
PodCIDR: "172.24.10.0/24",
Copy link
Member

Choose a reason for hiding this comment

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

Since this can be empty or not set, lets have one test where this is not set.

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'm adding a general test case with an empty v1.Node and verifying all empty strings. Not sure if you have preferences over the ordering of test cases but I'm happy to change that.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 1, 2019
@jacobstr
Copy link
Contributor Author

jacobstr commented Nov 1, 2019

Note: I'm not committing a spurious

+	github.com/gogo/protobuf v1.1.1 // indirect

That shows up in my local diff. I don't expect any changes to go.mod contents given I have not changed added / updated deps.

@brancz
Copy link
Member

brancz commented Nov 1, 2019

Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 1, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brancz, jacobstr

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 1, 2019
@k8s-ci-robot k8s-ci-robot merged commit 8c49ae2 into kubernetes:master Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants