mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-15 16:56:24 +00:00
Fix: Remove scrapeFallbackProtocol in Prometheus CommonSpec (#7197)
* move common scrapeFallbackProtocol Signed-off-by: dongjiang <dongjiang1989@126.com>
This commit is contained in:
parent
85ac658b93
commit
ca3db528a0
17 changed files with 0 additions and 239 deletions
75
Documentation/api.md
generated
75
Documentation/api.md
generated
|
@ -2036,21 +2036,6 @@ protocols supported by Prometheus in order of preference (from most to least pre
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeFallbackProtocol</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.</p>
|
||||
<p>It requires Prometheus >= v3.0.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -7194,21 +7179,6 @@ protocols supported by Prometheus in order of preference (from most to least pre
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeFallbackProtocol</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.</p>
|
||||
<p>It requires Prometheus >= v3.0.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -12054,21 +12024,6 @@ protocols supported by Prometheus in order of preference (from most to least pre
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeFallbackProtocol</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.</p>
|
||||
<p>It requires Prometheus >= v3.0.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -18824,21 +18779,6 @@ protocols supported by Prometheus in order of preference (from most to least pre
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeFallbackProtocol</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.</p>
|
||||
<p>It requires Prometheus >= v3.0.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -26775,21 +26715,6 @@ protocols supported by Prometheus in order of preference (from most to least pre
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeFallbackProtocol</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.</p>
|
||||
<p>It requires Prometheus >= v3.0.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
|
24
bundle.yaml
generated
24
bundle.yaml
generated
|
@ -27987,18 +27987,6 @@ spec:
|
|||
type: object
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
scrapeFallbackProtocol:
|
||||
description: |-
|
||||
The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.
|
||||
|
||||
It requires Prometheus >= v3.0.0.
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
- PrometheusText1.0.0
|
||||
type: string
|
||||
scrapeInterval:
|
||||
default: 30s
|
||||
description: |-
|
||||
|
@ -40460,18 +40448,6 @@ spec:
|
|||
type: object
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
scrapeFallbackProtocol:
|
||||
description: |-
|
||||
The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.
|
||||
|
||||
It requires Prometheus >= v3.0.0.
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
- PrometheusText1.0.0
|
||||
type: string
|
||||
scrapeInterval:
|
||||
default: 30s
|
||||
description: |-
|
||||
|
|
|
@ -6854,18 +6854,6 @@ spec:
|
|||
type: object
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
scrapeFallbackProtocol:
|
||||
description: |-
|
||||
The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.
|
||||
|
||||
It requires Prometheus >= v3.0.0.
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
- PrometheusText1.0.0
|
||||
type: string
|
||||
scrapeInterval:
|
||||
default: 30s
|
||||
description: |-
|
||||
|
|
|
@ -8562,18 +8562,6 @@ spec:
|
|||
type: object
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
scrapeFallbackProtocol:
|
||||
description: |-
|
||||
The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.
|
||||
|
||||
It requires Prometheus >= v3.0.0.
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
- PrometheusText1.0.0
|
||||
type: string
|
||||
scrapeInterval:
|
||||
default: 30s
|
||||
description: |-
|
||||
|
|
|
@ -6855,18 +6855,6 @@ spec:
|
|||
type: object
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
scrapeFallbackProtocol:
|
||||
description: |-
|
||||
The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.
|
||||
|
||||
It requires Prometheus >= v3.0.0.
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
- PrometheusText1.0.0
|
||||
type: string
|
||||
scrapeInterval:
|
||||
default: 30s
|
||||
description: |-
|
||||
|
|
|
@ -8563,18 +8563,6 @@ spec:
|
|||
type: object
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
scrapeFallbackProtocol:
|
||||
description: |-
|
||||
The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.
|
||||
|
||||
It requires Prometheus >= v3.0.0.
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
- PrometheusText1.0.0
|
||||
type: string
|
||||
scrapeInterval:
|
||||
default: 30s
|
||||
description: |-
|
||||
|
|
|
@ -5863,17 +5863,6 @@
|
|||
"type": "object",
|
||||
"x-kubernetes-map-type": "atomic"
|
||||
},
|
||||
"scrapeFallbackProtocol": {
|
||||
"description": "The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.\n\nIt requires Prometheus >= v3.0.0.",
|
||||
"enum": [
|
||||
"PrometheusProto",
|
||||
"OpenMetricsText0.0.1",
|
||||
"OpenMetricsText1.0.0",
|
||||
"PrometheusText0.0.4",
|
||||
"PrometheusText1.0.0"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"scrapeInterval": {
|
||||
"default": "30s",
|
||||
"description": "Interval between consecutive scrapes.\n\nDefault: \"30s\"",
|
||||
|
|
|
@ -7371,17 +7371,6 @@
|
|||
"type": "object",
|
||||
"x-kubernetes-map-type": "atomic"
|
||||
},
|
||||
"scrapeFallbackProtocol": {
|
||||
"description": "The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.\n\nIt requires Prometheus >= v3.0.0.",
|
||||
"enum": [
|
||||
"PrometheusProto",
|
||||
"OpenMetricsText0.0.1",
|
||||
"OpenMetricsText1.0.0",
|
||||
"PrometheusText0.0.4",
|
||||
"PrometheusText1.0.0"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"scrapeInterval": {
|
||||
"default": "30s",
|
||||
"description": "Interval between consecutive scrapes.\n\nDefault: \"30s\"",
|
||||
|
|
|
@ -311,12 +311,6 @@ type CommonPrometheusFields struct {
|
|||
// +optional
|
||||
ScrapeProtocols []ScrapeProtocol `json:"scrapeProtocols,omitempty"`
|
||||
|
||||
// The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.
|
||||
//
|
||||
// It requires Prometheus >= v3.0.0.
|
||||
// +optional
|
||||
ScrapeFallbackProtocol *ScrapeProtocol `json:"scrapeFallbackProtocol,omitempty"`
|
||||
|
||||
// The labels to add to any time series or alerts when communicating with
|
||||
// external systems (federation, remote storage, Alertmanager).
|
||||
// Labels defined by `spec.replicaExternalLabelName` and
|
||||
|
|
5
pkg/apis/monitoring/v1/zz_generated.deepcopy.go
generated
5
pkg/apis/monitoring/v1/zz_generated.deepcopy.go
generated
|
@ -756,11 +756,6 @@ func (in *CommonPrometheusFields) DeepCopyInto(out *CommonPrometheusFields) {
|
|||
*out = make([]ScrapeProtocol, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ScrapeFallbackProtocol != nil {
|
||||
in, out := &in.ScrapeFallbackProtocol, &out.ScrapeFallbackProtocol
|
||||
*out = new(ScrapeProtocol)
|
||||
**out = **in
|
||||
}
|
||||
if in.ExternalLabels != nil {
|
||||
in, out := &in.ExternalLabels, &out.ExternalLabels
|
||||
*out = make(map[string]string, len(*in))
|
||||
|
|
|
@ -49,7 +49,6 @@ type CommonPrometheusFieldsApplyConfiguration struct {
|
|||
ScrapeInterval *monitoringv1.Duration `json:"scrapeInterval,omitempty"`
|
||||
ScrapeTimeout *monitoringv1.Duration `json:"scrapeTimeout,omitempty"`
|
||||
ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"`
|
||||
ScrapeFallbackProtocol *monitoringv1.ScrapeProtocol `json:"scrapeFallbackProtocol,omitempty"`
|
||||
ExternalLabels map[string]string `json:"externalLabels,omitempty"`
|
||||
EnableRemoteWriteReceiver *bool `json:"enableRemoteWriteReceiver,omitempty"`
|
||||
EnableOTLPReceiver *bool `json:"enableOTLPReceiver,omitempty"`
|
||||
|
@ -313,14 +312,6 @@ func (b *CommonPrometheusFieldsApplyConfiguration) WithScrapeProtocols(values ..
|
|||
return b
|
||||
}
|
||||
|
||||
// WithScrapeFallbackProtocol sets the ScrapeFallbackProtocol field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ScrapeFallbackProtocol field is set to the value of the last call.
|
||||
func (b *CommonPrometheusFieldsApplyConfiguration) WithScrapeFallbackProtocol(value monitoringv1.ScrapeProtocol) *CommonPrometheusFieldsApplyConfiguration {
|
||||
b.ScrapeFallbackProtocol = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithExternalLabels puts the entries into the ExternalLabels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the ExternalLabels field,
|
||||
|
|
|
@ -245,14 +245,6 @@ func (b *PrometheusSpecApplyConfiguration) WithScrapeProtocols(values ...monitor
|
|||
return b
|
||||
}
|
||||
|
||||
// WithScrapeFallbackProtocol sets the ScrapeFallbackProtocol field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ScrapeFallbackProtocol field is set to the value of the last call.
|
||||
func (b *PrometheusSpecApplyConfiguration) WithScrapeFallbackProtocol(value monitoringv1.ScrapeProtocol) *PrometheusSpecApplyConfiguration {
|
||||
b.ScrapeFallbackProtocol = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithExternalLabels puts the entries into the ExternalLabels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the ExternalLabels field,
|
||||
|
|
|
@ -233,14 +233,6 @@ func (b *PrometheusAgentSpecApplyConfiguration) WithScrapeProtocols(values ...mo
|
|||
return b
|
||||
}
|
||||
|
||||
// WithScrapeFallbackProtocol sets the ScrapeFallbackProtocol field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ScrapeFallbackProtocol field is set to the value of the last call.
|
||||
func (b *PrometheusAgentSpecApplyConfiguration) WithScrapeFallbackProtocol(value monitoringv1.ScrapeProtocol) *PrometheusAgentSpecApplyConfiguration {
|
||||
b.ScrapeFallbackProtocol = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithExternalLabels puts the entries into the ExternalLabels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the ExternalLabels field,
|
||||
|
|
|
@ -4829,7 +4829,6 @@ func (cg *ConfigGenerator) buildGlobalConfig() yaml.MapSlice {
|
|||
cfg := yaml.MapSlice{}
|
||||
cfg = cg.appendScrapeIntervals(cfg)
|
||||
cfg = cg.addScrapeProtocols(cfg, cg.prom.GetCommonPrometheusFields().ScrapeProtocols)
|
||||
cfg = cg.addScrapeFallbackProtocol(cfg, cg.prom.GetCommonPrometheusFields().ScrapeFallbackProtocol)
|
||||
cfg = cg.appendExternalLabels(cfg)
|
||||
cfg = cg.appendScrapeLimits(cfg)
|
||||
if cpf.NameValidationScheme != nil {
|
||||
|
|
|
@ -125,7 +125,6 @@ func TestGlobalSettings(t *testing.T) {
|
|||
ScrapeInterval monitoringv1.Duration
|
||||
ScrapeTimeout monitoringv1.Duration
|
||||
ScrapeProtocols []monitoringv1.ScrapeProtocol
|
||||
ScrapeFallbackProtocol *monitoringv1.ScrapeProtocol
|
||||
ExternalLabels map[string]string
|
||||
PrometheusExternalLabelName *string
|
||||
ReplicaExternalLabelName *string
|
||||
|
@ -265,22 +264,6 @@ func TestGlobalSettings(t *testing.T) {
|
|||
},
|
||||
Golden: "valid_global_config_with_unsupported_scrape_protocols.golden",
|
||||
},
|
||||
{
|
||||
Scenario: "valid global config with scrape fallback protocol",
|
||||
Version: "v3.0.0-rc.0",
|
||||
ScrapeInterval: "30s",
|
||||
EvaluationInterval: "30s",
|
||||
ScrapeFallbackProtocol: ptr.To(monitoringv1.PrometheusText1_0_0),
|
||||
Golden: "valid_global_config_with_scrape_fallback_protocol.golden",
|
||||
},
|
||||
{
|
||||
Scenario: "valid global config scrape protocols with unsupported version",
|
||||
Version: "v2.55.0",
|
||||
ScrapeInterval: "30s",
|
||||
EvaluationInterval: "30s",
|
||||
ScrapeFallbackProtocol: ptr.To(monitoringv1.PrometheusProto),
|
||||
Golden: "valid_global_config_with_unsupported_scrape_fallback_protocols.golden",
|
||||
},
|
||||
{
|
||||
Scenario: "valid global config without rule query offset if prometheus version less required",
|
||||
Version: "v2.52.0",
|
||||
|
@ -309,7 +292,6 @@ func TestGlobalSettings(t *testing.T) {
|
|||
ScrapeInterval: tc.ScrapeInterval,
|
||||
ScrapeTimeout: tc.ScrapeTimeout,
|
||||
ScrapeProtocols: tc.ScrapeProtocols,
|
||||
ScrapeFallbackProtocol: tc.ScrapeFallbackProtocol,
|
||||
ExternalLabels: tc.ExternalLabels,
|
||||
PrometheusExternalLabelName: tc.PrometheusExternalLabelName,
|
||||
ReplicaExternalLabelName: tc.ReplicaExternalLabelName,
|
||||
|
|
8
pkg/prometheus/testdata/valid_global_config_with_scrape_fallback_protocol.golden
generated
vendored
8
pkg/prometheus/testdata/valid_global_config_with_scrape_fallback_protocol.golden
generated
vendored
|
@ -1,8 +0,0 @@
|
|||
global:
|
||||
scrape_interval: 30s
|
||||
fallback_scrape_protocol: PrometheusText1.0.0
|
||||
external_labels:
|
||||
prometheus: test/example
|
||||
prometheus_replica: $(POD_NAME)
|
||||
evaluation_interval: 30s
|
||||
scrape_configs: []
|
|
@ -1,7 +0,0 @@
|
|||
global:
|
||||
scrape_interval: 30s
|
||||
external_labels:
|
||||
prometheus: test/example
|
||||
prometheus_replica: $(POD_NAME)
|
||||
evaluation_interval: 30s
|
||||
scrape_configs: []
|
Loading…
Add table
Reference in a new issue