@@ -82,7 +82,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
8282 Expect (err ).NotTo (HaveOccurred ())
8383 clusterResources = new (clusterctl.ApplyClusterTemplateAndWaitResult )
8484
85- identityName := input .E2EConfig .GetVariable (ClusterIdentityName )
85+ identityName := input .E2EConfig .GetVariableOrEmpty (ClusterIdentityName )
8686 Expect (os .Setenv (ClusterIdentityName , identityName )).To (Succeed ())
8787 Expect (os .Setenv (ClusterIdentityNamespace , namespace .Name )).To (Succeed ())
8888 })
@@ -151,22 +151,22 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
151151 err := selfHostedClusterProxy .GetClient ().Delete (ctx , & infrav1.AzureClusterIdentity {
152152 ObjectMeta : metav1.ObjectMeta {
153153 Namespace : cluster .Namespace ,
154- Name : e2eConfig .GetVariable (ClusterIdentityName ),
154+ Name : e2eConfig .GetVariableOrEmpty (ClusterIdentityName ),
155155 },
156156 })
157157 Expect (err ).NotTo (HaveOccurred ())
158158 cred , err := azidentity .NewDefaultAzureCredential (nil )
159159 Expect (err ).NotTo (HaveOccurred ())
160160 identityClient , err := armmsi .NewUserAssignedIdentitiesClient (getSubscriptionID (Default ), cred , nil )
161161 Expect (err ).NotTo (HaveOccurred ())
162- identityRG := e2eConfig .GetVariable (AzureIdentityResourceGroup )
163- identityName := e2eConfig .GetVariable (AzureUserIdentity )
162+ identityRG := e2eConfig .GetVariableOrEmpty (AzureIdentityResourceGroup )
163+ identityName := e2eConfig .GetVariableOrEmpty (AzureUserIdentity )
164164 identity , err := identityClient .Get (ctx , identityRG , identityName , nil )
165165 Expect (err ).NotTo (HaveOccurred ())
166166 err = selfHostedClusterProxy .GetClient ().Create (ctx , & infrav1.AzureClusterIdentity {
167167 ObjectMeta : metav1.ObjectMeta {
168168 Namespace : cluster .Namespace ,
169- Name : e2eConfig .GetVariable (ClusterIdentityName ),
169+ Name : e2eConfig .GetVariableOrEmpty (ClusterIdentityName ),
170170 Labels : map [string ]string {
171171 clusterctlv1 .ClusterctlMoveHierarchyLabel : "true" ,
172172 },
@@ -175,7 +175,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
175175 AllowedNamespaces : & infrav1.AllowedNamespaces {},
176176 ClientID : * identity .Properties .ClientID ,
177177 ResourceID : * identity .ID ,
178- TenantID : e2eConfig .GetVariable (AzureTenantID ),
178+ TenantID : e2eConfig .GetVariableOrEmpty (AzureTenantID ),
179179 Type : infrav1 .UserAssignedMSI ,
180180 },
181181 })
@@ -237,22 +237,22 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
237237 err := input .BootstrapClusterProxy .GetClient ().Delete (ctx , & infrav1.AzureClusterIdentity {
238238 ObjectMeta : metav1.ObjectMeta {
239239 Namespace : namespace .Name ,
240- Name : e2eConfig .GetVariable (ClusterIdentityName ),
240+ Name : e2eConfig .GetVariableOrEmpty (ClusterIdentityName ),
241241 },
242242 })
243243 Expect (err ).NotTo (HaveOccurred ())
244244 err = input .BootstrapClusterProxy .GetClient ().Create (ctx , & infrav1.AzureClusterIdentity {
245245 ObjectMeta : metav1.ObjectMeta {
246246 Namespace : namespace .Name ,
247- Name : e2eConfig .GetVariable (ClusterIdentityName ),
247+ Name : e2eConfig .GetVariableOrEmpty (ClusterIdentityName ),
248248 Labels : map [string ]string {
249249 clusterctlv1 .ClusterctlMoveHierarchyLabel : "true" ,
250250 },
251251 },
252252 Spec : infrav1.AzureClusterIdentitySpec {
253253 AllowedNamespaces : & infrav1.AllowedNamespaces {},
254- ClientID : e2eConfig .GetVariable (AzureClientIDUserAssignedIdentity ),
255- TenantID : e2eConfig .GetVariable (AzureTenantID ),
254+ ClientID : e2eConfig .GetVariableOrEmpty (AzureClientIDUserAssignedIdentity ),
255+ TenantID : e2eConfig .GetVariableOrEmpty (AzureTenantID ),
256256 Type : infrav1 .WorkloadIdentity ,
257257 },
258258 })
0 commit comments