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: Adds new metric kube_pod_service_account #2096

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

swarup-stripe
Copy link
Contributor

What this PR does / why we need it:

It adds a new pod metric kube_pod_service_account to expose the service account (p.Spec.ServiceAccountName) for a particular pod. This is needed to see which user has created a pod and view metrics for pods created by a particular user.

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)

Increases

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 13, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: swarup-stripe / name: Swarup Srinivasan (8a8b7b4)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 13, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jun 13, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @swarup-stripe!

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/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 13, 2023
@swarup-stripe swarup-stripe changed the title Adds new metric kube_pod_service_account feat: Adds new metric kube_pod_service_account Jun 13, 2023
@@ -334,6 +336,7 @@ kube_pod_info{namespace="default",pod="pod0",uid="abc-0",host_ip="1.1.1.1",pod_i
kube_pod_labels{namespace="default",pod="pod0",uid="abc-0"} 1
kube_pod_owner{namespace="default",pod="pod0",uid="abc-0",owner_kind="",owner_name="",owner_is_controller=""} 1
kube_pod_restart_policy{namespace="default",pod="pod0",uid="abc-0",type="Always"} 1
kube_pod_service_account{namespace="default",pod="pod0",uid="abc-0",service_account=""} 1
Copy link
Contributor

Choose a reason for hiding this comment

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

QQ: can this metric kube_pod_service_account be used in alerts? Or only informational purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@CatherineF-dev my use case is to have this for for informational purposes so our users can query metrics by their service account. All pods have the service account in the podspec according to the docs so I think it could be used for alerts. However if it's a question about cardinality, I'm not too sure.

@logicalhan
Copy link
Member

/triage accepted
/assign @CatherineF-dev

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 15, 2023
@swarup-stripe
Copy link
Contributor Author

@CatherineF-dev wanted to follow-up and see if we can get this PR merged

@CatherineF-dev
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 21, 2023
@swarup-stripe
Copy link
Contributor Author

/assign @fpetkovski

@swarup-stripe
Copy link
Contributor Author

@fpetkovski Bumping this - it's a pretty small change and would be really useful for our use-case! Happy to clarify if necessary

@mrueg
Copy link
Member

mrueg commented Jul 26, 2023

/lgtm

Thanks for your contribution!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CatherineF-dev, mrueg, swarup-stripe

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 Jul 26, 2023
@k8s-ci-robot k8s-ci-robot merged commit 56a3a0a into kubernetes:main Jul 26, 2023
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/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants