diff --git a/app/vmauth/README.md b/app/vmauth/README.md index 4fe69778c6..eef0d4ba16 100644 --- a/app/vmauth/README.md +++ b/app/vmauth/README.md @@ -17,7 +17,7 @@ and pass the following flag to `vmauth` binary in order to start authorizing and After that `vmauth` starts accepting HTTP requests on port `8427` and routing them according to the provided [-auth.config](#auth-config). The port can be modified via `-httpListenAddr` command-line flag. -The auth config can be reloaded by passing `SIGHUP` signal to `vmauth`. +The auth config can be reloaded either by passing `SIGHUP` signal to `vmauth` or by querying `/-/reload` http endpoint. Docker images for `vmauth` are available [here](https://hub.docker.com/r/victoriametrics/vmauth/tags). diff --git a/app/vmauth/main.go b/app/vmauth/main.go index 5979577aab..2d3b5e15fb 100644 --- a/app/vmauth/main.go +++ b/app/vmauth/main.go @@ -14,6 +14,7 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/httpserver" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" "github.com/VictoriaMetrics/VictoriaMetrics/lib/procutil" + "github.com/VictoriaMetrics/metrics" ) var ( @@ -48,6 +49,13 @@ func main() { } func requestHandler(w http.ResponseWriter, r *http.Request) bool { + switch r.URL.Path { + case "/-/reload": + configReloadRequests.Inc() + procutil.SelfSIGHUP() + w.WriteHeader(http.StatusOK) + return true + } authToken := r.Header.Get("Authorization") if authToken == "" { w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`) @@ -71,6 +79,8 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { return true } +var configReloadRequests = metrics.NewCounter(`vmagent_http_requests_total{path="/-/reload"}`) + var reverseProxy = &httputil.ReverseProxy{ Director: func(r *http.Request) { targetURL := r.Header.Get("vm-target-url") diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index dbfde70c94..16c539cb16 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,6 +12,7 @@ sort: 15 * FEATURE: vmselect: allow to use 2x more memory for query processing at `vmselect` nodes in [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). This should allow processing heavy queries without the need to increase RAM size at `vmselect` nodes. * FEATURE: add ability to filter `/api/v1/status/tsdb` output with arbitrary [time series selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors) passed via `match[]` query args. See [these docs](https://docs.victoriametrics.com/#tsdb-stats) and [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1168) for details. * FEATURE: automatically detect memory and cpu limits for VictoriaMetrics components running under [cgroup v2](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html) environments such as [HashiCorp Nomad](https://www.nomadproject.io/). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1269). +* FEATURE: vmauth: allow `-auth.config` reloading via `/-/reload` http endpoint. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1194). * BUGFIX: vmagent: do not retry scraping targets, which don't support HTTP. This should reduce CPU load and network usage at `vmagent` and at scrape target. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1289). * BUGFIX: vmagent: fix possible race when refreshing `role: endpoints` and `role: endpointslices` scrape targets in `kubernetes_sd_config`. Prevoiusly `pod` objects could be updated after the related `endpoints` object update. This could lead to missing scrape targets. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1240). diff --git a/docs/vmauth.md b/docs/vmauth.md index cd0231c3c3..28d782609a 100644 --- a/docs/vmauth.md +++ b/docs/vmauth.md @@ -21,7 +21,7 @@ and pass the following flag to `vmauth` binary in order to start authorizing and After that `vmauth` starts accepting HTTP requests on port `8427` and routing them according to the provided [-auth.config](#auth-config). The port can be modified via `-httpListenAddr` command-line flag. -The auth config can be reloaded by passing `SIGHUP` signal to `vmauth`. +The auth config can be reloaded either by passing `SIGHUP` signal to `vmauth` or by querying `/-/reload` http endpoint. Docker images for `vmauth` are available [here](https://hub.docker.com/r/victoriametrics/vmauth/tags).