mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 03:38:43 +00:00
Merge pull request #7327 from kubeservice-stack/support-round-robin-dns
feat: Add `round_robin_dns` option from prometheus RemoteWriteConfig
This commit is contained in:
parent
b34cb97847
commit
3031ecb596
14 changed files with 172 additions and 0 deletions
Documentation/api-reference
bundle.yamlexample
prometheus-operator-crd-full
prometheus-operator-crd
jsonnet/prometheus-operator
pkg
apis/monitoring/v1
client/applyconfiguration/monitoring/v1
prometheus
|
@ -14947,6 +14947,26 @@ bool
|
|||
<p>Whether to enable HTTP2.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>roundRobinDNS</code><br/>
|
||||
<em>
|
||||
bool
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>When enabled:
|
||||
- The remote-write mechanism will resolve the hostname via DNS.
|
||||
- It will randomly select one of the resolved IP addresses and connect to it.</p>
|
||||
<p>When disabled (default behavior):
|
||||
- The Go standard library will handle hostname resolution.
|
||||
- It will attempt connections to each resolved IP address sequentially.</p>
|
||||
<p>Note: The connection timeout applies to the entire resolution and connection process.
|
||||
If disabled, the timeout is distributed across all connection attempts.</p>
|
||||
<p>It requires Prometheus >= v3.1.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3 id="monitoring.coreos.com/v1.Rule">Rule
|
||||
|
|
30
bundle.yaml
generated
30
bundle.yaml
generated
|
@ -26980,6 +26980,21 @@ spec:
|
|||
description: Timeout for requests to the remote write endpoint.
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
roundRobinDNS:
|
||||
description: |-
|
||||
When enabled:
|
||||
- The remote-write mechanism will resolve the hostname via DNS.
|
||||
- It will randomly select one of the resolved IP addresses and connect to it.
|
||||
|
||||
When disabled (default behavior):
|
||||
- The Go standard library will handle hostname resolution.
|
||||
- It will attempt connections to each resolved IP address sequentially.
|
||||
|
||||
Note: The connection timeout applies to the entire resolution and connection process.
|
||||
If disabled, the timeout is distributed across all connection attempts.
|
||||
|
||||
It requires Prometheus >= v3.1.0.
|
||||
type: boolean
|
||||
sendExemplars:
|
||||
description: |-
|
||||
Enables sending of exemplars over remote write. Note that
|
||||
|
@ -39365,6 +39380,21 @@ spec:
|
|||
description: Timeout for requests to the remote write endpoint.
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
roundRobinDNS:
|
||||
description: |-
|
||||
When enabled:
|
||||
- The remote-write mechanism will resolve the hostname via DNS.
|
||||
- It will randomly select one of the resolved IP addresses and connect to it.
|
||||
|
||||
When disabled (default behavior):
|
||||
- The Go standard library will handle hostname resolution.
|
||||
- It will attempt connections to each resolved IP address sequentially.
|
||||
|
||||
Note: The connection timeout applies to the entire resolution and connection process.
|
||||
If disabled, the timeout is distributed across all connection attempts.
|
||||
|
||||
It requires Prometheus >= v3.1.0.
|
||||
type: boolean
|
||||
sendExemplars:
|
||||
description: |-
|
||||
Enables sending of exemplars over remote write. Note that
|
||||
|
|
|
@ -5820,6 +5820,21 @@ spec:
|
|||
description: Timeout for requests to the remote write endpoint.
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
roundRobinDNS:
|
||||
description: |-
|
||||
When enabled:
|
||||
- The remote-write mechanism will resolve the hostname via DNS.
|
||||
- It will randomly select one of the resolved IP addresses and connect to it.
|
||||
|
||||
When disabled (default behavior):
|
||||
- The Go standard library will handle hostname resolution.
|
||||
- It will attempt connections to each resolved IP address sequentially.
|
||||
|
||||
Note: The connection timeout applies to the entire resolution and connection process.
|
||||
If disabled, the timeout is distributed across all connection attempts.
|
||||
|
||||
It requires Prometheus >= v3.1.0.
|
||||
type: boolean
|
||||
sendExemplars:
|
||||
description: |-
|
||||
Enables sending of exemplars over remote write. Note that
|
||||
|
|
|
@ -7386,6 +7386,21 @@ spec:
|
|||
description: Timeout for requests to the remote write endpoint.
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
roundRobinDNS:
|
||||
description: |-
|
||||
When enabled:
|
||||
- The remote-write mechanism will resolve the hostname via DNS.
|
||||
- It will randomly select one of the resolved IP addresses and connect to it.
|
||||
|
||||
When disabled (default behavior):
|
||||
- The Go standard library will handle hostname resolution.
|
||||
- It will attempt connections to each resolved IP address sequentially.
|
||||
|
||||
Note: The connection timeout applies to the entire resolution and connection process.
|
||||
If disabled, the timeout is distributed across all connection attempts.
|
||||
|
||||
It requires Prometheus >= v3.1.0.
|
||||
type: boolean
|
||||
sendExemplars:
|
||||
description: |-
|
||||
Enables sending of exemplars over remote write. Note that
|
||||
|
|
|
@ -5821,6 +5821,21 @@ spec:
|
|||
description: Timeout for requests to the remote write endpoint.
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
roundRobinDNS:
|
||||
description: |-
|
||||
When enabled:
|
||||
- The remote-write mechanism will resolve the hostname via DNS.
|
||||
- It will randomly select one of the resolved IP addresses and connect to it.
|
||||
|
||||
When disabled (default behavior):
|
||||
- The Go standard library will handle hostname resolution.
|
||||
- It will attempt connections to each resolved IP address sequentially.
|
||||
|
||||
Note: The connection timeout applies to the entire resolution and connection process.
|
||||
If disabled, the timeout is distributed across all connection attempts.
|
||||
|
||||
It requires Prometheus >= v3.1.0.
|
||||
type: boolean
|
||||
sendExemplars:
|
||||
description: |-
|
||||
Enables sending of exemplars over remote write. Note that
|
||||
|
|
|
@ -7387,6 +7387,21 @@ spec:
|
|||
description: Timeout for requests to the remote write endpoint.
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
roundRobinDNS:
|
||||
description: |-
|
||||
When enabled:
|
||||
- The remote-write mechanism will resolve the hostname via DNS.
|
||||
- It will randomly select one of the resolved IP addresses and connect to it.
|
||||
|
||||
When disabled (default behavior):
|
||||
- The Go standard library will handle hostname resolution.
|
||||
- It will attempt connections to each resolved IP address sequentially.
|
||||
|
||||
Note: The connection timeout applies to the entire resolution and connection process.
|
||||
If disabled, the timeout is distributed across all connection attempts.
|
||||
|
||||
It requires Prometheus >= v3.1.0.
|
||||
type: boolean
|
||||
sendExemplars:
|
||||
description: |-
|
||||
Enables sending of exemplars over remote write. Note that
|
||||
|
|
|
@ -4961,6 +4961,10 @@
|
|||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
"type": "string"
|
||||
},
|
||||
"roundRobinDNS": {
|
||||
"description": "When enabled:\n - The remote-write mechanism will resolve the hostname via DNS.\n - It will randomly select one of the resolved IP addresses and connect to it.\n\nWhen disabled (default behavior):\n - The Go standard library will handle hostname resolution.\n - It will attempt connections to each resolved IP address sequentially.\n\nNote: The connection timeout applies to the entire resolution and connection process.\n If disabled, the timeout is distributed across all connection attempts.\n\nIt requires Prometheus >= v3.1.0.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"sendExemplars": {
|
||||
"description": "Enables sending of exemplars over remote write. Note that\nexemplar-storage itself must be enabled using the `spec.enableFeatures`\noption for exemplars to be scraped in the first place.\n\nIt requires Prometheus >= v2.27.0.",
|
||||
"type": "boolean"
|
||||
|
|
|
@ -6340,6 +6340,10 @@
|
|||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
"type": "string"
|
||||
},
|
||||
"roundRobinDNS": {
|
||||
"description": "When enabled:\n - The remote-write mechanism will resolve the hostname via DNS.\n - It will randomly select one of the resolved IP addresses and connect to it.\n\nWhen disabled (default behavior):\n - The Go standard library will handle hostname resolution.\n - It will attempt connections to each resolved IP address sequentially.\n\nNote: The connection timeout applies to the entire resolution and connection process.\n If disabled, the timeout is distributed across all connection attempts.\n\nIt requires Prometheus >= v3.1.0.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"sendExemplars": {
|
||||
"description": "Enables sending of exemplars over remote write. Note that\nexemplar-storage itself must be enabled using the `spec.enableFeatures`\noption for exemplars to be scraped in the first place.\n\nIt requires Prometheus >= v2.27.0.",
|
||||
"type": "boolean"
|
||||
|
|
|
@ -1562,6 +1562,22 @@ type RemoteWriteSpec struct {
|
|||
// Whether to enable HTTP2.
|
||||
// +optional
|
||||
EnableHttp2 *bool `json:"enableHTTP2,omitempty"`
|
||||
|
||||
// When enabled:
|
||||
// - The remote-write mechanism will resolve the hostname via DNS.
|
||||
// - It will randomly select one of the resolved IP addresses and connect to it.
|
||||
//
|
||||
// When disabled (default behavior):
|
||||
// - The Go standard library will handle hostname resolution.
|
||||
// - It will attempt connections to each resolved IP address sequentially.
|
||||
//
|
||||
// Note: The connection timeout applies to the entire resolution and connection process.
|
||||
// If disabled, the timeout is distributed across all connection attempts.
|
||||
//
|
||||
// It requires Prometheus >= v3.1.0.
|
||||
//
|
||||
// +optional
|
||||
RoundRobinDNS *bool `json:"roundRobinDNS,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:validation:Enum=V1.0;V2.0
|
||||
|
|
5
pkg/apis/monitoring/v1/zz_generated.deepcopy.go
generated
5
pkg/apis/monitoring/v1/zz_generated.deepcopy.go
generated
|
@ -2750,6 +2750,11 @@ func (in *RemoteWriteSpec) DeepCopyInto(out *RemoteWriteSpec) {
|
|||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
if in.RoundRobinDNS != nil {
|
||||
in, out := &in.RoundRobinDNS, &out.RoundRobinDNS
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteWriteSpec.
|
||||
|
|
|
@ -45,6 +45,7 @@ type RemoteWriteSpecApplyConfiguration struct {
|
|||
QueueConfig *QueueConfigApplyConfiguration `json:"queueConfig,omitempty"`
|
||||
MetadataConfig *MetadataConfigApplyConfiguration `json:"metadataConfig,omitempty"`
|
||||
EnableHttp2 *bool `json:"enableHTTP2,omitempty"`
|
||||
RoundRobinDNS *bool `json:"roundRobinDNS,omitempty"`
|
||||
}
|
||||
|
||||
// RemoteWriteSpecApplyConfiguration constructs a declarative configuration of the RemoteWriteSpec type for use with
|
||||
|
@ -261,3 +262,11 @@ func (b *RemoteWriteSpecApplyConfiguration) WithEnableHttp2(value bool) *RemoteW
|
|||
b.EnableHttp2 = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithRoundRobinDNS sets the RoundRobinDNS 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 RoundRobinDNS field is set to the value of the last call.
|
||||
func (b *RemoteWriteSpecApplyConfiguration) WithRoundRobinDNS(value bool) *RemoteWriteSpecApplyConfiguration {
|
||||
b.RoundRobinDNS = &value
|
||||
return b
|
||||
}
|
||||
|
|
|
@ -2738,6 +2738,10 @@ func (cg *ConfigGenerator) generateRemoteWriteConfig(s assets.StoreGetter) yaml.
|
|||
cfg = cg.WithMinimumVersion("2.23.0").AppendMapItem(cfg, "metadata_config", metadataConfig)
|
||||
}
|
||||
|
||||
if spec.RoundRobinDNS != nil {
|
||||
cfg = cg.WithMinimumVersion("3.1.0").AppendMapItem(cfg, "round_robin_dns", spec.RoundRobinDNS)
|
||||
}
|
||||
|
||||
cfgs = append(cfgs, cfg)
|
||||
}
|
||||
|
||||
|
|
|
@ -4315,6 +4315,15 @@ func TestRemoteWriteConfig(t *testing.T) {
|
|||
},
|
||||
golden: "RemoteWriteConfig_v2.54.0_MessageVersion2.golden",
|
||||
},
|
||||
{
|
||||
version: "v3.1.0",
|
||||
remoteWrite: monitoringv1.RemoteWriteSpec{
|
||||
URL: "http://example.com",
|
||||
MessageVersion: ptr.To(monitoringv1.RemoteWriteMessageVersion2_0),
|
||||
RoundRobinDNS: ptr.To(true),
|
||||
},
|
||||
golden: "RemoteWriteConfig_v3.1.0.golden",
|
||||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("i=%d,version=%s", i, tc.version), func(t *testing.T) {
|
||||
p := defaultPrometheus()
|
||||
|
|
11
pkg/prometheus/testdata/RemoteWriteConfig_v3.1.0.golden
generated
vendored
Normal file
11
pkg/prometheus/testdata/RemoteWriteConfig_v3.1.0.golden
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
global:
|
||||
scrape_interval: 30s
|
||||
external_labels:
|
||||
prometheus: default/test
|
||||
prometheus_replica: $(POD_NAME)
|
||||
evaluation_interval: 30s
|
||||
scrape_configs: []
|
||||
remote_write:
|
||||
- url: http://example.com
|
||||
protobuf_message: io.prometheus.write.v2.Request
|
||||
round_robin_dns: true
|
Loading…
Add table
Add a link
Reference in a new issue