Skip to content

Commit

Permalink
Merge pull request #47 from crossplane-contrib/feature/issue-46-paren…
Browse files Browse the repository at this point in the history
…tid-ref

fix(issue-46): Make parent group referencable
  • Loading branch information
Breee authored Feb 14, 2024
2 parents 341521a + 4472092 commit 945e5e4
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 14 deletions.
15 changes: 10 additions & 5 deletions apis/group/v1alpha1/zz_generated.deepcopy.go

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

16 changes: 16 additions & 0 deletions apis/group/v1alpha1/zz_generated.resolvers.go

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

12 changes: 9 additions & 3 deletions apis/group/v1alpha1/zz_group_types.go

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

6 changes: 4 additions & 2 deletions config/group/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ func Configure(p *config.Provider) {
p.AddResourceConfigurator("keycloak_group", func(r *config.Resource) {
// We need to override the default group that upjet generated for
r.ShortGroup = "group"

r.References["parent_id"] = config.Reference{
Type: "Group",
}
})
p.AddResourceConfigurator("keycloak_group_memberships", func(r *config.Resource) {
// We need to override the default group that upjet generated for
// this resource, which would be "github"
r.ShortGroup = "group"
r.References["group_id"] = config.Reference{
Type: "Group",
Expand All @@ -19,7 +22,6 @@ func Configure(p *config.Provider) {
})
p.AddResourceConfigurator("keycloak_group_roles", func(r *config.Resource) {
// We need to override the default group that upjet generated for
// this resource, which would be "github"
r.ShortGroup = "group"
r.References["group_id"] = config.Reference{
Type: "Group",
Expand Down
77 changes: 73 additions & 4 deletions package/crds/group.keycloak.crossplane.io_groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,79 @@ spec:
description: The ID of this group's parent. If omitted, this group
will be defined at the root level.
type: string
parentIdRef:
description: Reference to a Group to populate parentId.
properties:
name:
description: Name of the referenced object.
type: string
policy:
description: Policies for referencing.
properties:
resolution:
default: Required
description: Resolution specifies whether resolution of
this reference is required. The default is 'Required',
which means the reconcile will fail if the reference
cannot be resolved. 'Optional' means this reference
will be a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: Resolve specifies when this reference should
be resolved. The default is 'IfNotPresent', which will
attempt to resolve the reference only when the corresponding
field is not present. Use 'Always' to resolve the reference
on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
required:
- name
type: object
parentIdSelector:
description: Selector for a Group to populate parentId.
properties:
matchControllerRef:
description: MatchControllerRef ensures an object with the
same controller reference as the selecting object is selected.
type: boolean
matchLabels:
additionalProperties:
type: string
description: MatchLabels ensures an object with matching labels
is selected.
type: object
policy:
description: Policies for selection.
properties:
resolution:
default: Required
description: Resolution specifies whether resolution of
this reference is required. The default is 'Required',
which means the reconcile will fail if the reference
cannot be resolved. 'Optional' means this reference
will be a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: Resolve specifies when this reference should
be resolved. The default is 'IfNotPresent', which will
attempt to resolve the reference only when the corresponding
field is not present. Use 'Always' to resolve the reference
on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
type: object
realmId:
description: The realm this group exists in.
type: string
Expand Down Expand Up @@ -179,10 +252,6 @@ spec:
name:
description: The name of the group.
type: string
parentId:
description: The ID of this group's parent. If omitted, this group
will be defined at the root level.
type: string
type: object
managementPolicies:
default:
Expand Down

0 comments on commit 945e5e4

Please sign in to comment.