-
Notifications
You must be signed in to change notification settings - Fork 2k
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: add restartPolicy to kube_pod_init_container_info
metric
#2240
feat: add restartPolicy to kube_pod_init_container_info
metric
#2240
Conversation
This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The 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/test-infra repository. |
kube_pod_init_container_info
metric
1c66a95
to
6ed3c50
Compare
bed3463
to
863e023
Compare
@changhyuni any plans to revive this one? This could be an interesting label |
@mrueg I've reopened it. I'll fix the tests that are failing. |
863e023
to
4769203
Compare
4769203
to
ed1a7f9
Compare
internal/store/pod.go
Outdated
@@ -677,16 +677,21 @@ func createPodInitContainerInfoFamilyGenerator() generator.FamilyGenerator { | |||
"", | |||
wrapPodFunc(func(p *v1.Pod) *metric.Family { | |||
ms := []*metric.Metric{} | |||
labelKeys := []string{"container", "image_spec", "image", "image_id", "container_id"} | |||
labelKeys := []string{"container", "image_spec", "image", "image_id", "container_id", "type"} |
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.
labelKeys := []string{"container", "image_spec", "image", "image_id", "container_id", "type"} | |
labelKeys := []string{"container", "image_spec", "image", "image_id", "container_id", "restart_policy"} |
let's use the kubernetes specific labels
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.
@mrueg nice i fixed
but, container restart policy and pod restart policy label names are different
https://github.com/kubernetes/kube-state-metrics/blob/main/internal/store/pod.go#L1191C11-L1191C11
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.
yes, that one is in a separate metric, I think if this is in an Info metric it's too generic to call it type.
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.
@mrueg
I understand. From that perspective, restart_policy would be better.
modify label key
16e83bb
to
b948807
Compare
docs/pod-metrics.md
Outdated
@@ -36,7 +36,7 @@ | |||
| kube_pod_created | Gauge | Unix creation timestamp | seconds | `pod`=<pod-name> <br> `namespace`=<pod-namespace> <br> `uid`=<pod-uid> | STABLE | - | | |||
| kube_pod_deletion_timestamp | Gauge | Unix deletion timestamp | seconds | `pod`=<pod-name> <br> `namespace`=<pod-namespace> <br> `uid`=<pod-uid> | EXPERIMENTAL | - | | |||
| kube_pod_restart_policy | Gauge | Describes the restart policy in use by this pod | | `pod`=<pod-name> <br> `namespace`=<pod-namespace> <br> `type`=<Always\|Never\|OnFailure> <br> `uid`=<pod-uid> | STABLE | - | | |||
| kube_pod_init_container_info | Gauge | Information about an init container in a pod | | `container`=<container-name> <br> `pod`=<pod-name> <br> `namespace`=<pod-namespace> <br> `image`=<image-name> <br> `image_id`=<image-id> <br> `image_spec`=<image-spec> <br> `container_id`=<containerid> <br> `uid`=<pod-uid> | STABLE | - | | |||
| kube_pod_init_container_info | Gauge | Information about an init container in a pod | | `container`=<container-name> <br> `pod`=<pod-name> <br> `namespace`=<pod-namespace> <br> `image`=<image-name> <br> `image_id`=<image-id> <br> `image_spec`=<image-spec> <br> `container_id`=<containerid> <br> `uid`=<pod-uid> <br> `type`=<Always> | STABLE | - | |
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.
| kube_pod_init_container_info | Gauge | Information about an init container in a pod | | `container`=<container-name> <br> `pod`=<pod-name> <br> `namespace`=<pod-namespace> <br> `image`=<image-name> <br> `image_id`=<image-id> <br> `image_spec`=<image-spec> <br> `container_id`=<containerid> <br> `uid`=<pod-uid> <br> `type`=<Always> | STABLE | - | | |
| kube_pod_init_container_info | Gauge | Information about an init container in a pod | | `container`=<container-name> <br> `pod`=<pod-name> <br> `namespace`=<pod-namespace> <br> `image`=<image-name> <br> `image_id`=<image-id> <br> `image_spec`=<image-spec> <br> `container_id`=<containerid> <br> `uid`=<pod-uid> <br> `type`=<restart-policy> | STABLE | - | |
One last change.
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.
@mrueg
<br> `restart_policy`=<Always>
right? i fixed
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.
The Always
should be replaced by a placeholder
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.
@mrueg
i fixed
/lgtm Thanks for your contribution! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: changhyuni, mrueg 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 PR adds a label to
kube_pod_init_container_info
to track therestartPolicy
set in the init_containerWith sidecar support starting with kubernetes 1.28,
init_container
can be usedrestartPolicy
This metric tells you which pods are using the sidecar feature
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
adds a label that is never updated for a given init container
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 #