-
Notifications
You must be signed in to change notification settings - Fork 40.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
podgc metrics should count all pod deletion behaviors #118480
Conversation
/cc @xing-yang |
if err != nil { | ||
t.Errorf("Error getting actualDeletingPodsTotal") | ||
} | ||
if actualDeletingPodsTotal != float64(inputDeletingPodsTotal) { | ||
t.Errorf("Expected desiredDeletingPodsTotal to be %d, got %v", inputDeletingPodsTotal, actualDeletingPodsTotal) | ||
} | ||
|
||
actualDeletingPodsErrorTotal, err := metricstestutil.GetCounterMetricValue(deletingPodsErrorTotal.WithLabelValues()) | ||
actualDeletingPodsErrorTotal, err := metricstestutil.GetCounterMetricValue(deletingPodsErrorTotal.WithLabelValues("out-of-service")) | ||
if err != nil { |
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.
Can you add unit tests for all the other 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.
added.
/triage accepted |
/check-cla |
/easycla |
/assign @gnufied |
@@ -213,9 +213,11 @@ func (gcc *PodGCController) gcTerminated(ctx context.Context, pods []*v1.Pod) { | |||
wait.Add(1) | |||
go func(pod *v1.Pod) { | |||
defer wait.Done() | |||
deletingPodsTotal.WithLabelValues("terminated").Inc() |
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 am thinking, if we should emit this metric before or after the completion of delete operation. As it stands, we emit when we start deleting.
Also, I think we should add namespace to these metrics, so as if we force deleted pods from a particular namespace, a k8s admin can investigate why that happened. @msau42 what do you think?
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.
Waiting for a feedback from @msau42
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.
namespace would be good to add. I have a slight preference to add the metric after completion. Do we care about deletion errors?
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.
@xing-yang what do you think?
b09a043
to
04ac55e
Compare
@xing-yang @msau42 @gnufied the namespace label is added. |
/test pull-kubernetes-node-e2e-containerd |
t.Helper() | ||
|
||
actualDeletingPodsTotal, err := metricstestutil.GetCounterMetricValue(deletingPodsTotal.WithLabelValues()) | ||
actualDeletingPodsTotal, err := metricstestutil.GetCounterMetricValue(metrics.DeletingPodsTotal.WithLabelValues("", reason)) |
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 is the namespace for these pods?
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 |
LGTM label has been added. Git tree hash: b87e82ce5aab1c88b98e1351fc76a6dd201c19ed
|
/assign @janetkuo |
/lgtm |
/assign @andrewsykim |
/assign @soltysh |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carlory, soltysh 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 |
/priority important-longterm |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Literally,
force_delete_pods_total
andforce_delete_pod_errors_total
metrics should count all the behaviors of the gc controller that forcefully delete pods.The
reason
label indicates the reason why the pod was forcibly deleted by GCSpecial notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: