Skip to content

Commit

Permalink
add cluster fqdn to telemetry exported
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Castilio dos Santos <[email protected]>
  • Loading branch information
alexcastilio committed Nov 20, 2024
1 parent ac893fc commit effbc1d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/e2e/framework/azure/get-fqdn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package azure

import (
"context"
"fmt"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
armcontainerservice "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4"
)

func GetFqdnFn(subscriptionId, resourceGroupName, clusterName string) (string, error) {
cred, err := azidentity.NewAzureCLICredential(nil)
if err != nil {
return "", fmt.Errorf("failed to obtain a credential: %w", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory(subscriptionId, cred, nil)
if err != nil {
return "", fmt.Errorf("failed to create client: %w", err)
}
res, err := clientFactory.NewManagedClustersClient().Get(ctx, resourceGroupName, clusterName, nil)
if err != nil {
return "", fmt.Errorf("failed to finish the get managed cluster client request: %w", err)
}

return *res.Properties.Fqdn, nil
}
5 changes: 5 additions & 0 deletions test/e2e/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"testing"

"github.com/microsoft/retina/test/e2e/common"
"github.com/microsoft/retina/test/e2e/framework/azure"
"github.com/microsoft/retina/test/e2e/framework/generic"
"github.com/microsoft/retina/test/e2e/framework/helpers"
"github.com/microsoft/retina/test/e2e/framework/types"
Expand Down Expand Up @@ -98,6 +99,10 @@ func TestE2ERetina_Scale(t *testing.T) {
}
})

fqdn, err := azure.GetFqdnFn(subID, rg, clusterName)
require.NoError(t, err)
opt.AdditionalTelemetryProperty["clusterFqdn"] = fqdn

// Install Retina
installRetina := types.NewRunner(t, jobs.InstallRetina(kubeConfigFilePath, chartPath))
installRetina.Run(ctx)
Expand Down

0 comments on commit effbc1d

Please sign in to comment.