Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVD configurable groups #79

Merged
merged 6 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions helm/crds/provisioning.totalsoft.ro_azurevirtualdesktops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ spec:
- domain
type: object
type: array
groups:
properties:
admins:
items:
type: string
type: array
applicationUsers:
items:
type: string
type: array
type: object
hostPoolName:
description: Virtual Desktop name prefix. Will have platform and tenant
suffix.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,22 @@ func azureVirtualDesktopDeployFunc(target provisioning.ProvisioningTarget, resou
return err
}
}
for _, childAppsUserGroupName := range avd.Spec.Groups.ApplicationUsers {
childAppsUserGroup, err := azuread.LookupGroup(ctx, &azuread.LookupGroupArgs{
DisplayName: pulumi.StringRef(childAppsUserGroupName),
}, nil)
if err != nil {
return err
}

_, err = azuread.NewGroupMember(ctx, fmt.Sprintf("%s-app-user-group-%s", childAppsUserGroupName, avd.Spec.HostPoolName), &azuread.GroupMemberArgs{
GroupObjectId: appsUserGroup.ID(),
MemberObjectId: pulumi.String(childAppsUserGroup.Id),
}, pulumi.Parent(appsUserGroup))
if err != nil {
return err
}
}

adminUserGroup, err := azuread.NewGroup(ctx, fmt.Sprintf("%s-admin", hostPoolName), &azuread.GroupArgs{
DisplayName: pulumi.String(fmt.Sprintf("%s-%s-admin", globalQalifier, hostPoolName)),
Expand Down Expand Up @@ -461,6 +477,24 @@ func azureVirtualDesktopDeployFunc(target provisioning.ProvisioningTarget, resou
}
}

for _, childAdminUserGroupName := range avd.Spec.Groups.Admins {
childAdminUserGroup, err := azuread.LookupGroup(ctx, &azuread.LookupGroupArgs{
DisplayName: pulumi.StringRef(childAdminUserGroupName),
}, nil)

if err != nil {
return err
}

_, err = azuread.NewGroupMember(ctx, fmt.Sprintf("%s-admin-group-%s", childAdminUserGroupName, avd.Spec.HostPoolName), &azuread.GroupMemberArgs{
GroupObjectId: adminUserGroup.ID(),
MemberObjectId: pulumi.String(childAdminUserGroup.Id),
}, pulumi.Parent(adminUserGroup))
if err != nil {
return err
}
}

avdComponent.HostPool, err = desktopvirtualization.NewHostPool(ctx, hostPoolName, &desktopvirtualization.HostPoolArgs{
//HostPoolName: pulumi.String(hostPoolName),
HostPoolType: pulumi.String(desktopvirtualization.HostPoolTypePooled),
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/provisioning/v1alpha1/azureVirtualDesktopTypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ type AzureVirtualDesktopSpec struct {
// +optional
Users AzureVirtualDesktopUsersSpec `json:"users"`

// +optional
Groups AzureVirtualDesktopGroupsSpec `json:"groups"`

// +optional
Exports []AzureVirtualDesktopExportsSpec `json:"exports,omitempty"`

Expand Down Expand Up @@ -89,6 +92,13 @@ type AzureVirtualDesktopUsersSpec struct {
ApplicationUsers []string `json:"applicationUsers,omitempty"`
}

type AzureVirtualDesktopGroupsSpec struct {
// +optional
Admins []string `json:"admins,omitempty"`
// +optional
ApplicationUsers []string `json:"applicationUsers,omitempty"`
}

type AzureVirtualDesktopApplication struct {
Name string `json:"name"`
FriendlyName string `json:"friendlyName"`
Expand Down
27 changes: 27 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.

Loading