fix(deployment): guard nil Spec.Replicas before dereference#2971
fix(deployment): guard nil Spec.Replicas before dereference#2971immanuwell wants to merge 1 commit into
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 DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: immanuwell The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What this PR does / why we need it:
Spec.Replicasis*int32- a pointer. Three metrics dereference it without a nil check:kube_deployment_spec_replicaskube_deployment_spec_strategy_rollingupdate_max_unavailablekube_deployment_spec_strategy_rollingupdate_max_surgereplicaset.goandstatefulset.goboth guard this same field already. Deployment was just missing the guards, so it would straight up panic on a nil pointer if a deployment with unsetSpec.Replicascame through (e.g. via direct API/etcd write, old migrated objects, or tests).Reproduce:
Fix follows the existing pattern from
replicaset.go:160andstatefulset.go:170.How does this change affect the cardinality of KSM: does not change cardinality
Which issue(s) this PR fixes: