Skip to content

Commit d36e68b

Browse files
committed
use managed identity for API version upgrade e2e tests
1 parent f50924d commit d36e68b

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

templates/test/ci/cluster-template-prow.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/test/ci/prow/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ patches:
4747
- path: ../patches/windows-server-version.yaml
4848
- path: ../patches/cluster-label-calico.yaml
4949
- path: ../patches/cluster-label-cloud-provider-azure.yaml
50+
- path: ../patches/uami-md-0.yaml
5051
configMapGenerator:
5152
- files:
5253
- windows-cni=../../../addons/windows/calico/calico.yaml

test/e2e/capi_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
"os"
2626
"time"
2727

28+
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
29+
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
2830
. "github.com/onsi/ginkgo/v2"
2931
. "github.com/onsi/gomega"
3032
"k8s.io/utils/ptr"
@@ -187,6 +189,16 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
187189

188190
// Unset windows specific variables
189191
Expect(os.Unsetenv("WINDOWS_WORKER_MACHINE_COUNT")).To(Succeed())
192+
193+
cred, err := azidentity.NewDefaultAzureCredential(nil)
194+
Expect(err).NotTo(HaveOccurred())
195+
identityClient, err := armmsi.NewUserAssignedIdentitiesClient(getSubscriptionID(Default), cred, nil)
196+
Expect(err).NotTo(HaveOccurred())
197+
identityRG := e2eConfig.GetVariable(AzureIdentityResourceGroup)
198+
identityName := e2eConfig.GetVariable(AzureUserIdentity)
199+
identity, err := identityClient.Get(ctx, identityRG, identityName, nil)
200+
Expect(err).NotTo(HaveOccurred())
201+
os.Setenv("AZURE_CLIENT_ID_CLOUD_PROVIDER", *identity.Properties.ClientID)
190202
})
191203

192204
Context("upgrade from an old version of v1beta1 to current, and scale workload clusters created in the old version", func() {

test/e2e/config/azure-dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ variables:
230230
LATEST_PROVIDER_UPGRADE_VERSION: "v1.15.1"
231231
OLD_CAAPH_UPGRADE_VERSION: "v0.1.0-alpha.10"
232232
LATEST_CAAPH_UPGRADE_VERSION: "v0.1.1-alpha.1"
233+
CI_RG: capz-ci
234+
USER_IDENTITY: cloud-provider-user-identity
233235

234236
intervals:
235237
default/wait-controllers: ["3m", "10s"]

test/e2e/data/infrastructure-azure/v1.14.5/cluster-template-prow.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/data/infrastructure-azure/v1.15.1/cluster-template-prow.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)