From 430163d01a99428731ab7ee2465f70857bb17b64 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 29 Nov 2024 14:04:07 +0100 Subject: [PATCH] app/vmagent: fixes multitenant token parse Previously, vmagent produced parsing error for 'multitenant' auth token value for the cases: * data ingestion with enableMultitentEndpoints * data scrapping at promscrape It's inconsistent to the other VictoriaMetrics components. Since 'multitenant' is well-known token value for multitenancy via labels. And vmagent is intended to be compatible with vminsert ingestion endpoints. This commit replaces NewToken with NewTokenPossibleMultitenant function for token parsing. It allows to use multitenant value for it. And it makes token values consistent for the all components. Related issue: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7694 --- app/vmagent/main.go | 2 +- docs/changelog/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/vmagent/main.go b/app/vmagent/main.go index c20b9f53f..926947e33 100644 --- a/app/vmagent/main.go +++ b/app/vmagent/main.go @@ -498,7 +498,7 @@ func processMultitenantRequest(w http.ResponseWriter, r *http.Request, path stri httpserver.Errorf(w, r, `unsupported multitenant prefix: %q; expected "insert"`, p.Prefix) return true } - at, err := auth.NewToken(p.AuthToken) + at, err := auth.NewTokenPossibleMultitenant(p.AuthToken) if err != nil { httpserver.Errorf(w, r, "cannot obtain auth token: %s", err) return true diff --git a/docs/changelog/CHANGELOG.md b/docs/changelog/CHANGELOG.md index 1ad17bd61..e2a310af3 100644 --- a/docs/changelog/CHANGELOG.md +++ b/docs/changelog/CHANGELOG.md @@ -30,6 +30,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). * FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth/): add `dryRun` flag to validate configuration. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7505) for details. * FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth/): add `removeXFFHTTPHeaderValue` flag to remove content of `X-Forwarded-For` HTTP Header before proxy it to the backend. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6883) for details. +* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent): properly parse `multitenant` token value for multitenant endpoints. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7694). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent): Properly return `200 OK` HTTP status code when importing data via [Pushgateway protocol](https://docs.victoriametrics.com/#how-to-import-data-in-prometheus-exposition-format) using [multitenant URL format](https://docs.victoriametrics.com/cluster-victoriametrics/#url-format). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3636) and [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/7571). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent): Properly set `TCP` connection timeout for `Kubernetes API server` connection for metric scrapping with `kubernetes_sd_configs`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7127). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent): fix the `resource_group` filter for Azure service discovery on virtual machine scale sets. Previously, this filter did not apply to virtual machine scale sets, causing all virtual machines to be discovered. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7630).