mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Fix missing public IP addresses in Azure service discovery (#13241)
Fixes #5588, #9293 Signed-off-by: Gavin Lam <gavin.oss@tutamail.com>
This commit is contained in:
parent
9c4782f1cc
commit
d5924f305b
|
@ -28,6 +28,7 @@ import (
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||||
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2"
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2"
|
||||||
|
@ -638,7 +639,7 @@ func (client *azureClient) getNetworkInterfaceByID(ctx context.Context, networkI
|
||||||
return nil, fmt.Errorf("could not parse network interface ID: %w", err)
|
return nil, fmt.Errorf("could not parse network interface ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.nic.Get(ctx, r.ResourceGroupName, r.Name, nil)
|
resp, err := client.nic.Get(ctx, r.ResourceGroupName, r.Name, &armnetwork.InterfacesClientGetOptions{Expand: to.Ptr("IPConfigurations/PublicIPAddress")})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var responseError *azcore.ResponseError
|
var responseError *azcore.ResponseError
|
||||||
if errors.As(err, &responseError) && responseError.StatusCode == http.StatusNotFound {
|
if errors.As(err, &responseError) && responseError.StatusCode == http.StatusNotFound {
|
||||||
|
|
Loading…
Reference in a new issue