-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
deployment status conditions #889
deployment status conditions #889
Conversation
Deployments, like Nodes, have status conditions observing the current state. While the state of Available and Progressing conditions can likely be inferred by other metrics, the state of ReplicaFailure can not be inferred. This changelist adds a new metric `kube_deployment_status_condition` that observes all the conditions on a deployment for each condition status. This is analogous to the status conditions observed by nodes and horizontal pod autoscalers, and allows kube-state-metrics to observe status conditions added by third-parties. As an example, for a deployment that has stalled, the following new metrics observed would allow an operator to detect the condition: kube_deployment_status_condition{deployment="example", namespace="default", condition="ReplicaFailure", status="true"} 1 kube_deployment_status_condition{deployment="example", namespace="default", condition="ReplicaFailure", status="false"} 0 kube_deployment_status_condition{deployment="example", namespace="default", condition="ReplicaFailure", status="unknown"} 0 Bug: #886 Signed-off-by: Terin Stock <[email protected]>
Welcome @terinjokes! |
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.
Thanks for the PR @terinjokes !
Just some minor comments from me.
internal/store/deployment.go
Outdated
GenerateFunc: wrapDeploymentFunc(func(d *v1.Deployment) *metric.Family { | ||
ms := make([]*metric.Metric, len(d.Status.Conditions)*len(conditionStatuses)) | ||
|
||
// Collect node conditions and while default to false. |
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.
Hah, did I just spot a copypasta (Man, am I guilty of this!) here :) ? Let's have a more descriptive and accurate comment OR not have a comment at all. Your call.
(I also agree that the comment in internal/store/node.go
needs to be better).
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.
what, no, i wouldn't copy and paste and forget to update a comment! 😭
hpa has no comments, and I don't think this one is accurate anyways. I'll remove
internal/store/deployment.go
Outdated
{ | ||
Name: "kube_deployment_status_condition", | ||
Type: metric.Gauge, | ||
Help: "The condition of a deployment.", |
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.
Help: "The condition of a deployment.", | |
Help: "Describes the current state of a deployment.", |
The equivalent node metric's description isn't that great unfortunately :(. Something that needs to be fixed in the future.
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.
I attempted to come to a middle ground based on the other help texts for deployments.
internal/store/deployment.go
Outdated
@@ -122,6 +122,35 @@ var ( | |||
} | |||
}), | |||
}, | |||
// This all-in-one metric family contains all conditions for extensibility. |
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.
Do we need these comments?
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.
Removed
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.
Thanks!
I have one small nit, otherwise, it looks good to me.
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tariq1890, terinjokes 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:
Deployments, like Nodes, have status conditions observing the
current state. While the state of Available and Progressing conditions
can likely be inferred by other metrics, the state of ReplicaFailure can
not be inferred.
This changelist adds a new metric
kube_deployment_status_condition
that observes all the conditions on a deployment for each condition
status. This is analogous to the status conditions observed by nodes and
horizontal pod autoscalers, and allows kube-state-metrics to observe
status conditions added by third-parties.
As an example, for a deployment that has stalled, the following new
metrics observed would allow an operator to detect the condition:
Which issue(s) this PR fixes:
Fixes #886