Hi,
Looks like when a node is being remediated, the nodehealthcheck_ongoing_remediation metric uses a label set with name=< node-name >:
https://github.com/medik8s/node-healthcheck-operator/blob/main/controllers/nodehealthcheck_controller.go#L618
And once the remediation is completed, the metric uses a label set with name=< remediation-cr-name >:
https://github.com/medik8s/node-healthcheck-operator/blob/main/controllers/resources/status.go#L66
This results in the metrics appearing as shown below:

In the image, the yellow line (value=0) has name set to remdiation CR name and the blue line (value=1, stuck) has name set to node name.
That is, the metric for the node name is permanently stuck at 1, incorrectly indicating an ongoing remediation.
Steps to reproduce
- Induce a node to be unhealthy (I usually stop kubelet)
- Wait for the node to be remediated
- Observe the metrics.
Sample raw metrics:
{
"metric": {
"__name__": "nodehealthcheck_ongoing_remediation",
"container": "kube-rbac-proxy",
"endpoint": "https",
"exported_instance": "x.x.x.x:yy",
"exported_job": "node-healthcheck-controller-manager-metrics-service",
"exported_namespace": "openshift-workload-availability",
"instance": "my-redacted-instance:my-port",
"job": "prometheus-federate-job",
"name": "<node-name>", // This is the node name
"namespace": "openshift-workload-availability",
"pod": "node-healthcheck-controller-manager-7f6475d7d4-zvrxw",
"prometheus": "openshift-monitoring/k8s",
"prometheus_replica": "prometheus-k8s-0",
"remediation": "SelfNodeRemediation",
"service": "node-healthcheck-controller-manager-metrics-service"
},
"value": [
1771598863.253,
"1" // Value is "1" for Node name
]
},
{
"metric": {
"__name__": "nodehealthcheck_ongoing_remediation",
"container": "kube-rbac-proxy",
"endpoint": "https",
"exported_instance": "x.x.x.x:yy",
"exported_job": "node-healthcheck-controller-manager-metrics-service",
"exported_namespace": "openshift-workload-availability",
"instance": "my-redacted-instance:my-port",
"job": "prometheus-federate",
"name": "<node-name>-mh7vw", // This is the remediation CR
"namespace": "openshift-workload-availability",
"pod": "node-healthcheck-controller-manager-7f6475d7d4-zvrxw",
"prometheus": "openshift-monitoring/k8s",
"prometheus_replica": "prometheus-k8s-0",
"remediation": "SelfNodeRemediation",
"service": "node-healthcheck-controller-manager-metrics-service"
},
"value": [
1771598863.253,
"0" // Value is "0" for remediation CR
]
}
Looks like the issue was introduced in this PR: #231 , when
metrics.ObserveNodeHealthCheckRemediationDeleted(node.GetName(), remediationCR.GetNamespace(), remediationCR.GetKind())
was moved to deleteRemediationCR method:
metrics.ObserveNodeHealthCheckRemediationDeleted(remediationCR.GetName(), remediationCR.GetNamespace(), remediationCR.GetKind())
Hi,
Looks like when a node is being remediated, the nodehealthcheck_ongoing_remediation metric uses a label set with name=< node-name >:
https://github.com/medik8s/node-healthcheck-operator/blob/main/controllers/nodehealthcheck_controller.go#L618
And once the remediation is completed, the metric uses a label set with name=< remediation-cr-name >:
https://github.com/medik8s/node-healthcheck-operator/blob/main/controllers/resources/status.go#L66
This results in the metrics appearing as shown below:

In the image, the yellow line (value=0) has name set to remdiation CR name and the blue line (value=1, stuck) has name set to node name.
That is, the metric for the node name is permanently stuck at 1, incorrectly indicating an ongoing remediation.
Steps to reproduce
Sample raw metrics:
Looks like the issue was introduced in this PR: #231 , when
was moved to
deleteRemediationCRmethod: