mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-09 02:24:16 +00:00
Merge pull request #1655 from allen13/config-reload-host
Make localhost for local pods configurable via operator flag
This commit is contained in:
commit
4a4345917e
5 changed files with 7 additions and 2 deletions
|
@ -94,6 +94,7 @@ func init() {
|
|||
flagset.Var(&cfg.CrdKinds, "crd-kinds", " - EXPERIMENTAL (could be removed in future releases) - customize CRD kind names")
|
||||
flagset.BoolVar(&cfg.EnableValidation, "with-validation", true, "Include the validation spec in the CRD")
|
||||
flagset.BoolVar(&cfg.DisableAutoUserGroup, "disable-auto-user-group", false, "Disables the Prometheus Operator setting the `runAsUser` and `fsGroup` fields in Pods.")
|
||||
flagset.StringVar(&cfg.LocalHost, "localhost", "localhost", "EXPERIMENTAL (could be removed in future releases) - Host used to communicate between local services on a pod. Fixes issues where localhost resolves incorrectly.")
|
||||
flagset.StringVar(&cfg.LogLevel, "log-level", logLevelInfo, fmt.Sprintf("Log level to use. Possible values: %s", strings.Join(availableLogLevels, ", ")))
|
||||
flagset.StringVar(&cfg.LogFormat, "log-format", logFormatLogfmt, fmt.Sprintf("Log format to use. Possible values: %s", strings.Join(availableLogFormats, ", ")))
|
||||
flagset.BoolVar(&cfg.ManageCRDs, "manage-crds", true, "Manage all CRDs with the Prometheus Operator.")
|
||||
|
|
|
@ -69,6 +69,7 @@ type Operator struct {
|
|||
|
||||
type Config struct {
|
||||
Host string
|
||||
LocalHost string
|
||||
ConfigReloaderImage string
|
||||
AlertmanagerDefaultBaseImage string
|
||||
Namespace string
|
||||
|
@ -110,6 +111,7 @@ func New(c prometheusoperator.Config, logger log.Logger) (*Operator, error) {
|
|||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "alertmanager"),
|
||||
config: Config{
|
||||
Host: c.Host,
|
||||
LocalHost: c.LocalHost,
|
||||
ConfigReloaderImage: c.ConfigReloaderImage,
|
||||
AlertmanagerDefaultBaseImage: c.AlertmanagerDefaultBaseImage,
|
||||
Namespace: c.Namespace,
|
||||
|
|
|
@ -206,7 +206,7 @@ func makeStatefulSetSpec(a *monitoringv1.Alertmanager, config Config) (*appsv1.S
|
|||
|
||||
localReloadURL := &url.URL{
|
||||
Scheme: "http",
|
||||
Host: "localhost:9093",
|
||||
Host: config.LocalHost + ":9093",
|
||||
Path: path.Clean(webRoutePrefix + "/-/reload"),
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@ type Config struct {
|
|||
CrdKinds monitoringv1.CrdKinds
|
||||
EnableValidation bool
|
||||
DisableAutoUserGroup bool
|
||||
LocalHost string
|
||||
LogLevel string
|
||||
LogFormat string
|
||||
ManageCRDs bool
|
||||
|
|
|
@ -398,7 +398,7 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName
|
|||
|
||||
localReloadURL := &url.URL{
|
||||
Scheme: "http",
|
||||
Host: "localhost:9090",
|
||||
Host: c.LocalHost + ":9090",
|
||||
Path: path.Clean(webRoutePrefix + "/-/reload"),
|
||||
}
|
||||
|
||||
|
@ -603,6 +603,7 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName
|
|||
|
||||
thanosArgs := []string{"sidecar"}
|
||||
|
||||
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))
|
||||
|
|
Loading…
Add table
Reference in a new issue