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

revert config reloader back to lifecycle api

This commit is contained in:
Zack Brenton 2017-08-22 10:10:28 -03:00
parent 39bfd60a22
commit f6d1f27e68
2 changed files with 13 additions and 13 deletions
contrib/prometheus-config-reloader
pkg/prometheus

View file

@ -20,12 +20,10 @@ import (
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"
"strings"
"strconv"
"syscall"
"time"
fsnotify "gopkg.in/fsnotify.v1"
@ -187,21 +185,17 @@ func (w *volumeWatcher) writeConfigMapFile(filename, content string) error {
}
func (w *volumeWatcher) ReloadPrometheus() error {
cmd := exec.Command("/bin/sh", "-c", "ps cax | grep '/bin/prometheus ' | grep -v grep | grep -o '^[ ]*[0-9]*'")
res, err := cmd.Output()
req, err := http.NewRequest("POST", w.cfg.reloadUrl, nil)
if err != nil {
return err
}
pid, err := strconv.Atoi(strings.TrimSpace(string(res)))
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
err = syscall.Kill(pid, syscall.SIGHUP)
if err != nil {
w.logger.Log("msg", "Error sending SIGHUP to process", "err", err, "pid", pid)
return err
resp.Body.Close()
if resp.StatusCode != 200 {
return fmt.Errorf("Received response code %s, expected 200", resp.StatusCode)
}
return nil
}

View file

@ -327,6 +327,13 @@ func makeStatefulSetSpec(p v1alpha1.Prometheus, c *Config, ruleConfigMaps []*v1.
"-storage.tsdb.path=/var/prometheus/data",
"-storage.tsdb.retention="+p.Spec.Retention,
)
if len(version.Pre) > 0 && version.Pre[0].VersionStr == "alpha" {
break
}
promArgs = append(promArgs,
"-web.enable-lifecycle",
)
default:
return nil, errors.Errorf("unsupported Prometheus major version %s", version)
}
@ -485,7 +492,6 @@ func makeStatefulSetSpec(p v1alpha1.Prometheus, c *Config, ruleConfigMaps []*v1.
},
},
},
HostPID: true,
ServiceAccountName: p.Spec.ServiceAccountName,
NodeSelector: p.Spec.NodeSelector,
TerminationGracePeriodSeconds: &terminationGracePeriod,