Skip to content

Commit

Permalink
Feature/vm gallery applications (#65)
Browse files Browse the repository at this point in the history
* Upgrade to azure native sdk v2

* VM Gallery Applications

* Updated plugin
  • Loading branch information
fraliv13 authored Sep 1, 2023
1 parent bca2841 commit de929bc
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 14 deletions.
17 changes: 17 additions & 0 deletions helm/crds/provisioning.totalsoft.ro_azurevirtualdesktops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@ spec:
type: string
type: array
type: object
vmApplications:
description: Virtual Machine Gallery Applications
items:
properties:
installOrderIndex:
description: 'Installation order index. Eg: 1, 2, 3'
type: integer
packageId:
description: 'Source gallery application id or application version
id eg: subscriptions/15b38e46-ef41-4f5b-bdba-7d9354568c2d/resourceGroups/test-vm/providers/Microsoft.Compute/galleries/lfgalery/applications/charisma-client/versions/4.33.0'
type: string
required:
- installOrderIndex
- packageId
type: object
type: array
vmNamePrefix:
description: Session Host VM name prefix. Will have platform and tenant
suffix.
Expand All @@ -219,6 +235,7 @@ spec:
- platformRef
- sourceImageId
- subnetId
- vmApplications
- vmNamePrefix
- vmNumberOfInstances
- vmSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ func NewAzureVirtualDesktopVM(ctx *pulumi.Context, name string, args *AzureVirtu
return nil, err
}

vmApplications := compute.VMGalleryApplicationArray{}
for _, vmApplication := range args.Spec.VmApplications {
vmApplications = append(vmApplications, compute.VMGalleryApplicationArgs{
PackageReferenceId: pulumi.String(vmApplication.PackageId),
Order: pulumi.Int(vmApplication.InstallOrderIndex),
})
}

vmArgs := compute.VirtualMachineArgs{
//VmName: pulumi.String(name),
ResourceGroupName: args.ResourceGroupName,
Expand Down Expand Up @@ -170,6 +178,9 @@ func NewAzureVirtualDesktopVM(ctx *pulumi.Context, name string, args *AzureVirtu
},
},
},
ApplicationProfile: compute.ApplicationProfileArgs{
GalleryApplications: vmApplications,
},
}

if args.Spec.EnableTrustedLaunch {
Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/provisioning/v1alpha1/azureVirtualDesktopTypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type AzureVirtualDesktopSpec struct {
// The number of virtual machines to be added to the host pool
VmNumberOfInstances int `json:"vmNumberOfInstances"`

// Virtual Machine Gallery Applications
VmApplications []VirtualMachineGalleryApplication `json:"vmApplications"`

// Possible values are Standard_LRS, StandardSSD_LRS or Premium_LRS.
// +kubebuilder:validation:Enum=Standard_LRS;StandardSSD_LRS;Premium_LRS
OSDiskType string `json:"osDiskType"`
Expand Down Expand Up @@ -92,6 +95,16 @@ type AzureVirtualDesktopApplication struct {
Path string `json:"path"`
}

type VirtualMachineGalleryApplication struct {

// Source gallery application id or application version id
// eg: subscriptions/15b38e46-ef41-4f5b-bdba-7d9354568c2d/resourceGroups/test-vm/providers/Microsoft.Compute/galleries/lfgalery/applications/charisma-client/versions/4.33.0
PackageId string `json:"packageId"`

// Installation order index. Eg: 1, 2, 3
InstallOrderIndex int `json:"installOrderIndex"`
}

type InitScriptArgs struct {
Name string `json:"name"`
Value string `json:"value"`
Expand Down
21 changes: 21 additions & 0 deletions pkg/apis/provisioning/v1alpha1/zz_generated.deepcopy.go

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

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

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

2 changes: 2 additions & 0 deletions pkg/generated/applyconfiguration/utils.go

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

0 comments on commit de929bc

Please sign in to comment.