Skip to content
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Groups contained within Azure Active Directory can be synchronized into OpenShif
| `filter` | Graph API filter | | No |
| `groups` | List of groups to filter against | | No |
| `userNameAttributes` | Fields on a user record to use as the User Name | `userPrincipalName` | No |
| `useUIDAsGroupName` | Use the Azure group object ID (UID) instead of the display name as the name of the OpenShift group | `false` | No |
| `prune` | Prune Whether to prune groups that are no longer in Azure | `false` | No |

The following is an example of a minimal configuration that can be applied to integrate with a Azure provider:
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/groupsync_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ type AzureProvider struct {
// +kubebuilder:validation:Optional
UserNameAttributes *[]string `json:"userNameAttributes,omitempty"`

// UseUIDAsGroupName determines whether the Azure group object ID (UID) is used as the name of the OpenShift group instead of the display name. Default is false
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Use UID as Group Name",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// +kubebuilder:validation:Optional
UseUIDAsGroupName bool `json:"useUIDAsGroupName,omitempty"`

// Prune Whether to prune groups that are no longer in Azure. Default is false
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Prune",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// +kubebuilder:validation:Optional
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/redhatcop.redhat.io_groupsyncs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ spec:
prune:
description: Prune Whether to prune groups that are no longer in Azure. Default is false
type: boolean
useUIDAsGroupName:
description: UseUIDAsGroupName determines whether the Azure group object ID (UID) is used as the name of the OpenShift group instead of the display name. Default is false
type: boolean
userNameAttributes:
description: UserNameAttributes are the fields to consider on the User object containing the username
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ spec:
path: providers[0].azure.userNameAttributes
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: UseUIDAsGroupName determines whether the Azure group object ID
(UID) is used as the name of the OpenShift group instead of the display
name. Default is false
displayName: Use UID as Group Name
path: providers[0].azure.useUIDAsGroupName
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: GitHub represents the GitHub provider
displayName: GitHub Provider
path: providers[0].github
Expand Down Expand Up @@ -783,6 +790,7 @@ spec:
| `filter` | Graph API filter | | No |
| `groups` | List of groups to filter against | | No |
| `userNameAttributes` | Fields on a user record to use as the User Name | `userPrincipalName` | No |
| `useUIDAsGroupName` | Use the Azure group object ID (UID) instead of the display name as the name of the OpenShift group | `false` | No |
| `prune` | Prune Whether to prune groups that are no longer in Azure | `false` | No |

The following is an example of a minimal configuration that can be applied to integrate with a Azure provider:
Expand Down
7 changes: 6 additions & 1 deletion pkg/syncer/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,18 @@ func (a *AzureSyncer) Sync() ([]userv1.Group, error) {
continue
}

ocpGroupName := *groupName
if a.Provider.UseUIDAsGroupName {
ocpGroupName = *group.DirectoryObject.GetId()
}

ocpGroup := userv1.Group{
TypeMeta: v1.TypeMeta{
Kind: "Group",
APIVersion: userv1.GroupVersion.String(),
},
ObjectMeta: v1.ObjectMeta{
Name: *groupName,
Name: ocpGroupName,
Annotations: map[string]string{},
Labels: map[string]string{},
},
Expand Down