mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/discovery/azure: fix host check in next link in Azure SD (#6915)
Previous bugfix at 49f63b2
only partially fixed pagination host validation error.
Before this fix it was:
```
unexpected nextLink host \"management.azure.com\", expecting \"https://management.azure.com\"
```
Now we only check the `Host` without schema.
However, when Azure respond `nextLink` in `Host:Port` format, the
`nextLink` check will fail:
```
unexpected nextLink host \"management.azure.com:443\", expecting \"management.azure.com\"
```
This pull request further relaxes the checks by only checking the
`Hostname`.
---
related issue: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6912
This commit is contained in:
parent
39294b4919
commit
c193e6d43e
4 changed files with 7 additions and 4 deletions
|
@ -23,6 +23,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/).
|
||||||
* FEATURE [stream aggregation](https://docs.victoriametrics.com/stream-aggregation/): perform deduplication for all received data when specifying `-streamAggr.dedupInterval` or `-remoteWrite.streamAggr.dedupInterval` command-line flags are set. Previously, if the `-remoteWrite.streamAggr.config` or `-streamAggr.config` is set, only series that matched aggregation config were deduplicated. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6711#issuecomment-2288361213) for details.
|
* FEATURE [stream aggregation](https://docs.victoriametrics.com/stream-aggregation/): perform deduplication for all received data when specifying `-streamAggr.dedupInterval` or `-remoteWrite.streamAggr.dedupInterval` command-line flags are set. Previously, if the `-remoteWrite.streamAggr.config` or `-streamAggr.config` is set, only series that matched aggregation config were deduplicated. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6711#issuecomment-2288361213) for details.
|
||||||
* FEATURE: all VictoriaMetrics [enterprise](https://docs.victoriametrics.com/enterprise/) components: add support of hot-reload for license key supplied by `-licenseFile` command-line flag.
|
* FEATURE: all VictoriaMetrics [enterprise](https://docs.victoriametrics.com/enterprise/) components: add support of hot-reload for license key supplied by `-licenseFile` command-line flag.
|
||||||
|
|
||||||
|
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent/) fix service discovery of Azure Virtual Machines for response contains `nextLink` in `Host:Port` format. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6912).
|
||||||
* BUGFIX: [vmagent dashboard](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/dashboards/vmagent.json): fix legend captions for stream aggregation related panels. Before they were displaying wrong label names.
|
* BUGFIX: [vmagent dashboard](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/dashboards/vmagent.json): fix legend captions for stream aggregation related panels. Before they were displaying wrong label names.
|
||||||
* BUGFIX: [vmgateway](https://docs.victoriametrics.com/vmgateway/): add missing `datadog`, `newrelic`, `opentelemetry` and `pushgateway` routes to the `JWT` authorization routes. Allows prefixed (`promtheus/graphite`) routes for query requests.
|
* BUGFIX: [vmgateway](https://docs.victoriametrics.com/vmgateway/): add missing `datadog`, `newrelic`, `opentelemetry` and `pushgateway` routes to the `JWT` authorization routes. Allows prefixed (`promtheus/graphite`) routes for query requests.
|
||||||
* BUGFIX: [Single-node VictoriaMetrics](https://docs.victoriametrics.com/) and `vmstorage` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/): fix metric `vm_object_references{type="indexdb"}`. Previously, it was overcounted.
|
* BUGFIX: [Single-node VictoriaMetrics](https://docs.victoriametrics.com/) and `vmstorage` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/): fix metric `vm_object_references{type="indexdb"}`. Previously, it was overcounted.
|
||||||
|
|
|
@ -122,7 +122,7 @@ func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) {
|
||||||
|
|
||||||
cfg := &apiConfig{
|
cfg := &apiConfig{
|
||||||
c: c,
|
c: c,
|
||||||
apiServerHost: u.Host,
|
apiServerHost: u.Hostname(),
|
||||||
port: port,
|
port: port,
|
||||||
resourceGroup: sdc.ResourceGroup,
|
resourceGroup: sdc.ResourceGroup,
|
||||||
subscriptionID: sdc.SubscriptionID,
|
subscriptionID: sdc.SubscriptionID,
|
||||||
|
|
|
@ -96,8 +96,10 @@ func visitAllAPIObjects(ac *apiConfig, apiURL string, cb func(data json.RawMessa
|
||||||
return fmt.Errorf("cannot parse nextLink from response %q: %w", lar.NextLink, err)
|
return fmt.Errorf("cannot parse nextLink from response %q: %w", lar.NextLink, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if nextURL.Host != "" && nextURL.Host != ac.apiServerHost {
|
// Sometimes Azure will respond a host with a port. Since all possible apiServer defined in cloudEnvironments do not include a port,
|
||||||
return fmt.Errorf("unexpected nextLink host %q, expecting %q", nextURL.Host, ac.apiServerHost)
|
// it is best to check the host without the port. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6912
|
||||||
|
if nextURL.Host != "" && nextURL.Hostname() != ac.apiServerHost {
|
||||||
|
return fmt.Errorf("unexpected nextLink host %q, expecting %q", nextURL.Hostname(), ac.apiServerHost)
|
||||||
}
|
}
|
||||||
|
|
||||||
nextLinkURI = nextURL.RequestURI()
|
nextLinkURI = nextURL.RequestURI()
|
||||||
|
|
|
@ -91,7 +91,7 @@ func TestGetVirtualMachinesSuccess(t *testing.T) {
|
||||||
defer c.Stop()
|
defer c.Stop()
|
||||||
ac := &apiConfig{
|
ac := &apiConfig{
|
||||||
c: c,
|
c: c,
|
||||||
apiServerHost: u.Host,
|
apiServerHost: u.Hostname(),
|
||||||
subscriptionID: "some-id",
|
subscriptionID: "some-id",
|
||||||
refreshToken: func() (string, time.Duration, error) {
|
refreshToken: func() (string, time.Duration, error) {
|
||||||
return "auth-token", 0, nil
|
return "auth-token", 0, nil
|
||||||
|
|
Loading…
Reference in a new issue