Skip to content

feat: include reason label to kube_deployment_status_condition #2719

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/store/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ func deploymentMetricFamilies(allowAnnotationsList, allowLabelsList []string) []
metric := m

reason := c.Reason
if _, ok := allowedDeploymentReasons[reason]; !ok {
reason = "unknown"
if reason != "" {
Copy link
Member

@mrueg mrueg Aug 11, 2025

Choose a reason for hiding this comment

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

Can we add "" to the allowedDeploymentReasons instead?

Copy link
Contributor Author

@Rishab87 Rishab87 Aug 11, 2025

Choose a reason for hiding this comment

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

yeah, added it

if _, ok := allowedDeploymentReasons[reason]; !ok {
reason = "unknown"
}
}

metric.LabelKeys = []string{"reason", "condition", "status"}
Expand Down
9 changes: 5 additions & 4 deletions internal/store/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,16 @@ func TestDeploymentStore(t *testing.T) {
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="unknown",condition="Available",status="true"} 0
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="unknown",condition="Available",status="false"} 1
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="unknown",condition="Available",status="unknown"} 0
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="unknown",condition="Progressing",status="true"} 1
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="unknown",condition="Progressing",status="false"} 0
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="unknown",condition="Progressing",status="unknown"} 0
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="",condition="Progressing",status="true"} 1
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="",condition="Progressing",status="false"} 0
kube_deployment_status_condition{deployment="depl3",namespace="ns3",reason="",condition="Progressing",status="unknown"} 0
kube_deployment_status_observed_generation{deployment="depl3",namespace="ns3"} 0
kube_deployment_status_replicas{deployment="depl3",namespace="ns3"} 0
kube_deployment_status_replicas_available{deployment="depl3",namespace="ns3"} 0
kube_deployment_status_replicas_ready{deployment="depl3",namespace="ns3"} 0
kube_deployment_status_replicas_unavailable{deployment="depl3",namespace="ns3"} 0
kube_deployment_status_replicas_updated{deployment="depl3",namespace="ns3"} 0
kube_deployment_status_replicas{deployment="depl3",namespace="ns3"} 0`,
`,
},
}

Expand Down