mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 11:48:53 +00:00
Set thanos cluster and grpc ip from pod.ip
This changes set cluster.address and grpc-address from pod.ip. It's disabled automatic pod ip detection which is not working, on node with multi network interfaces or non standart private network Signed-off-by: Calu <lucas.boisserie@gmail.com>
This commit is contained in:
parent
01676d7f4d
commit
9d42b7f8f0
1 changed files with 18 additions and 4 deletions
|
@ -588,10 +588,14 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName
|
|||
thanosTag = *p.Spec.Thanos.Tag
|
||||
}
|
||||
|
||||
thanosArgs := []string{"sidecar"}
|
||||
thanosArgs := []string{
|
||||
"sidecar",
|
||||
fmt.Sprintf("--prometheus.url=http://%s:9090", c.LocalHost),
|
||||
fmt.Sprintf("--tsdb.path=%s", storageDir),
|
||||
fmt.Sprintf("--cluster.address=$(POD_IP):%d", 10900),
|
||||
fmt.Sprintf("--grpc-address=$(POD_IP):%d", 10901),
|
||||
}
|
||||
|
||||
thanosArgs = append(thanosArgs, fmt.Sprintf("--prometheus.url=http://%s:9090", c.LocalHost))
|
||||
thanosArgs = append(thanosArgs, fmt.Sprintf("--tsdb.path=%s", storageDir))
|
||||
if p.Spec.Thanos.Peers != nil {
|
||||
thanosArgs = append(thanosArgs, fmt.Sprintf("--cluster.peers=%s", *p.Spec.Thanos.Peers))
|
||||
}
|
||||
|
@ -607,7 +611,17 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName
|
|||
},
|
||||
}
|
||||
|
||||
envVars := []v1.EnvVar{}
|
||||
envVars := []v1.EnvVar{
|
||||
{
|
||||
// Necessary for '--cluster.address', '--grpc-address' flags
|
||||
Name: "POD_IP",
|
||||
ValueFrom: &v1.EnvVarSource{
|
||||
FieldRef: &v1.ObjectFieldSelector{
|
||||
FieldPath: "status.podIP",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if p.Spec.Thanos.GCS != nil {
|
||||
if p.Spec.Thanos.GCS.Bucket != nil {
|
||||
thanosArgs = append(thanosArgs, fmt.Sprintf("--gcs.bucket=%s", *p.Spec.Thanos.GCS.Bucket))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue