kube-state-metrics icon indicating copy to clipboard operation
kube-state-metrics copied to clipboard

feat: add start and termination timestamps for init containers

Open drolando opened this issue 8 months ago • 9 comments

What this PR does / why we need it: The new Sidecar Containers introduced in k8s 1.28 implement sidecars as init containers: https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers .

I wanted to monitor when each native sidecar starts and ends, however kube-state-metrics only emits those metrics for normal containers.

Given that these are new metrics I've set them as ALPHA, let me know if you don't agree

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

The cardinality increases since these metrics will be emitted also for init containers.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #2627

drolando avatar Mar 25 '25 22:03 drolando

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: drolando-stripe (78ffea3fb6b8417c8291eb430f296a2d8a91fbfe, 683222b8270fdea2060ad8a3954d4f9217992a9d)

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: drolando Once this PR has been reviewed and has the lgtm label, please assign mrueg for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Mar 25 '25 22:03 k8s-ci-robot

This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Mar 25 '25 22:03 k8s-ci-robot

Welcome @drolando!

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. :smiley:

k8s-ci-robot avatar Mar 25 '25 22:03 k8s-ci-robot

Overall LGTM. Need to fix two small tests.

  • https://github.com/kubernetes/kube-state-metrics/actions/runs/14071399444/job/39406603122?pr=2638
  • https://github.com/kubernetes/kube-state-metrics/actions/runs/14071399444/job/39406604045?pr=2638

CatherineF-dev avatar Mar 31 '25 01:03 CatherineF-dev

@drolando interested in fixing those tests on the PR?

mrueg avatar Jun 19 '25 16:06 mrueg

Yeah I got pulled in some other work and forgot, but I’ll try to fix them tomorrow

On Thu, Jun 19, 2025 at 9:52 AM Manuel Rüger @.***> wrote:

mrueg left a comment (kubernetes/kube-state-metrics#2638) https://github.com/kubernetes/kube-state-metrics/pull/2638#issuecomment-2988690223

@drolando https://github.com/drolando interested in fixing those tests on the PR?

— Reply to this email directly, view it on GitHub https://github.com/kubernetes/kube-state-metrics/pull/2638#issuecomment-2988690223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZJ7BTRSSW2HY2TJJRQAET3ELTFNAVCNFSM6AAAAABZYZDR4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOBYGY4TAMRSGM . You are receiving this because you were mentioned.Message ID: @.***>

drolando avatar Jun 19 '25 16:06 drolando

@drolando still interested in this change?

mrueg avatar Aug 15 '25 18:08 mrueg

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Nov 13 '25 19:11 k8s-triage-robot