Repository: VictoriaMetrics/operator

Issue:
vmagent: add support of global relabeling configuration
Starting from [v1.106.0](https://docs.victoriametrics.com/changelog/#v11060) vmagent and VictoriaMetrics single-node support `metric_relabel_configs` and `relabel_configs` as a part of the global configuration.

It would be great to have an option to provide global relabel configs via operator as well.

Hints from issue comments:
@f41gh7: @Haleygo  could you please take a look? Currently operator provides own per resource configuration for relabeling. It's more flexible, but maybe we should switch to the native `vmagent` implementation.  Or at least add option for that.@f41gh7: The feature was included into [v0.61.0](https://docs.victoriametrics.com/operator/changelog/#v0610) release

Solution patch:
diff --git a/api/operator/v1beta1/vmagent_types.go b/api/operator/v1beta1/vmagent_types.go
index d232a77b..6cf114c1 100644
--- a/api/operator/v1beta1/vmagent_types.go
+++ b/api/operator/v1beta1/vmagent_types.go
@@ -61,15 +61,6 @@ type VMAgentSpec struct {
 	// +kubebuilder:validation:Enum=default;json
 	LogFormat string `json:"logFormat,omitempty"`
 
-	// ScrapeInterval defines how often scrape targets by default
-	// +optional
-	// +kubebuilder:validation:Pattern:="[0-9]+(ms|s|m|h)"
-	ScrapeInterval string `json:"scrapeInterval,omitempty"`
-	// ScrapeTimeout defines global timeout for targets scrape
-	// +optional
-	// +kubebuilder:validation:Pattern:="[0-9]+(ms|s|m|h)"
-	ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
-
 	// APIServerConfig allows specifying a host and auth methods to access apiserver.
 	// If left empty, VMAgent is assumed to run inside of the cluster
 	// and will discover API servers automatically and use the pod's CA certificate
@@ -91,10 +82,6 @@ type VMAgentSpec struct {
 	// +optional
 	VMAgentExternalLabelName *string `json:"vmAgentExternalLabelName,omitempty"`
 
-	// ExternalLabels The labels to add to any time series scraped by vmagent.
-	// it doesn't affect metrics ingested directly by push API's
-	// +optional
-	ExternalLabels map[string]string `json:"externalLabels,omitempty"`
 	// RemoteWrite list of victoria metrics /some other remote write system
 	// for vm it must looks like: http://victoria-metrics-single:8429/api/v1/write
 	// or for cluster different url
@@ -273,6 +260,24 @@ type VMAgentSpec struct {
 	// it's useful for adding specific labels to all targets
 	// +optional
 	ScrapeConfigRelabelTemplate []*RelabelConfig `json:"scrapeConfigRelabelTemplate,omitempty"`
+	// GlobalScrapeMetricRelabelConfigs is a global metric relabel configuration, which is applied to each scrape job.
+	// +optional
+	GlobalScrapeMetricRelabelConfigs []*RelabelConfig `json:"globalScrapeMetricRelabelConfigs,omitempty"`
+	// GlobalScrapeRelabelConfigs is a global relabel configuration, which is applied to each samples of each scrape job during service discovery.
+	// +optional
+	GlobalScrapeRelabelConfigs []*RelabelConfig `json:"globalScrapeRelabelConfigs,omitempty"`
+	// ScrapeInterval defines how often scrape targets by default
+	// +optional
+	// +kubebuilder:validation:Pattern:="[0-9]+(ms|s|m|h)"
+	ScrapeInterval string `json:"scrapeInterval,omitempty"`
+	// ScrapeTimeout defines global timeout for targets scrape
+	// +optional
+	// +kubebuilder:validation:Pattern:="[0-9]+(ms|s|m|h)"
+	ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
+	// ExternalLabels The labels to add to any time series scraped by vmagent.
+	// it doesn't affect metrics ingested directly by push API's
+	// +optional
+	ExternalLabels map[string]string `json:"externalLabels,omitempty"`
 	// MinScrapeInterval allows limiting minimal scrape interval for VMServiceScrape, VMPodScrape and other scrapes
 	// If interval is lower than defined limit, `minScrapeInterval` will be used.
 	MinScrapeInterval *string `json:"minScrapeInterval,omitempty"`
diff --git a/api/operator/v1beta1/zz_generated.deepcopy.go b/api/operator/v1beta1/zz_generated.deepcopy.go
index f1b2b69b..48210785 100644
--- a/api/operator/v1beta1/zz_generated.deepcopy.go
+++ b/api/operator/v1beta1/zz_generated.deepcopy.go
@@ -3965,13 +3965,6 @@ func (in *VMAgentSpec) DeepCopyInto(out *VMAgentSpec) {
 		*out = new(string)
 		**out = **in
 	}
-	if in.ExternalLabels != nil {
-		in, out := &in.ExternalLabels, &out.ExternalLabels
-		*out = make(map[string]string, len(*in))
-		for key, val := range *in {
-			(*out)[key] = val
-		}
-	}
 	if in.RemoteWrite != nil {
 		in, out := &in.RemoteWrite, &out.RemoteWrite
 		*out = make([]VMAgentRemoteWriteSpec, len(*in))
@@ -4176,6 +4169,35 @@ func (in *VMAgentSpec) DeepCopyInto(out *VMAgentSpec) {
 			}
 		}
 	}
+	if in.GlobalScrapeMetricRelabelConfigs != nil {
+		in, out := &in.GlobalScrapeMetricRelabelConfigs, &out.GlobalScrapeMetricRelabelConfigs
+		*out = make([]*RelabelConfig, len(*in))
+		for i := range *in {
+			if (*in)[i] != nil {
+				in, out := &(*in)[i], &(*out)[i]
+				*out = new(RelabelConfig)
+				(*in).DeepCopyInto(*out)
+			}
+		}
+	}
+	if in.GlobalScrapeRelabelConfigs != nil {
+		in, out := &in.GlobalScrapeRelabelConfigs, &out.GlobalScrapeRelabelConfigs
+		*out = make([]*RelabelConfig, len(*in))
+		for i := range *in {
+			if (*in)[i] != nil {
+				in, out := &(*in)[i], &(*out)[i]
+				*out = new(RelabelConfig)
+				(*in).DeepCopyInto(*out)
+			}
+		}
+	}
+	if in.ExternalLabels != nil {
+		in, out := &in.ExternalLabels, &out.ExternalLabels
+		*out = make(map[string]string, len(*in))
+		for key, val := range *in {
+			(*out)[key] = val
+		}
+	}
 	if in.MinScrapeInterval != nil {
 		in, out := &in.MinScrapeInterval, &out.MinScrapeInterval
 		*out = new(string)
diff --git a/config/crd/overlay/crd.yaml b/config/crd/overlay/crd.yaml
index 936cc01e..e352eca1 100644
--- a/config/crd/overlay/crd.yaml
+++ b/config/crd/overlay/crd.yaml
@@ -5043,6 +5043,161 @@ spec:
                       x-kubernetes-map-type: atomic
                   type: object
                 type: array
+              globalScrapeMetricRelabelConfigs:
+                description: GlobalScrapeMetricRelabelConfigs is a global metric relabel
+                  configuration, which is applied to each scrape job.
+                items:
+                  description: |-
+                    RelabelConfig allows dynamic rewriting of the label set
+                    More info: https://docs.victoriametrics.com/victoriametrics/#relabeling
+                  properties:
+                    action:
+                      description: Action to perform based on regex matching. Default
+                        is 'replace'
+                      type: string
+                    if:
+                      description: 'If represents metricsQL match expression (or list
+                        of expressions): ''{__name__=~"foo_.*"}'''
+                      x-kubernetes-preserve-unknown-fields: true
+                    labels:
+                      additionalProperties:
+                        type: string
+                      description: 'Labels is used together with Match for `action:
+                        graphite`'
+                      type: object
+                    match:
+                      description: 'Match is used together with Labels for `action:
+                        graphite`'
+                      type: string
+                    modulus:
+                      description: Modulus to take of the hash of the source label
+                        values.
+                      format: int64
+                      type: integer
+                    regex:
+                      description: |-
+                        Regular expression against which the extracted value is matched. Default is '(.*)'
+                        victoriaMetrics supports multiline regex joined with |
+                        https://docs.victoriametrics.com/victoriametrics/vmagent/#relabeling-enhancements
+                      x-kubernetes-preserve-unknown-fields: true
+                    replacement:
+                      description: |-
+                        Replacement value against which a regex replace is performed if the
+                        regular expression matches. Regex capture groups are available. Default is '$1'
+                      type: string
+                    separator:
+                      description: Separator placed between concatenated source label
+                        values. default is ';'.
+                      type: string
+                    source_labels:
+                      description: |-
+                        UnderScoreSourceLabels - additional form of source labels source_labels
+                        for compatibility with original relabel config.
+                        if set  both sourceLabels and source_labels, sourceLabels has priority.
+                        for details https://github.com/VictoriaMetrics/operator/issues/131
+                      items:
+                        type: string
+                      type: array
+                    sourceLabels:
+                      description: |-
+                        The source labels select values from existing labels. Their content is concatenated
+                        using the configured separator and matched against the configured regular expression
+                        for the replace, keep, and drop actions.
+                      items:
+                        type: string
+                      type: array
+                    target_label:
+                      description: |-
+                        UnderScoreTargetLabel - additional form of target label - target_label
+                        for compatibility with original relabel config.
+                        if set  both targetLabel and target_label, targetLabel has priority.
+                        for details https://github.com/VictoriaMetrics/operator/issues/131
+                      type: string
+                    targetLabel:
+                      description: |-
+                        Label to which the resulting value is written in a replace action.
+                        It is mandatory for replace actions. Regex capture groups are available.
+                      type: string
+                  type: object
+                type: array
+              globalScrapeRelabelConfigs:
+                description: GlobalScrapeRelabelConfigs is a global relabel configuration,
+                  which is applied to each samples of each scrape job during service
+                  discovery.
+                items:
+                  description: |-
+                    RelabelConfig allows dynamic rewriting of the label set
+                    More info: https://docs.victoriametrics.com/victoriametrics/#relabeling
+                  properties:
+                    action:
+                      description: Action to perform based on regex matching. Default
+                        is 'replace'
+                      type: string
+                    if:
+                      description: 'If represents metricsQL match expression (or list
+                        of expressions): ''{__name__=~"foo_.*"}'''
+                      x-kubernetes-preserve-unknown-fields: true
+                    labels:
+                      additionalProperties:
+                        type: string
+                      description: 'Labels is used together with Match for `action:
+                        graphite`'
+                      type: object
+                    match:
+                      description: 'Match is used together with Labels for `action:
+                        graphite`'
+                      type: string
+                    modulus:
+                      description: Modulus to take of the hash of the source label
+                        values.
+                      format: int64
+                      type: integer
+                    regex:
+                      description: |-
+                        Regular expression against which the extracted value is matched. Default is '(.*)'
+                        victoriaMetrics supports multiline regex joined with |
+                        https://docs.victoriametrics.com/victoriametrics/vmagent/#relabeling-enhancements
+                      x-kubernetes-preserve-unknown-fields: true
+                    replacement:
+                      description: |-
+                        Replacement value against which a regex replace is performed if the
+                        regular expression matches. Regex capture groups are available. Default is '$1'
+                      type: string
+                    separator:
+                      description: Separator placed between concatenated source label
+                        values. default is ';'.
+                      type: string
+                    source_labels:
+                      description: |-
+                        UnderScoreSourceLabels - additional form of source labels source_labels
+                        for compatibility with original relabel config.
+                        if set  both sourceLabels and source_labels, sourceLabels has priority.
+                        for details https://github.com/VictoriaMetrics/operator/issues/131
+                      items:
+                        type: string
+                      type: array
+                    sourceLabels:
+                      description: |-
+                        The source labels select values from existing labels. Their content is concatenated
+                        using the configured separator and matched against the configured regular expression
+                        for the replace, keep, and drop actions.
+                      items:
+                        type: string
+                      type: array
+                    target_label:
+                      description: |-
+                        UnderScoreTargetLabel - additional form of target label - target_label
+                        for compatibility with original relabel config.
+                        if set  both targetLabel and target_label, targetLabel has priority.
+                        for details https://github.com/VictoriaMetrics/operator/issues/131
+                      type: string
+                    targetLabel:
+                      description: |-
+                        Label to which the resulting value is written in a replace action.
+                        It is mandatory for replace actions. Regex capture groups are available.
+                      type: string
+                  type: object
+                type: array
               host_aliases:
                 description: |-
                   HostAliasesUnderScore provides mapping for ip and hostname,
diff --git a/config/examples/vmagent-full.yaml b/config/examples/vmagent-full.yaml
index a21217b8..9cfde39e 100644
--- a/config/examples/vmagent-full.yaml
+++ b/config/examples/vmagent-full.yaml
@@ -83,8 +83,8 @@ spec:
     repository: victoriametrics/vmagent
     tag: v1.46.0
     pullPolicy: IfNotPresent
-  scrapeInterval: 30s
   vmAgentExternalLabelName: vmagent
+  scrapeInterval: 30s
   externalLabels:
     key: value
   # Add fields here
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index cede7a07..cf436105 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,7 +13,10 @@ aliases:
 
 ## tip
 
+* Dependency: [vmoperator](https://docs.victoriametrics.com/operator/): Updated default versions for VL apps to [v1.25.0](https://github.com/VictoriaMetrics/VictoriaLogs/releases/tag/v1.25.0).
+
 * FEATURE: [vmanomaly](https://docs.victoriametrics.com/anomaly-detection/): update shards concurrently. See [#1434](https://github.com/VictoriaMetrics/operator/issues/1434).
+* FEATURE: [vmagent](https://docs.victoriametrics.com/operator/resources/vmagent/): introduce global scrape config for VMAgent. See [#1179](https://github.com/VictoriaMetrics/operator/issues/1179).
 
 ## [v0.60.2](https://github.com/VictoriaMetrics/operator/releases/tag/v0.60.2)
 
diff --git a/docs/api.md b/docs/api.md
index 411f3d57..0e1469ad 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -2870,6 +2870,8 @@ Appears in: [VMAgent](#vmagent)
 | extraArgs<a href="#vmagentspec-extraargs" id="vmagentspec-extraargs">#</a><br/>_object (keys:string, values:string)_ | _(Optional)_<br/>ExtraArgs that will be passed to the application container<br />for example remoteWrite.tmpDataPath: /tmp |
 | extraEnvs<a href="#vmagentspec-extraenvs" id="vmagentspec-extraenvs">#</a><br/>_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_<br/>ExtraEnvs that will be passed to the application container |
 | extraEnvsFrom<a href="#vmagentspec-extraenvsfrom" id="vmagentspec-extraenvsfrom">#</a><br/>_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_<br/>ExtraEnvsFrom defines source of env variables for the application container<br />could either be secret or configmap |
+| globalScrapeMetricRelabelConfigs<a href="#vmagentspec-globalscrapemetricrelabelconfigs" id="vmagentspec-globalscrapemetricrelabelconfigs">#</a><br/>_[RelabelConfig](#relabelconfig) array_ | _(Optional)_<br/>GlobalScrapeMetricRelabelConfigs is a global metric relabel configuration, which is applied to each scrape job. |
+| globalScrapeRelabelConfigs<a href="#vmagentspec-globalscraperelabelconfigs" id="vmagentspec-globalscraperelabelconfigs">#</a><br/>_[RelabelConfig](#relabelconfig) array_ | _(Optional)_<br/>GlobalScrapeRelabelConfigs is a global relabel configuration, which is applied to each samples of each scrape job during service discovery. |
 | hostAliases<a href="#vmagentspec-hostaliases" id="vmagentspec-hostaliases">#</a><br/>_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_<br/>HostAliases provides mapping for ip and hostname,<br />that would be propagated to pod,<br />cannot be used with HostNetwork. |
 | hostNetwork<a href="#vmagentspec-hostnetwork" id="vmagentspec-hostnetwork">#</a><br/>_boolean_ | _(Optional)_<br/>HostNetwork controls whether the pod may use the node network namespace |
 | host_aliases<a href="#vmagentspec-host_aliases" id="vmagentspec-host_aliases">#</a><br/>_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_<br/>HostAliasesUnderScore provides mapping for ip and hostname,<br />that would be propagated to pod,<br />cannot be used with HostNetwork.<br />Has Priority over hostAliases field |
diff --git a/docs/env.md b/docs/env.md
index 94513abe..30d12e6a 100644
--- a/docs/env.md
+++ b/docs/env.md
@@ -1,7 +1,7 @@
 | Environment variables |
 | --- |
 | VM_METRICS_VERSION: `v1.120.0` <a href="#variables-vm-metrics-version" id="variables-vm-metrics-version">#</a> |
-| VM_LOGS_VERSION: `v1.24.0` <a href="#variables-vm-logs-version" id="variables-vm-logs-version">#</a> |
+| VM_LOGS_VERSION: `v1.25.0` <a href="#variables-vm-logs-version" id="variables-vm-logs-version">#</a> |
 | VM_ANOMALY_VERSION: `v1.24.1` <a href="#variables-vm-anomaly-version" id="variables-vm-anomaly-version">#</a> |
 | VM_USECUSTOMCONFIGRELOADER: `false` <a href="#variables-vm-usecustomconfigreloader" id="variables-vm-usecustomconfigreloader">#</a><br>enables custom config reloader for vmauth and vmagent, it should speed-up config reloading process. |
 | VM_CONTAINERREGISTRY: `-` <a href="#variables-vm-containerregistry" id="variables-vm-containerregistry">#</a><br>container registry name prefix, e.g. docker.io |
@@ -12,7 +12,7 @@
 | VM_CONFIG_RELOADER_REQUEST_CPU: `-` <a href="#variables-vm-config-reloader-request-cpu" id="variables-vm-config-reloader-request-cpu">#</a><br>defines global resource.requests.cpu for all config-reloader containers |
 | VM_CONFIG_RELOADER_REQUEST_MEMORY: `-` <a href="#variables-vm-config-reloader-request-memory" id="variables-vm-config-reloader-request-memory">#</a><br>defines global resource.requests.memory for all config-reloader containers |
 | VM_VLOGSDEFAULT_IMAGE: `victoriametrics/victoria-logs` <a href="#variables-vm-vlogsdefault-image" id="variables-vm-vlogsdefault-image">#</a> |
-| VM_VLOGSDEFAULT_VERSION: `${VM_LOGS_VERSION}-victorialogs` <a href="#variables-vm-vlogsdefault-version" id="variables-vm-vlogsdefault-version">#</a> |
+| VM_VLOGSDEFAULT_VERSION: `${VM_LOGS_VERSION}` <a href="#variables-vm-vlogsdefault-version" id="variables-vm-vlogsdefault-version">#</a> |
 | VM_VLOGSDEFAULT_PORT: `9428` <a href="#variables-vm-vlogsdefault-port" id="variables-vm-vlogsdefault-port">#</a> |
 | VM_VLOGSDEFAULT_USEDEFAULTRESOURCES: `true` <a href="#variables-vm-vlogsdefault-usedefaultresources" id="variables-vm-vlogsdefault-usedefaultresources">#</a> |
 | VM_VLOGSDEFAULT_RESOURCE_LIMIT_MEM: `1500Mi` <a href="#variables-vm-vlogsdefault-resource-limit-mem" id="variables-vm-vlogsdefault-resource-limit-mem">#</a> |
@@ -20,7 +20,7 @@
 | VM_VLOGSDEFAULT_RESOURCE_REQUEST_MEM: `500Mi` <a href="#variables-vm-vlogsdefault-resource-request-mem" id="variables-vm-vlogsdefault-resource-request-mem">#</a> |
 | VM_VLOGSDEFAULT_RESOURCE_REQUEST_CPU: `150m` <a href="#variables-vm-vlogsdefault-resource-request-cpu" id="variables-vm-vlogsdefault-resource-request-cpu">#</a> |
 | VM_VLSINGLEDEFAULT_IMAGE: `victoriametrics/victoria-logs` <a href="#variables-vm-vlsingledefault-image" id="variables-vm-vlsingledefault-image">#</a> |
-| VM_VLSINGLEDEFAULT_VERSION: `${VM_LOGS_VERSION}-victorialogs` <a href="#variables-vm-vlsingledefault-version" id="variables-vm-vlsingledefault-version">#</a> |
+| VM_VLSINGLEDEFAULT_VERSION: `${VM_LOGS_VERSION}` <a href="#variables-vm-vlsingledefault-version" id="variables-vm-vlsingledefault-version">#</a> |
 | VM_VLSINGLEDEFAULT_PORT: `9428` <a href="#variables-vm-vlsingledefault-port" id="variables-vm-vlsingledefault-port">#</a> |
 | VM_VLSINGLEDEFAULT_USEDEFAULTRESOURCES: `true` <a href="#variables-vm-vlsingledefault-usedefaultresources" id="variables-vm-vlsingledefault-usedefaultresources">#</a> |
 | VM_VLSINGLEDEFAULT_RESOURCE_LIMIT_MEM: `1500Mi` <a href="#variables-vm-vlsingledefault-resource-limit-mem" id="variables-vm-vlsingledefault-resource-limit-mem">#</a> |
@@ -126,21 +126,21 @@
 | VM_VMAUTHDEFAULT_CONFIGRELOADERMEMORY: `25Mi` <a href="#variables-vm-vmauthdefault-configreloadermemory" id="variables-vm-vmauthdefault-configreloadermemory">#</a><br>Deprecated: use VM_CONFIG_RELOADER_REQUEST_MEMORY instead |
 | VM_VLCLUSTERDEFAULT_USEDEFAULTRESOURCES: `true` <a href="#variables-vm-vlclusterdefault-usedefaultresources" id="variables-vm-vlclusterdefault-usedefaultresources">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_IMAGE: `victoriametrics/victoria-logs` <a href="#variables-vm-vlclusterdefault-vlselectdefault-image" id="variables-vm-vlclusterdefault-vlselectdefault-image">#</a> |
-| VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_VERSION: `${VM_LOGS_VERSION}-victorialogs` <a href="#variables-vm-vlclusterdefault-vlselectdefault-version" id="variables-vm-vlclusterdefault-vlselectdefault-version">#</a> |
+| VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_VERSION: `${VM_LOGS_VERSION}` <a href="#variables-vm-vlclusterdefault-vlselectdefault-version" id="variables-vm-vlclusterdefault-vlselectdefault-version">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_PORT: `9471` <a href="#variables-vm-vlclusterdefault-vlselectdefault-port" id="variables-vm-vlclusterdefault-vlselectdefault-port">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_RESOURCE_LIMIT_MEM: `1024Mi` <a href="#variables-vm-vlclusterdefault-vlselectdefault-resource-limit-mem" id="variables-vm-vlclusterdefault-vlselectdefault-resource-limit-mem">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_RESOURCE_LIMIT_CPU: `1000m` <a href="#variables-vm-vlclusterdefault-vlselectdefault-resource-limit-cpu" id="variables-vm-vlclusterdefault-vlselectdefault-resource-limit-cpu">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_RESOURCE_REQUEST_MEM: `256Mi` <a href="#variables-vm-vlclusterdefault-vlselectdefault-resource-request-mem" id="variables-vm-vlclusterdefault-vlselectdefault-resource-request-mem">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSELECTDEFAULT_RESOURCE_REQUEST_CPU: `100m` <a href="#variables-vm-vlclusterdefault-vlselectdefault-resource-request-cpu" id="variables-vm-vlclusterdefault-vlselectdefault-resource-request-cpu">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_IMAGE: `victoriametrics/victoria-logs` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-image" id="variables-vm-vlclusterdefault-vlstoragedefault-image">#</a> |
-| VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_VERSION: `${VM_LOGS_VERSION}-victorialogs` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-version" id="variables-vm-vlclusterdefault-vlstoragedefault-version">#</a> |
+| VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_VERSION: `${VM_LOGS_VERSION}` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-version" id="variables-vm-vlclusterdefault-vlstoragedefault-version">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_PORT: `9491` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-port" id="variables-vm-vlclusterdefault-vlstoragedefault-port">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_RESOURCE_LIMIT_MEM: `2048Mi` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-resource-limit-mem" id="variables-vm-vlclusterdefault-vlstoragedefault-resource-limit-mem">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_RESOURCE_LIMIT_CPU: `1000m` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-resource-limit-cpu" id="variables-vm-vlclusterdefault-vlstoragedefault-resource-limit-cpu">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_RESOURCE_REQUEST_MEM: `512Mi` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-resource-request-mem" id="variables-vm-vlclusterdefault-vlstoragedefault-resource-request-mem">#</a> |
 | VM_VLCLUSTERDEFAULT_VLSTORAGEDEFAULT_RESOURCE_REQUEST_CPU: `200m` <a href="#variables-vm-vlclusterdefault-vlstoragedefault-resource-request-cpu" id="variables-vm-vlclusterdefault-vlstoragedefault-resource-request-cpu">#</a> |
 | VM_VLCLUSTERDEFAULT_VLINSERTDEFAULT_IMAGE: `victoriametrics/victoria-logs` <a href="#variables-vm-vlclusterdefault-vlinsertdefault-image" id="variables-vm-vlclusterdefault-vlinsertdefault-image">#</a> |
-| VM_VLCLUSTERDEFAULT_VLINSERTDEFAULT_VERSION: `${VM_LOGS_VERSION}-victorialogs` <a href="#variables-vm-vlclusterdefault-vlinsertdefault-version" id="variables-vm-vlclusterdefault-vlinsertdefault-version">#</a> |
+| VM_VLCLUSTERDEFAULT_VLINSERTDEFAULT_VERSION: `${VM_LOGS_VERSION}` <a href="#variables-vm-vlclusterdefault-vlinsertdefault-version" id="variables-vm-vlclusterdefault-vlinsertdefault-version">#</a> |
 | VM_VLCLUSTERDEFAULT_VLINSERTDEFAULT_PORT: `9481` <a href="#variables-vm-vlclusterdefault-vlinsertdefault-port" id="variables-vm-vlclusterdefault-vlinsertdefault-port">#</a> |
 | VM_VLCLUSTERDEFAULT_VLINSERTDEFAULT_RESOURCE_LIMIT_MEM: `1024Mi` <a href="#variables-vm-vlclusterdefault-vlinsertdefault-resource-limit-mem" id="variables-vm-vlclusterdefault-vlinsertdefault-resource-limit-mem">#</a> |
 | VM_VLCLUSTERDEFAULT_VLINSERTDEFAULT_RESOURCE_LIMIT_CPU: `1000m` <a href="#variables-vm-vlclusterdefault-vlinsertdefault-resource-limit-cpu" id="variables-vm-vlclusterdefault-vlinsertdefault-resource-limit-cpu">#</a> |
diff --git a/docs/resources/vmagent.md b/docs/resources/vmagent.md
index 9dcb9083..af107f60 100644
--- a/docs/resources/vmagent.md
+++ b/docs/resources/vmagent.md
@@ -196,8 +196,8 @@ spec:
   vmAgentExternalLabelName: vmagent_ha
   remoteWrite:
     - url: "http://vmsingle-example.default.svc:8429/api/v1/write"
-  # Replication:
   scrapeInterval: 30s
+  # Replication:
   replicaCount: 2
   # ...
 ```
@@ -226,8 +226,8 @@ spec:
   vmAgentExternalLabelName: vmagent_ha
   remoteWrite:
     - url: "http://vmsingle-example.default.svc:8429/api/v1/write"
-  # Replication:
   scrapeInterval: 30s
+  # Replication:
   replicaCount: 2
   # StatefulMode:
   statefulMode: true
@@ -769,9 +769,9 @@ spec:
   replicaCount: 1
   scrapeInterval: 30s
   scrapeTimeout: 10s
-  vmAgentExternalLabelName: example
   externalLabels:
     cluster: my-cluster
+  vmAgentExternalLabelName: example
   remoteWrite:
     - url: "http://vmsingle-example.default.svc:8429/api/v1/write"
   inlineRelabelConfig:
diff --git a/internal/config/config.go b/internal/config/config.go
index 5993f23e..ac5cf1d5 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -31,7 +31,7 @@ var (
 	// DO NOT FORGET TO MODIFY VERSIONS IN BaseOperatorConf
 	defaultEnvs = map[string]string{
 		"VM_METRICS_VERSION": "v1.120.0",
-		"VM_LOGS_VERSION":    "v1.24.0",
+		"VM_LOGS_VERSION":    "v1.25.0",
 		"VM_ANOMALY_VERSION": "v1.24.1",
 	}
 )
@@ -99,7 +99,7 @@ type BaseOperatorConf struct {
 	// DO NOT FORGET TO MODIFY VERSIONS IN defaultEnvs
 
 	MetricsVersion string `default:"v1.120.0" env:"METRICS_VERSION"`
-	LogsVersion    string `default:"v1.24.0" env:"LOGS_VERSION"`
+	LogsVersion    string `default:"v1.25.0" env:"LOGS_VERSION"`
 	AnomalyVersion string `default:"v1.24.1" env:"ANOMALY_VERSION"`
 
 	// enables custom config reloader for vmauth and vmagent,
@@ -122,7 +122,7 @@ type BaseOperatorConf struct {
 
 	VLogsDefault struct {
 		Image               string `default:"victoriametrics/victoria-logs"`
-		Version             string `env:",expand" default:"${VM_LOGS_VERSION}-victorialogs"`
+		Version             string `env:",expand" default:"${VM_LOGS_VERSION}"`
 		ConfigReloadImage   string `env:"-"`
 		Port                string `default:"9428"`
 		UseDefaultResources bool   `default:"true" env:"USEDEFAULTRESOURCES"`
@@ -142,7 +142,7 @@ type BaseOperatorConf struct {
 
 	VLSingleDefault struct {
 		Image               string `default:"victoriametrics/victoria-logs"`
-		Version             string `env:",expand" default:"${VM_LOGS_VERSION}-victorialogs"`
+		Version             string `env:",expand" default:"${VM_LOGS_VERSION}"`
 		ConfigReloadImage   string `env:"-"`
 		Port                string `default:"9428"`
 		UseDefaultResources bool   `default:"true" env:"USEDEFAULTRESOURCES"`
@@ -368,7 +368,7 @@ type BaseOperatorConf struct {
 		UseDefaultResources bool `default:"true" env:"USEDEFAULTRESOURCES"`
 		VLSelectDefault     struct {
 			Image    string `default:"victoriametrics/victoria-logs"`
-			Version  string `env:",expand" default:"${VM_LOGS_VERSION}-victorialogs"`
+			Version  string `env:",expand" default:"${VM_LOGS_VERSION}"`
 			Port     string `default:"9471"`
 			Resource struct {
 				Limit struct {
@@ -383,7 +383,7 @@ type BaseOperatorConf struct {
 		} `prefix:"VLSELECTDEFAULT_"`
 		VLStorageDefault struct {
 			Image    string `default:"victoriametrics/victoria-logs"`
-			Version  string `env:",expand" default:"${VM_LOGS_VERSION}-victorialogs"`
+			Version  string `env:",expand" default:"${VM_LOGS_VERSION}"`
 			Port     string `default:"9491"`
 			Resource struct {
 				Limit struct {
@@ -398,7 +398,7 @@ type BaseOperatorConf struct {
 		} `prefix:"VLSTORAGEDEFAULT_"`
 		VLInsertDefault struct {
 			Image    string `default:"victoriametrics/victoria-logs"`
-			Version  string `env:",expand" default:"${VM_LOGS_VERSION}-victorialogs"`
+			Version  string `env:",expand" default:"${VM_LOGS_VERSION}"`
 			Port     string `default:"9481"`
 			Resource struct {
 				Limit struct {
diff --git a/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig.go b/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig.go
index 98e048e6..677042f3 100644
--- a/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig.go
+++ b/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig.go
@@ -484,14 +484,15 @@ func generateConfig(
 		cr.Spec.IgnoreNamespaceSelectors = true
 	}
 
-	if cr.Spec.ScrapeInterval == "" {
-		cr.Spec.ScrapeInterval = defaultScrapeInterval
+	scrapeInterval := defaultScrapeInterval
+	if cr.Spec.ScrapeInterval != "" {
+		scrapeInterval = cr.Spec.ScrapeInterval
 	}
-
 	globalItems := yaml.MapSlice{
-		{Key: "scrape_interval", Value: cr.Spec.ScrapeInterval},
+		{Key: "scrape_interval", Value: scrapeInterval},
 		{Key: "external_labels", Value: buildExternalLabels(cr)},
 	}
+
 	if cr.Spec.ScrapeTimeout != "" {
 		globalItems = append(globalItems, yaml.MapItem{
 			Key:   "scrape_timeout",
@@ -499,6 +500,19 @@ func generateConfig(
 		})
 	}
 
+	if len(cr.Spec.GlobalScrapeMetricRelabelConfigs) > 0 {
+		globalItems = append(globalItems, yaml.MapItem{
+			Key:   "metric_relabel_configs",
+			Value: cr.Spec.GlobalScrapeMetricRelabelConfigs,
+		})
+	}
+	if len(cr.Spec.GlobalScrapeRelabelConfigs) > 0 {
+		globalItems = append(globalItems, yaml.MapItem{
+			Key:   "relabel_configs",
+			Value: cr.Spec.GlobalScrapeRelabelConfigs,
+		})
+	}
+
 	cfg = append(cfg, yaml.MapItem{Key: "global", Value: globalItems})
 
 	apiserverConfig := cr.Spec.APIServerConfig
@@ -980,7 +994,6 @@ func buildExternalLabels(p *vmv1beta1.VMAgent) yaml.MapSlice {
 	if prometheusExternalLabelName != "" {
 		m[prometheusExternalLabelName] = fmt.Sprintf("%s/%s", p.Namespace, p.Name)
 	}
-
 	for n, v := range p.Spec.ExternalLabels {
 		m[n] = v
 	}



Test patch:
diff --git a/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig_test.go b/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig_test.go
index 086549f2..82f0f796 100644
--- a/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig_test.go
+++ b/internal/controller/operator/factory/vmagent/vmagent_scrapeconfig_test.go
@@ -923,6 +923,22 @@ scrape_configs:
 					StaticScrapeSelector:           &metav1.LabelSelector{},
 					ProbeNamespaceSelector:         &metav1.LabelSelector{},
 					ProbeSelector:                  &metav1.LabelSelector{},
+					ScrapeTimeout:                  "20m",
+					ScrapeInterval:                 "30m",
+					ExternalLabels: map[string]string{
+						"externalLabelName": "externalLabelValue",
+					},
+					GlobalScrapeRelabelConfigs: []*vmv1beta1.RelabelConfig{
+						{
+							UnderScoreSourceLabels: []string{"test2"},
+						},
+					},
+
+					GlobalScrapeMetricRelabelConfigs: []*vmv1beta1.RelabelConfig{
+						{
+							UnderScoreSourceLabels: []string{"test1"},
+						},
+					},
 				},
 			},
 			c: func() *config.BaseOperatorConf {
@@ -987,9 +1003,17 @@ scrape_configs:
 				},
 			},
 			wantConfig: `global:
-  scrape_interval: 30s
+  scrape_interval: 30m
   external_labels:
+    externalLabelName: externalLabelValue
     prometheus: default/test
+  scrape_timeout: 20m
+  metric_relabel_configs:
+  - source_labels:
+    - test1
+  relabel_configs:
+  - source_labels:
+    - test2
 scrape_configs:
 - job_name: serviceScrape/default/test-vms/0
   kubernetes_sd_configs: