1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

prometheus: remote configuration - add read_recent and required matchers, change naming of proxy_url in CRD

This commit is contained in:
crandl201 2018-03-11 22:18:46 -04:00
parent 238c656a43
commit 03a41b9940
6 changed files with 61 additions and 8 deletions
Documentation
example/prometheus-operator-crd
pkg

View file

@ -259,12 +259,14 @@ RemoteReadSpec defines the remote_read configuration for prometheus.
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| url | The URL of the endpoint to send samples to. | string | true |
| requiredMatchers | An optional list of equality matchers which have to be present in a selector to query the remote read endpoint. | map[string]string | false |
| remoteTimeout | Timeout for requests to the remote write endpoint. | string | false |
| readRecent | Whether reads should be made for queries for time ranges that the local storage should have complete data for. | bool | false |
| basicAuth | BasicAuth for the URL. | *[BasicAuth](#basicauth) | false |
| bearerToken | bearer token for remote write. | string | false |
| bearerTokenFile | File to read bearer token for remote write. | string | false |
| tlsConfig | TLS Config to use for remote write. | *[TLSConfig](#tlsconfig) | false |
| proxy_url | Optional ProxyURL | string | false |
| proxyUrl | Optional ProxyURL | string | false |
[Back to TOC](#table-of-contents)
@ -281,7 +283,7 @@ RemoteWriteSpec defines the remote_write configuration for prometheus.
| bearerToken | File to read bearer token for remote write. | string | false |
| bearerTokenFile | File to read bearer token for remote write. | string | false |
| tlsConfig | TLS Config to use for remote write. | *[TLSConfig](#tlsconfig) | false |
| proxy_url | Optional ProxyURL | string | false |
| proxyUrl | Optional ProxyURL | string | false |
[Back to TOC](#table-of-contents)

View file

@ -1645,12 +1645,20 @@ spec:
bearerTokenFile:
description: File to read bearer token for remote write.
type: string
proxy_url:
proxyUrl:
description: Optional ProxyURL
type: string
readRecent:
description: Whether reads should be made for queries for time
ranges that the local storage should have complete data for.
type: boolean
remoteTimeout:
description: Timeout for requests to the remote write endpoint.
type: string
requiredMatchers:
description: An optional list of equality matchers which have
to be present in a selector to query the remote read endpoint.
type: object
tlsConfig:
description: TLSConfig specifies TLS configuration parameters.
properties:
@ -1724,7 +1732,7 @@ spec:
bearerTokenFile:
description: File to read bearer token for remote write.
type: string
proxy_url:
proxyUrl:
description: Optional ProxyURL
type: string
remoteTimeout:

View file

@ -1000,6 +1000,20 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
Format: "",
},
},
"requiredMatchers": {
SchemaProps: spec.SchemaProps{
Description: "An optional list of equality matchers which have to be present in a selector to query the remote read endpoint.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
"remoteTimeout": {
SchemaProps: spec.SchemaProps{
Description: "Timeout for requests to the remote write endpoint.",
@ -1007,6 +1021,13 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
Format: "",
},
},
"readRecent": {
SchemaProps: spec.SchemaProps{
Description: "Whether reads should be made for queries for time ranges that the local storage should have complete data for.",
Type: []string{"boolean"},
Format: "",
},
},
"basicAuth": {
SchemaProps: spec.SchemaProps{
Description: "BasicAuth for the URL.",
@ -1033,7 +1054,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"),
},
},
"proxy_url": {
"proxyUrl": {
SchemaProps: spec.SchemaProps{
Description: "Optional ProxyURL",
Type: []string{"string"},
@ -1105,7 +1126,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"),
},
},
"proxy_url": {
"proxyUrl": {
SchemaProps: spec.SchemaProps{
Description: "Optional ProxyURL",
Type: []string{"string"},

View file

@ -202,7 +202,7 @@ type RemoteWriteSpec struct {
// TLS Config to use for remote write.
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
//Optional ProxyURL
ProxyURL string `json:"proxy_url,omitempty"`
ProxyURL string `json:"proxyUrl,omitempty"`
}
// RemoteReadSpec defines the remote_read configuration for prometheus.
@ -210,8 +210,14 @@ type RemoteWriteSpec struct {
type RemoteReadSpec struct {
//The URL of the endpoint to send samples to.
URL string `json:"url"`
//An optional list of equality matchers which have to be present
// in a selector to query the remote read endpoint.
RequiredMatchers map[string]string `json:"requiredMatchers,omitempty"`
//Timeout for requests to the remote write endpoint.
RemoteTimeout string `json:"remoteTimeout,omitempty"`
//Whether reads should be made for queries for time ranges that
// the local storage should have complete data for.
ReadRecent bool `json:"readRecent,omitempty"`
//BasicAuth for the URL.
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
// bearer token for remote write.
@ -221,7 +227,7 @@ type RemoteReadSpec struct {
// TLS Config to use for remote write.
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
//Optional ProxyURL
ProxyURL string `json:"proxy_url,omitempty"`
ProxyURL string `json:"proxyUrl,omitempty"`
}
// RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion.

View file

@ -692,6 +692,13 @@ func (in *RelabelConfig) DeepCopy() *RelabelConfig {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RemoteReadSpec) DeepCopyInto(out *RemoteReadSpec) {
*out = *in
if in.RequiredMatchers != nil {
in, out := &in.RequiredMatchers, &out.RequiredMatchers
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.BasicAuth != nil {
in, out := &in.BasicAuth, &out.BasicAuth
if *in == nil {

View file

@ -538,6 +538,14 @@ func generateRemoteReadConfig(version semver.Version, specs []v1.RemoteReadSpec,
{Key: "remote_timeout", Value: spec.RemoteTimeout},
}
if len(spec.RequiredMatchers) > 0 {
cfg = append(cfg, yaml.MapItem{Key: "required_matchers", Value: stringMapToMapSlice(spec.RequiredMatchers)})
}
if spec.ReadRecent {
cfg = append(cfg, yaml.MapItem{Key: "read_recent", Value: spec.ReadRecent})
}
if spec.BasicAuth != nil {
if s, ok := basicAuthSecrets[fmt.Sprintf("remoteRead/%d", i)]; ok {
cfg = append(cfg, yaml.MapItem{
@ -577,6 +585,7 @@ func generateRemoteReadConfig(version semver.Version, specs []v1.RemoteReadSpec,
}
cfgs = append(cfgs, cfg)
}
return yaml.MapItem{