Skip to content
Permalink
Browse files

Merge pull request #86351 from andyzhangx/byok-osdisk-default

fix: azure data disk should use same key as os disk by default
  • Loading branch information
k8s-ci-robot committed Dec 18, 2019
2 parents c0ff789 + 6e789e9 commit ac4079a5cc22ced66c868f6fd26f8e2497765e51
@@ -46,6 +46,15 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri

if isManagedDisk {
managedDisk := &compute.ManagedDiskParameters{ID: &diskURI}
if diskEncryptionSetID == "" {
if vm.StorageProfile.OsDisk != nil &&
vm.StorageProfile.OsDisk.ManagedDisk != nil &&
vm.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet != nil &&
vm.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet.ID != nil {
// set diskEncryptionSet as value of os disk by default
diskEncryptionSetID = *vm.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet.ID
}
}
if diskEncryptionSetID != "" {
managedDisk.DiskEncryptionSet = &compute.DiskEncryptionSetParameters{ID: &diskEncryptionSetID}
}
@@ -48,6 +48,15 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
}
if isManagedDisk {
managedDisk := &compute.ManagedDiskParameters{ID: &diskURI}
if diskEncryptionSetID == "" {
if vm.StorageProfile.OsDisk != nil &&
vm.StorageProfile.OsDisk.ManagedDisk != nil &&
vm.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet != nil &&
vm.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet.ID != nil {
// set diskEncryptionSet as value of os disk by default
diskEncryptionSetID = *vm.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet.ID
}
}
if diskEncryptionSetID != "" {
managedDisk.DiskEncryptionSet = &compute.DiskEncryptionSetParameters{ID: &diskEncryptionSetID}
}

0 comments on commit ac4079a

Please sign in to comment.
You can’t perform that action at this time.