Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pkg/monitoring/metrics/cdi-controller/dataimportcron.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

const (
// PrometheusCronNsLabel labels the DataImportCron namespace
PrometheusCronNsLabel = "ns"
PrometheusCronNsLabel = "namespace"
// PrometheusCronNameLabel labels the DataImportCron name
PrometheusCronNameLabel = "cron_name"
// PrometheusCronPendingLabel labels whether the DataImportCron import DataVolume is pending for default storage class
Expand Down
16 changes: 14 additions & 2 deletions pkg/monitoring/rules/alerts/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,28 @@ var operatorAlerts = []promv1.Rule{
},
{
Alert: "CDIDataImportCronOutdated",
Expr: intstr.FromString(`sum by(ns,cron_name) (kubevirt_cdi_dataimportcron_outdated{pending="false"}) > 0`),
Expr: intstr.FromString(`sum by(namespace,cron_name) (kubevirt_cdi_dataimportcron_outdated{pending="false", namespace=~"openshift-virtualization-os-images|kubevirt-os-images"}) > 0`),
Copy link
Collaborator

@akalenyu akalenyu Aug 20, 2025

Choose a reason for hiding this comment

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

So I am struggling a bit with CDI having to "know" about "golden image namespaces" or "special dataimportcrons".
I think we should move this definition to other operators that encapsulate this knowledge.

Alternatively, we could also label the metric with this information though I don't know if anything gives it away easily.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I was told the images in openshift-virtualization-os-images|kubevirt-os-images are the golden images.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nunnatsa am I correct?

For: (*promv1.Duration)(ptr.To("15m")),
Annotations: map[string]string{
"summary": "DataImportCron (recurring polling of VM templates disk image sources, also known as golden images) PVCs are not being updated on the defined schedule",
},
Labels: map[string]string{
severityAlertLabelKey: "info",
severityAlertLabelKey: "warning",
operatorHealthImpactLabelKey: "warning",
},
},
{
Alert: "CDIUserDefinedDataImportCronOutdated",
Expr: intstr.FromString(`sum by(namespace,cron_name) (kubevirt_cdi_dataimportcron_outdated{pending="false", namespace!~"openshift-virtualization-os-images|kubevirt-os-images"}) > 0`),
For: (*promv1.Duration)(ptr.To("15m")),
Annotations: map[string]string{
"summary": "DataImportCron (recurring polling of VM templates disk image sources, also known as golden images) PVCs are not being updated on the defined schedule",
},
Labels: map[string]string{
severityAlertLabelKey: "warning",
operatorHealthImpactLabelKey: "none",
},
},
{
Alert: "CDINoDefaultStorageClass",
Expr: intstr.FromString(`sum(kubevirt_cdi_storageprofile_info{default="true"} or on() vector(0)) +
Expand Down