Skip to content

Conversation

chickenkiller
Copy link
Contributor

@chickenkiller chickenkiller commented Jul 10, 2025

This PR introduces ability to authenticate over Azure using Workload Identity workflow.
This workflow is needed for example if garm is deployed inside an AKS (Azure managed kubernetes cluster), where a User Assigned identity or a System managed identity cannot be used.


require.True(t, cfg.UseEphemeralStorage, "UseEphemeralStorage is not as expected")
require.Equal(t, "10.10.0.0/24", cfg.VirtualNetworkCIDR, "VirtualNetworkCIDR is not as expected")
require.Equal(t, "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-Network/providers/Microsoft.Network/virtualNetworks/vnet-Default/subnets/snet-default", cfg.VnetSubnetID, "VnetSubnetID is not as expected")
require.True(t, cfg.UseAcceleratedNetworking, "UseAcceleratedNetworking is not as expected")
require.True(t, cfg.DisableIsolatedNetworks, "DisableIsolatedNetworks is not as expected")
}

func TestAbsentTokenFile(t *testing.T) {
mockData := `
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's easier, you can actually use the file in the testdata folder. That config.toml serves as an example, but also as a valid test config file. You can also add more config.toml files with various settings for testing.

More details on using testdata: https://tutorialedge.net/golang/advanced-go-testing-tutorial/#use-the-testdata-directory

TenantID string `toml:"tenant_id"`
ClientID string `toml:"client_id"`
FederatedTokenFile string `toml:"federated_token_file"`
// AuthorityHost is not handled yet.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't need this now, we can just remove the commented code and add it later.

Copy link
Member

@gabriel-samfira gabriel-samfira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Thanks!

@gabriel-samfira gabriel-samfira merged commit e2fcb61 into cloudbase:main Jul 11, 2025
1 check passed
@chickenkiller chickenkiller deleted the feat/workload-identities branch July 11, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants