From e7bd4cae84ce4b3f6d4953a2d883e42e72e2e14a Mon Sep 17 00:00:00 2001 From: Gaoyun Date: Fri, 16 Jan 2026 00:42:21 +0000 Subject: [PATCH] Check whether the user has explicitly configured bootDiagnostics in the mpool's bootDiagnostics field. If not configured, the Azure Stack Hub default is applied --- pkg/asset/machines/azure/azuremachines.go | 30 ++++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/pkg/asset/machines/azure/azuremachines.go b/pkg/asset/machines/azure/azuremachines.go index e9fb2e0403..36249b252f 100644 --- a/pkg/asset/machines/azure/azuremachines.go +++ b/pkg/asset/machines/azure/azuremachines.go @@ -204,13 +204,16 @@ func GenerateMachines(clusterID, resourceGroup, subscriptionID string, session * } if in.Platform.CloudName == aztypes.StackCloud { - azureMachine.Spec.Diagnostics = &capz.Diagnostics{ - Boot: &capz.BootDiagnostics{ - StorageAccountType: capz.UserManagedDiagnosticsStorage, - UserManaged: &capz.UserManagedBootDiagnostics{ - StorageAccountURI: fmt.Sprintf("https://%s.blob.%s", storageAccountName, in.StorageSuffix), + // For Azure Stack Cloud, apply default diagnostics only if user hasn't specified bootDiagnostics + if mpool.BootDiagnostics == nil { + azureMachine.Spec.Diagnostics = &capz.Diagnostics{ + Boot: &capz.BootDiagnostics{ + StorageAccountType: capz.UserManagedDiagnosticsStorage, + UserManaged: &capz.UserManagedBootDiagnostics{ + StorageAccountURI: fmt.Sprintf("https://%s.blob.%s", storageAccountName, in.StorageSuffix), + }, }, - }, + } } } @@ -278,13 +281,16 @@ func GenerateMachines(clusterID, resourceGroup, subscriptionID string, session * } if in.Platform.CloudName == aztypes.StackCloud { - bootstrapAzureMachine.Spec.Diagnostics = &capz.Diagnostics{ - Boot: &capz.BootDiagnostics{ - StorageAccountType: capz.UserManagedDiagnosticsStorage, - UserManaged: &capz.UserManagedBootDiagnostics{ - StorageAccountURI: fmt.Sprintf("https://%s.blob.%s", storageAccountName, in.StorageSuffix), + // For Azure Stack Cloud, apply default diagnostics only if user hasn't specified bootDiagnostics + if mpool.BootDiagnostics == nil { + bootstrapAzureMachine.Spec.Diagnostics = &capz.Diagnostics{ + Boot: &capz.BootDiagnostics{ + StorageAccountType: capz.UserManagedDiagnosticsStorage, + UserManaged: &capz.UserManagedBootDiagnostics{ + StorageAccountURI: fmt.Sprintf("https://%s.blob.%s", storageAccountName, in.StorageSuffix), + }, }, - }, + } } }