From e2dbc4241836adcaed5dea2dec09aa03663c30a0 Mon Sep 17 00:00:00 2001 From: Alessio Trivisonno Date: Sat, 28 Dec 2024 02:40:53 +0100 Subject: [PATCH] fix: set defaults + remove extra spacing --- apis/v1beta1/targetallocator_types.go | 4 ++++ internal/manifests/targetallocator/configmap.go | 9 --------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/apis/v1beta1/targetallocator_types.go b/apis/v1beta1/targetallocator_types.go index 8a398c9c63..911ea4c10a 100644 --- a/apis/v1beta1/targetallocator_types.go +++ b/apis/v1beta1/targetallocator_types.go @@ -41,6 +41,7 @@ type TargetAllocatorPrometheusCR struct { // matchExpressions are ANDed. An empty label selector matches all objects. A null // label selector matches no objects. // +optional + // +kubebuilder:default:={} PodMonitorNamespaceSelector *metav1.LabelSelector `json:"podMonitorNamespaceSelector,omitempty"` // ServiceMonitors to be selected for target discovery. // A label selector is a label query over a set of resources. The result of matchLabels and @@ -53,6 +54,7 @@ type TargetAllocatorPrometheusCR struct { // matchExpressions are ANDed. An empty label selector matches all objects. A null // label selector matches no objects. // +optional + // +kubebuilder:default:={} ServiceMonitorNamespaceSelector *metav1.LabelSelector `json:"serviceMonitorNamespaceSelector,omitempty"` // ScrapeConfigs to be selected for target discovery. // A label selector is a label query over a set of resources. The result of matchLabels and @@ -65,6 +67,7 @@ type TargetAllocatorPrometheusCR struct { // matchExpressions are ANDed. An empty label selector matches all objects. A null // label selector matches no objects. // +optional + // +kubebuilder:default:={} ScrapeConfigNamespaceSelector *metav1.LabelSelector `json:"scrapeConfigNamespaceSelector,omitempty"` // Probes to be selected for target discovery. // A label selector is a label query over a set of resources. The result of matchLabels and @@ -77,6 +80,7 @@ type TargetAllocatorPrometheusCR struct { // matchExpressions are ANDed. An empty label selector matches all objects. A null // label selector matches no objects. // +optional + // +kubebuilder:default:={} ProbeNamespaceSelector *metav1.LabelSelector `json:"probeNamespaceSelector,omitempty"` } diff --git a/internal/manifests/targetallocator/configmap.go b/internal/manifests/targetallocator/configmap.go index ae2e29a57b..ea91fe1fc3 100644 --- a/internal/manifests/targetallocator/configmap.go +++ b/internal/manifests/targetallocator/configmap.go @@ -104,23 +104,14 @@ func ConfigMap(params Params) (*corev1.ConfigMap, error) { if taSpec.PrometheusCR.ScrapeInterval.Size() > 0 { prometheusCRConfig["scrape_interval"] = taSpec.PrometheusCR.ScrapeInterval.Duration } - prometheusCRConfig["service_monitor_selector"] = taSpec.PrometheusCR.ServiceMonitorSelector - prometheusCRConfig["service_monitor_namespace_selector"] = taSpec.PrometheusCR.ServiceMonitorNamespaceSelector - prometheusCRConfig["pod_monitor_selector"] = taSpec.PrometheusCR.PodMonitorSelector - prometheusCRConfig["pod_monitor_namespace_selector"] = taSpec.PrometheusCR.PodMonitorNamespaceSelector - prometheusCRConfig["scrape_config_selector"] = taSpec.PrometheusCR.ScrapeConfigSelector - prometheusCRConfig["scrape_config_namespace_selector"] = taSpec.PrometheusCR.ScrapeConfigNamespaceSelector - prometheusCRConfig["probe_selector"] = taSpec.PrometheusCR.ProbeSelector - prometheusCRConfig["probe_namespace_selector"] = taSpec.PrometheusCR.ProbeNamespaceSelector - taConfig["prometheus_cr"] = prometheusCRConfig }