diff --git a/api/operator/v1beta1/vmnodescrape_types.go b/api/operator/v1beta1/vmnodescrape_types.go
index 57df71163..eb92171e1 100644
--- a/api/operator/v1beta1/vmnodescrape_types.go
+++ b/api/operator/v1beta1/vmnodescrape_types.go
@@ -38,7 +38,7 @@ type VMNodeScrapeSpec struct {
// one of scrape_interval or interval can be used
// +optional
ScrapeInterval string `json:"scrape_interval,omitempty"`
- // Timeout after which the scrape is ended
+ // ScrapeTimeout after which the scrape is ended
// +optional
ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
// OAuth2 defines auth configuration
diff --git a/api/operator/v1beta1/vmpodscrape_types.go b/api/operator/v1beta1/vmpodscrape_types.go
index 7f065561f..d6a6e26fb 100644
--- a/api/operator/v1beta1/vmpodscrape_types.go
+++ b/api/operator/v1beta1/vmpodscrape_types.go
@@ -91,7 +91,7 @@ type PodMetricsEndpoint struct {
// one of scrape_interval or interval can be used
// +optional
ScrapeInterval string `json:"scrape_interval,omitempty"`
- // Timeout after which the scrape is ended
+ // ScrapeTimeout after which the scrape is ended
// +optional
ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
// SampleLimit defines per-podEndpoint limit on number of scraped samples that will be accepted.
diff --git a/api/operator/v1beta1/vmscrapeconfig_types.go b/api/operator/v1beta1/vmscrapeconfig_types.go
index d231d12f5..e1d9bba32 100644
--- a/api/operator/v1beta1/vmscrapeconfig_types.go
+++ b/api/operator/v1beta1/vmscrapeconfig_types.go
@@ -63,6 +63,9 @@ type VMScrapeConfigSpec struct {
// ScrapeInterval is the interval between consecutive scrapes.
// +optional
ScrapeInterval string `json:"scrapeInterval,omitempty"`
+ // ScrapeProtocols defines Prometheus scrape protocol.
+ // +optional
+ ScrapeProtocols []string `json:"scrape_protocols,omitempty"`
// ScrapeTimeout is the number of seconds to wait until a scrape request times out.
// +optional
ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
diff --git a/api/operator/v1beta1/vmservicescrape_types.go b/api/operator/v1beta1/vmservicescrape_types.go
index f4c4e3be6..63d38bb76 100644
--- a/api/operator/v1beta1/vmservicescrape_types.go
+++ b/api/operator/v1beta1/vmservicescrape_types.go
@@ -137,7 +137,7 @@ type Endpoint struct {
// one of scrape_interval or interval can be used
// +optional
ScrapeInterval string `json:"scrape_interval,omitempty"`
- // Timeout after which the scrape is ended
+ // ScrapeTimeout after which the scrape is ended
// +optional
ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
// SampleLimit defines per-endpoint limit on number of scraped samples that will be accepted.
diff --git a/api/operator/v1beta1/vmstaticscrape_types.go b/api/operator/v1beta1/vmstaticscrape_types.go
index 4c7005b22..b73345b47 100644
--- a/api/operator/v1beta1/vmstaticscrape_types.go
+++ b/api/operator/v1beta1/vmstaticscrape_types.go
@@ -60,7 +60,7 @@ type TargetEndpoint struct {
// one of scrape_interval or interval can be used
// +optional
ScrapeInterval string `json:"scrape_interval,omitempty"`
- // Timeout after which the scrape is ended
+ // ScrapeTimeout after which the scrape is ended
// +optional
ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
// OAuth2 defines auth configuration
diff --git a/api/operator/v1beta1/zz_generated.deepcopy.go b/api/operator/v1beta1/zz_generated.deepcopy.go
index d53cfd3dd..e724e0bdf 100644
--- a/api/operator/v1beta1/zz_generated.deepcopy.go
+++ b/api/operator/v1beta1/zz_generated.deepcopy.go
@@ -5863,6 +5863,11 @@ func (in *VMScrapeConfigSpec) DeepCopyInto(out *VMScrapeConfigSpec) {
*out = new(string)
**out = **in
}
+ if in.ScrapeProtocols != nil {
+ in, out := &in.ScrapeProtocols, &out.ScrapeProtocols
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
if in.HonorTimestamps != nil {
in, out := &in.HonorTimestamps, &out.HonorTimestamps
*out = new(bool)
diff --git a/config/crd/overlay/crd.yaml b/config/crd/overlay/crd.yaml
index f5faf4d57..2b2f919e8 100644
--- a/config/crd/overlay/crd.yaml
+++ b/config/crd/overlay/crd.yaml
@@ -16602,7 +16602,7 @@ spec:
one of scrape_interval or interval can be used
type: string
scrapeTimeout:
- description: Timeout after which the scrape is ended
+ description: ScrapeTimeout after which the scrape is ended
type: string
selector:
description: Selector to select kubernetes Nodes.
@@ -17676,7 +17676,7 @@ spec:
one of scrape_interval or interval can be used
type: string
scrapeTimeout:
- description: Timeout after which the scrape is ended
+ description: ScrapeTimeout after which the scrape is ended
type: string
seriesLimit:
description: |-
@@ -23134,6 +23134,11 @@ spec:
- HTTP
- HTTPS
type: string
+ scrape_protocols:
+ description: ScrapeProtocols defines Prometheus scrape protocol.
+ items:
+ type: string
+ type: array
scrapeInterval:
description: ScrapeInterval is the interval between consecutive scrapes.
type: string
@@ -24171,7 +24176,7 @@ spec:
one of scrape_interval or interval can be used
type: string
scrapeTimeout:
- description: Timeout after which the scrape is ended
+ description: ScrapeTimeout after which the scrape is ended
type: string
seriesLimit:
description: |-
@@ -26924,7 +26929,7 @@ spec:
one of scrape_interval or interval can be used
type: string
scrapeTimeout:
- description: Timeout after which the scrape is ended
+ description: ScrapeTimeout after which the scrape is ended
type: string
seriesLimit:
description: |-
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 81b074ad4..5145ca717 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -32,6 +32,8 @@ aliases:
- [operator](./README.md): fix VM CRs' `xxNamespaceSelector` and `xxSelector` options, previously they are inverted. See this [issue](https://github.com/VictoriaMetrics/operator/issues/980) for details.
- [vmnodescrape](./api.md#vmnodescrape): remove duplicated `series_limit` and `sample_limit` fields in generated scrape_config. See [this issue](https://github.com/VictoriaMetrics/operator/issues/986).
+- [vmservicescrape](./api.md#vmservicescrape), [vmpodscrape](./api.md#vmpodscrape), [vmnodescrape](./api.md#vmnodescrape) - added `scrape_protocols` parameter for scrape protocols configuration
+
## [v0.45.0](https://github.com/VictoriaMetrics/operator/releases/tag/v0.45.0) - 10 Jun 2024
diff --git a/docs/api.md b/docs/api.md
index 475cc14ff..446e7c76b 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -652,7 +652,7 @@ _Appears in:_
| `relabelConfigs` | RelabelConfigs to apply to samples during service discovery. | _[RelabelConfig](#relabelconfig) array_ | false |
| `sampleLimit` | SampleLimit defines per-endpoint limit on number of scraped samples that will be accepted. | _integer_ | false |
| `scheme` | HTTP scheme to use for scraping. | _string_ | false |
-| `scrapeTimeout` | Timeout after which the scrape is ended | _string_ | false |
+| `scrapeTimeout` | ScrapeTimeout after which the scrape is ended | _string_ | false |
| `scrape_interval` | ScrapeInterval is the same as Interval and has priority over it.
one of scrape_interval or interval can be used | _string_ | false |
| `seriesLimit` | SeriesLimit defines per-scrape limit on number of unique time series
a single target can expose during all the scrapes on the time window of 24h. | _integer_ | false |
| `targetPort` | Name or number of the pod port this endpoint refers to. Mutually exclusive with port. | _[IntOrString](#intorstring)_ | false |
@@ -1218,7 +1218,7 @@ _Appears in:_
| `relabelConfigs` | RelabelConfigs to apply to samples during service discovery. | _[RelabelConfig](#relabelconfig) array_ | false |
| `sampleLimit` | SampleLimit defines per-podEndpoint limit on number of scraped samples that will be accepted. | _integer_ | false |
| `scheme` | HTTP scheme to use for scraping. | _string_ | false |
-| `scrapeTimeout` | Timeout after which the scrape is ended | _string_ | false |
+| `scrapeTimeout` | ScrapeTimeout after which the scrape is ended | _string_ | false |
| `scrape_interval` | ScrapeInterval is the same as Interval and has priority over it.
one of scrape_interval or interval can be used | _string_ | false |
| `seriesLimit` | SeriesLimit defines per-scrape limit on number of unique time series
a single target can expose during all the scrapes on the time window of 24h. | _integer_ | false |
| `tlsConfig` | TLSConfig configuration to use when scraping the endpoint | _[TLSConfig](#tlsconfig)_ | false |
@@ -1829,7 +1829,7 @@ _Appears in:_
| `relabelConfigs` | RelabelConfigs to apply to samples during service discovery. | _[RelabelConfig](#relabelconfig) array_ | false |
| `sampleLimit` | SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. | _integer_ | false |
| `scheme` | HTTP scheme to use for scraping. | _string_ | false |
-| `scrapeTimeout` | Timeout after which the scrape is ended | _string_ | false |
+| `scrapeTimeout` | ScrapeTimeout after which the scrape is ended | _string_ | false |
| `scrape_interval` | ScrapeInterval is the same as Interval and has priority over it.
one of scrape_interval or interval can be used | _string_ | false |
| `seriesLimit` | SeriesLimit defines per-scrape limit on number of unique time series
a single target can expose during all the scrapes on the time window of 24h. | _integer_ | false |
| `targets` | Targets static targets addresses in form of ["192.122.55.55:9100","some-name:9100"]. | _string array_ | true |
@@ -2782,7 +2782,7 @@ _Appears in:_
| `relabelConfigs` | RelabelConfigs to apply to samples during service discovery. | _[RelabelConfig](#relabelconfig) array_ | false |
| `sampleLimit` | SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. | _integer_ | false |
| `scheme` | HTTP scheme to use for scraping. | _string_ | false |
-| `scrapeTimeout` | Timeout after which the scrape is ended | _string_ | false |
+| `scrapeTimeout` | ScrapeTimeout after which the scrape is ended | _string_ | false |
| `scrape_interval` | ScrapeInterval is the same as Interval and has priority over it.
one of scrape_interval or interval can be used | _string_ | false |
| `selector` | Selector to select kubernetes Nodes. | _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#labelselector-v1-meta)_ | false |
| `seriesLimit` | SeriesLimit defines per-scrape limit on number of unique time series
a single target can expose during all the scrapes on the time window of 24h. | _integer_ | false |
@@ -3071,6 +3071,7 @@ _Appears in:_
| `scheme` | Configures the protocol scheme used for requests.
If empty, use HTTP by default. | _string_ | false |
| `scrapeInterval` | ScrapeInterval is the interval between consecutive scrapes. | _string_ | false |
| `scrapeTimeout` | ScrapeTimeout is the number of seconds to wait until a scrape request times out. | _string_ | false |
+| `scrape_protocols` | ScrapeProtocols defines Prometheus scrape protocol. | _string array_ | false |
| `seriesLimit` | SeriesLimit defines per-scrape limit on number of unique time series
a single target can expose during all the scrapes on the time window of 24h. | _integer_ | false |
| `staticConfigs` | StaticConfigs defines a list of static targets with a common label set. | _[StaticConfig](#staticconfig) array_ | false |
| `tlsConfig` | TLS configuration to use on every scrape request | _[TLSConfig](#tlsconfig)_ | false |
diff --git a/docs/vars.md b/docs/vars.md
index 0b1fa3187..0f41a6c88 100644
--- a/docs/vars.md
+++ b/docs/vars.md
@@ -10,7 +10,7 @@ menu:
# Auto Generated vars for package config
- updated at Tue Jul 2 15:08:03 UTC 2024
+ updated at Tue Jul 2 17:12:36 UTC 2024
| variable name | variable default value | variable required | variable description |
diff --git a/internal/controller/operator/factory/vmagent/nodescrape.go b/internal/controller/operator/factory/vmagent/nodescrape.go
index deb5a1a45..d330d2816 100644
--- a/internal/controller/operator/factory/vmagent/nodescrape.go
+++ b/internal/controller/operator/factory/vmagent/nodescrape.go
@@ -48,7 +48,6 @@ func generateNodeScrapeConfig(
if scrapeInterval != "" {
cfg = append(cfg, yaml.MapItem{Key: "scrape_interval", Value: scrapeInterval})
}
-
if nodeSpec.ScrapeTimeout != "" {
cfg = append(cfg, yaml.MapItem{Key: "scrape_timeout", Value: nodeSpec.ScrapeTimeout})
}
diff --git a/internal/controller/operator/factory/vmagent/scrapeconfig.go b/internal/controller/operator/factory/vmagent/scrapeconfig.go
index 59c76833f..29954b19c 100644
--- a/internal/controller/operator/factory/vmagent/scrapeconfig.go
+++ b/internal/controller/operator/factory/vmagent/scrapeconfig.go
@@ -38,6 +38,9 @@ func generateScrapeConfig(
if sc.Spec.ScrapeInterval != "" {
cfg = append(cfg, yaml.MapItem{Key: "scrape_interval", Value: scrapeInterval})
}
+ if len(sc.Spec.ScrapeProtocols) != 0 {
+ cfg = append(cfg, yaml.MapItem{Key: "scrape_protocols", Value: sc.Spec.ScrapeProtocols})
+ }
if sc.Spec.ScrapeTimeout != "" {
cfg = append(cfg, yaml.MapItem{Key: "scrape_timeout", Value: sc.Spec.ScrapeTimeout})
}
diff --git a/internal/controller/operator/factory/vmagent/scrapeconfig_test.go b/internal/controller/operator/factory/vmagent/scrapeconfig_test.go
index 7480d7f5e..9ad65e09c 100644
--- a/internal/controller/operator/factory/vmagent/scrapeconfig_test.go
+++ b/internal/controller/operator/factory/vmagent/scrapeconfig_test.go
@@ -51,6 +51,7 @@ func TestGenerateScrapeConfig(t *testing.T) {
Username: corev1.SecretKeySelector{Key: "username"},
Password: corev1.SecretKeySelector{Key: "password"},
},
+ ScrapeProtocols: []string{"PrometheusProto"},
},
},
ssCache: &scrapesSecretsCache{
@@ -65,6 +66,8 @@ func TestGenerateScrapeConfig(t *testing.T) {
want: `job_name: scrapeConfig/default/static-1
honor_labels: false
scrape_interval: 30s
+scrape_protocols:
+- PrometheusProto
basic_auth:
username: admin
password: dangerous