Skip to content

Commit 978b35e

Browse files
Merge pull request openshift#7076 from jhixson74/master_azure_ocpbugs_8449
OCPBUGS-8449: Azure: don't set default subscriptionID for disk encryption sets
2 parents 8f1179e + b77d2e3 commit 978b35e

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

pkg/asset/machines/master.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@ func (m *Master) Generate(dependencies asset.Parents) error {
351351
return errors.Wrap(err, "failed to fetch session")
352352
}
353353

354-
// Default to current subscription if one was not specified
355-
if mpool.OSDisk.DiskEncryptionSet != nil && mpool.OSDisk.DiskEncryptionSet.SubscriptionID == "" {
356-
mpool.OSDisk.DiskEncryptionSet.SubscriptionID = session.Credentials.SubscriptionID
357-
}
358-
359354
client := icazure.NewClient(session)
360355
if len(mpool.Zones) == 0 {
361356
azs, err := client.GetAvailabilityZones(context.TODO(), ic.Platform.Azure.Region, mpool.InstanceType)

pkg/asset/machines/worker.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,6 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
436436
return errors.Wrap(err, "failed to fetch session")
437437
}
438438

439-
// Default to current subscription if one was not specified
440-
if mpool.OSDisk.DiskEncryptionSet != nil && mpool.OSDisk.DiskEncryptionSet.SubscriptionID == "" {
441-
mpool.OSDisk.DiskEncryptionSet.SubscriptionID = session.Credentials.SubscriptionID
442-
}
443-
444439
client := icazure.NewClient(session)
445440
if len(mpool.Zones) == 0 {
446441
azs, err := client.GetAvailabilityZones(context.TODO(), ic.Platform.Azure.Region, mpool.InstanceType)

pkg/types/azure/validation/disk.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ func ValidateDiskEncryption(p *azure.MachinePool, cloudName azure.CloudEnvironme
3131
if diskEncryptionSet != nil && cloudName == azure.StackCloud {
3232
return append(allErrs, field.Invalid(childFldPath.Child("diskEncryptionSet"), diskEncryptionSet, "disk encryption sets are not supported on this platform"))
3333
}
34-
if diskEncryptionSet.SubscriptionID != "" && !RxSubscriptionID.MatchString(diskEncryptionSet.SubscriptionID) {
34+
if diskEncryptionSet.SubscriptionID == "" {
35+
return append(allErrs, field.Required(childFldPath.Child("subscriptionID"), "subscription ID is required"))
36+
}
37+
if !RxSubscriptionID.MatchString(diskEncryptionSet.SubscriptionID) {
3538
return append(allErrs, field.Invalid(childFldPath.Child("subscriptionID"), diskEncryptionSet.SubscriptionID, "invalid subscription ID format"))
3639
}
3740
if !RxResourceGroup.MatchString(diskEncryptionSet.ResourceGroup) {

0 commit comments

Comments
 (0)