1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 03:38:43 +00:00

add ability to configure tls for endpoints

This commit is contained in:
Frederic Branczyk 2016-12-15 22:25:17 -08:00 committed by Fabian Reinartz
parent 9001d9e780
commit 033f724b09
2 changed files with 24 additions and 5 deletions
pkg
client/monitoring/v1alpha1
prometheus

View file

@ -115,11 +115,18 @@ type ServiceMonitorSpec struct {
// Endpoint defines a scrapeable endpoint serving Prometheus metrics.
type Endpoint struct {
Port string `json:"port"`
TargetPort intstr.IntOrString `json:"targetPort"`
Path string `json:"path"`
Scheme string `json:"scheme"`
Interval string `json:"interval"`
Port string `json:"port"`
TargetPort intstr.IntOrString `json:"targetPort"`
Path string `json:"path"`
Scheme string `json:"scheme"`
Interval string `json:"interval"`
TlsConfig *TlsConfig `json:"tlsConfig"`
BearerTokenFile string `json:"bearerTokenFile"`
}
type TlsConfig struct {
CaFile string `json:"caFile,omitempty"`
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
}
// ServiceMonitorList is a list of ServiceMonitors.

View file

@ -81,6 +81,18 @@ func generateServiceMonitorConfig(m *v1alpha1.ServiceMonitor, ep v1alpha1.Endpoi
if ep.Scheme != "" {
cfg["scheme"] = ep.Scheme
}
if ep.TlsConfig != nil {
tlsConfig := map[string]interface{}{
"insecure_skip_verify": ep.TlsConfig.InsecureSkipVerify,
}
if ep.TlsConfig.CaFile != "" {
tlsConfig["ca_file"] = ep.TlsConfig.CaFile
}
cfg["tls_config"] = tlsConfig
}
if ep.BearerTokenFile != "" {
cfg["bearer_token_file"] = ep.BearerTokenFile
}
var relabelings []interface{}