Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty LoadBalancer FrontendIPConfiguration for Private and Public Addresses #23578

Open
dnaeon opened this issue Oct 14, 2024 · 2 comments
Open
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@dnaeon
Copy link

dnaeon commented Oct 14, 2024

Bug Report

Trying to get the FrontendIPConfiguration for Load Balancers returns empty results for private and public IP addresses.

Sample Go code to reproduce the issue.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)

func printErr(err error) {
	fmt.Println(err)
	os.Exit(1)
}

func main() {
	clientID := "my-app-uuid"      
	tenantID := "my-tenant-uuid"  
	subscriptionID := "my-subscription-uuid"
	resourceGroup := "my-resource-group-name"

	tokenFile := "kube-token.txt"
	opts := &azidentity.WorkloadIdentityCredentialOptions{
		AdditionallyAllowedTenants: []string{},
		ClientID:                   clientID,
		TenantID:                   tenantID,
		TokenFilePath:              tokenFile,
	}

	creds, err := azidentity.NewWorkloadIdentityCredential(opts)
	if err != nil {
		printErr(err)
	}

	ctx := context.Background()
	printLoadBalancers(ctx, creds, subscriptionID, resourceGroup)
}

func printLoadBalancers(ctx context.Context, creds azcore.TokenCredential, subscriptionID string, resourceGroup string) {
	factory, err := armnetwork.NewClientFactory(subscriptionID, creds, &arm.ClientOptions{})
	if err != nil {
		printErr(err)
	}

	client := factory.NewLoadBalancersClient()
	pager := client.NewListPager(resourceGroup, &armnetwork.LoadBalancersClientListOptions{})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			printErr(err)
		}

		for _, item := range page.Value {
			fmt.Printf("ID: %s\n", *item.ID)
			fmt.Printf("\tLocation: %s\n", *item.Location)
			fmt.Printf("\tName: %s\n", *item.Name)
			fmt.Printf("\tEtag: %s\n", *item.Etag)
			fmt.Printf("\tType: %s\n", *item.Type)
			fmt.Printf("\tSKU Name: %s\n", *item.SKU.Name)
			fmt.Printf("\tSKU Tier: %s\n\n", *item.SKU.Tier)

			for _, frontend := range item.Properties.FrontendIPConfigurations {
				if frontend.Properties != nil {
					fmt.Printf("\t\tName: %s\n", *frontend.Name)
					fmt.Printf("\t\tPrivate IP: %v\n", frontend.Properties.PrivateIPAddress)
					fmt.Printf("\t\tPublic IP: %v\n", frontend.Properties.PublicIPAddress.Properties)
				}
			}
		}
	}
}

Running this code gives results like this where the PrivateIP and PublicIP are nil.

...
...

                Name: name-1
                Private IP: <nil>
                Public IP: <nil>
                Name: name-2
                Private IP: <nil>
                Public IP: <nil>
                Name: name-3
                Private IP: <nil>
                Public IP: <nil>
                Name: name-4
                Private IP: <nil>
                Public IP: <nil>

I get the same empty results even when using armnetwork.LoadBalancerFrontendIPConfigurationsClient and querying a specific Load Balancer in order to get its FrontendIPConfiguration.

Thanks,
Marin

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 14, 2024
@lirenhe lirenhe added the Mgmt This issue is related to a management-plane library. label Oct 15, 2024
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 15, 2024
@lirenhe
Copy link
Member

lirenhe commented Oct 15, 2024

@dnaeon, have you tried to call the REST API directly to list all the load balancer and check the result?
I am trying to understand whether this is a service side issue or client SDK issue. thanks

@dnaeon
Copy link
Author

dnaeon commented Oct 15, 2024

Hey @lirenhe ,

Using az network lb list returns the LBs with correct info. I haven't tried calling the REST API directly. This one appears to be an issue with the Go SDK.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants