Skip to content

Commit

Permalink
Adding manageddiskparameters to support DES encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny Woodson committed Sep 1, 2020
1 parent 29efd36 commit 2c4f1bd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 13 deletions.
16 changes: 11 additions & 5 deletions pkg/apis/azureprovider/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,17 @@ type Image struct {
type VMIdentity string

type OSDisk struct {
OSType string `json:"osType"`
ManagedDisk ManagedDisk `json:"managedDisk"`
DiskSizeGB int32 `json:"diskSizeGB"`
OSType string `json:"osType"`
ManagedDisk ManagedDiskParameters `json:"managedDisk"`
DiskSizeGB int32 `json:"diskSizeGB"`
}

type ManagedDisk struct {
StorageAccountType string `json:"storageAccountType"`
type ManagedDiskParameters struct {
StorageAccountType string `json:"storageAccountType"`
DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"`
ID string `json:"id,omitempty"`
}

type DiskEncryptionSetParameters struct {
ID string `json:"id,omitempty"`
}
35 changes: 28 additions & 7 deletions pkg/apis/azureprovider/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/cloud/azure/actuators/machine/stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func stubProviderConfig() *providerspecv1.AzureMachineProviderSpec {
Location: "eastus2",
VMSize: "Standard_B2ms",
Image: providerspecv1.Image{ResourceID: "/resourceGroups/os4-common/providers/Microsoft.Compute/images/test1-controlplane-0-image-20190529150403"},
OSDisk: providerspecv1.OSDisk{OSType: "Linux", ManagedDisk: providerspecv1.ManagedDisk{StorageAccountType: "Premium_LRS"}, DiskSizeGB: 60},
OSDisk: providerspecv1.OSDisk{OSType: "Linux", ManagedDisk: providerspecv1.ManagedDiskParameters{StorageAccountType: "Premium_LRS"}, DiskSizeGB: 60},
SSHPublicKey: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDNEd4SGQ1L0pLZVJYMGZOMCt4YzM1eXhLdmtvb0Qwb0l2RnNCdDNHNTNaSXZlTWxwNUppQTRWT0Y3YjJ4cHZmL1FHbVpmWWl4d1JYMHdUKzRWUzYxV1ZNeUdZRUhPcE9QYy85MWZTcTg4bTJZbitBYVhTUUxTbFpaVkZJTDZsK296bjlRQ3NaSXhqSlpkTW5BTlRQdlhWMWpjSVNJeDhmU0pKeWVEdlhFU2FEQ2N1VjdPZTdvd01lVVpseCtUUEhkcU85eEV1OXFuREVYUXo1SUVQQUMwTElSQnVicmJVaTRQZUJFUlFieVBQd1p0Um9NN2pFZ3RuRFhDcmxYbXo2T0N3NXNiaE1FNEJCUVliVjBOV0J3Unl2bHJReDJtYzZHNnJjODJ6OWxJMkRKQ3ZJcnNkRW43NytQZThiWm1MVU83V0sxRUFyd2xXY0FiZU1kYUFkbzcgamNoYWxvdXBAZGhjcC0yNC0xNzAuYnJxLnJlZGhhdC5jb20K",
PublicIP: false,
Subnet: "stub-machine-subnet",
Expand Down
4 changes: 4 additions & 0 deletions pkg/cloud/azure/services/virtualmachines/virtualmachines.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func (s *Service) CreateOrUpdate(ctx context.Context, spec azure.Spec) error {
}
}

if vmSpec.OSDisk.ManagedDisk.DiskEncryptionSet != nil {
virtualMachine.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet = &compute.DiskEncryptionSetParameters{ID: to.StringPtr(vmSpec.OSDisk.ManagedDisk.DiskEncryptionSet.ID)}
}

if vmSpec.Zone != "" {
zones := []string{vmSpec.Zone}
virtualMachine.Zones = &zones
Expand Down

0 comments on commit 2c4f1bd

Please sign in to comment.