From be7c1eec4ab00b2d76036d77704a8a5fe0ddd5da Mon Sep 17 00:00:00 2001 From: Breee Date: Sat, 1 Jun 2024 14:24:47 +0200 Subject: [PATCH 1/3] uuid extractor --- config/common/common.go | 26 +++++++++++++++++++++++++ config/provider.go | 10 +++++----- dev/bugs/83-import-ref.yaml | 38 +++++++++++++++++++++++++++++++++++++ docs/Quickstart.md | 7 +++++++ 4 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 dev/bugs/83-import-ref.yaml create mode 100644 docs/Quickstart.md diff --git a/config/common/common.go b/config/common/common.go index a8d3040..9f61df8 100644 --- a/config/common/common.go +++ b/config/common/common.go @@ -1,6 +1,8 @@ package common import ( + "strings" + "github.com/crossplane/crossplane-runtime/pkg/fieldpath" "github.com/crossplane/crossplane-runtime/pkg/reference" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -13,6 +15,7 @@ const ( // PathServiceAccountRoleIDExtractor is the golang path to ARNExtractor function // in this package. PathServiceAccountRoleIDExtractor = SelfPackagePath + ".ServiceAccountRoleIDExtractor()" + PathUUIDExtractor = SelfPackagePath + ".UUIDExtractor()" ) // ServiceAccountRoleIDExtractor returns a reference.ExtractValueFn that can be used to extract the ServiceAccountRoleID from a managed resource. @@ -31,3 +34,26 @@ func ServiceAccountRoleIDExtractor() reference.ExtractValueFn { return r } } + +// ServiceAccountRoleIDExtractor returns a reference.ExtractValueFn that can be used to extract the ServiceAccountRoleID from a managed resource. +func UUIDExtractor() reference.ExtractValueFn { + return func(mg xpresource.Managed) string { + paved, err := fieldpath.PaveObject(mg) + if err != nil { + // todo(hasan): should we log this error? + return "" + } + r, err := paved.GetString("status.atProvider.id") + // split at / and return the last element of there are two parts + // this is to handle the case where the id is a path realm/uuid + if err != nil { + // todo(hasan): should we log this error? + return "" + } + split := strings.Split(r, "/") + if len(split) == 2 { + return split[1] + } + return r + } +} diff --git a/config/provider.go b/config/provider.go index a6d4914..32f4768 100644 --- a/config/provider.go +++ b/config/provider.go @@ -103,11 +103,11 @@ func KnownReferencers() config.ResourceOption { //nolint:gocyclo IgnoredFields: []string{"service_account_user_id"}, } - // case "role": - // r.References["role"] = config.Reference{ - // Type: "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1.Role", - // Extractor: `github.com/crossplane/upjet/pkg/resource.ExtractParamPath("name", false)`, - // } + case "role_id": + r.References["role_id"] = config.Reference{ + Type: "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1.Role", + Extractor: common.PathUUIDExtractor, + } } } diff --git a/dev/bugs/83-import-ref.yaml b/dev/bugs/83-import-ref.yaml new file mode 100644 index 0000000..a412d5e --- /dev/null +++ b/dev/bugs/83-import-ref.yaml @@ -0,0 +1,38 @@ +--- +apiVersion: group.keycloak.crossplane.io/v1alpha1 +kind: Group +metadata: + name: my-realm-default-group +spec: + deletionPolicy: Delete + forProvider: + realmId: my-realm + name: my-realm-default-group + initProvider: {} + providerConfigRef: + name: "keycloak-provider-config" +--- +apiVersion: group.keycloak.crossplane.io/v1alpha1 +kind: Roles +metadata: + name: my-realm-default-group-roles +spec: + deletionPolicy: Delete + forProvider: + groupIdRef: + name: my-realm-default-group + realmId: my-realm + #roleIds: + # - a1016794-5600-48ce-85d8-1a01274b3767 + roleIdsRefs: + - name: builtin-my-realm-realm-management-view-users + - name: builtin-my-realm-realm-management-view-clients + - name: builtin-my-realm-realm-management-view-realm + #roleIdsSelector: + # matchLabels: + # defaultRole: 'true' + # realmName: my-realm + managementPolicies: + - '*' + providerConfigRef: + name: "keycloak-provider-config" \ No newline at end of file diff --git a/docs/Quickstart.md b/docs/Quickstart.md new file mode 100644 index 0000000..50ad7ce --- /dev/null +++ b/docs/Quickstart.md @@ -0,0 +1,7 @@ +--- +title: Quickstart +weight: 1 +--- +# Quickstart + +Test \ No newline at end of file From caf354ef7397e21ae3456c198f671f3f24358c6f Mon Sep 17 00:00:00 2001 From: Breee Date: Sat, 1 Jun 2024 14:58:24 +0200 Subject: [PATCH 2/3] role id extractor --- apis/client/v1alpha1/zz_generated.resolvers.go | 9 +++++---- apis/client/v1alpha1/zz_protocolmapper_types.go | 2 ++ apis/client/v1alpha1/zz_rolemapper_types.go | 2 ++ apis/ldap/v1alpha1/zz_generated.resolvers.go | 5 +++-- apis/ldap/v1alpha1/zz_rolemapper_types.go | 2 ++ apis/oidc/v1alpha1/zz_generated.resolvers.go | 5 +++-- apis/oidc/v1alpha1/zz_identityprovider_types.go | 2 ++ apis/openidclient/v1alpha1/zz_client_types.go | 2 ++ .../v1alpha1/zz_clientdefaultscopes_types.go | 2 ++ .../v1alpha1/zz_clientpermissions_types.go | 2 ++ .../zz_clientserviceaccountrole_types.go | 2 ++ .../v1alpha1/zz_generated.resolvers.go | 16 ++++++++-------- .../v1alpha1/zz_generated.resolvers.go | 5 +++-- .../zz_groupmembershipprotocolmapper_types.go | 2 ++ apis/role/v1alpha1/zz_generated.resolvers.go | 5 +++-- apis/role/v1alpha1/zz_role_types.go | 2 ++ apis/samlclient/v1alpha1/zz_client_types.go | 2 ++ .../v1alpha1/zz_clientdefaultscopes_types.go | 2 ++ .../v1alpha1/zz_generated.resolvers.go | 9 +++++---- config/provider.go | 9 ++++++++- .../keycloak-provider/keycloak-provider.yaml | 2 +- dev/bugs/83-import-ref.yaml | 16 +++++++--------- 22 files changed, 70 insertions(+), 35 deletions(-) diff --git a/apis/client/v1alpha1/zz_generated.resolvers.go b/apis/client/v1alpha1/zz_generated.resolvers.go index 273847a..0d54107 100644 --- a/apis/client/v1alpha1/zz_generated.resolvers.go +++ b/apis/client/v1alpha1/zz_generated.resolvers.go @@ -10,6 +10,7 @@ import ( v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1" v1alpha11 "github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1" v1alpha12 "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1" + common "github.com/crossplane-contrib/provider-keycloak/config/common" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" @@ -24,7 +25,7 @@ func (mg *ProtocolMapper) ResolveReferences(ctx context.Context, c client.Reader rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -72,7 +73,7 @@ func (mg *ProtocolMapper) ResolveReferences(ctx context.Context, c client.Reader rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ @@ -130,7 +131,7 @@ func (mg *RoleMapper) ResolveReferences(ctx context.Context, c client.Reader) er rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -178,7 +179,7 @@ func (mg *RoleMapper) ResolveReferences(ctx context.Context, c client.Reader) er rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ diff --git a/apis/client/v1alpha1/zz_protocolmapper_types.go b/apis/client/v1alpha1/zz_protocolmapper_types.go index 1895626..584d0df 100755 --- a/apis/client/v1alpha1/zz_protocolmapper_types.go +++ b/apis/client/v1alpha1/zz_protocolmapper_types.go @@ -18,6 +18,7 @@ type ProtocolMapperInitParameters struct { // The ID of the client this protocol mapper should be added to. Conflicts with client_scope_id. This argument is required if client_scope_id is not set. // The mapper's associated client. Cannot be used at the same time as client_scope_id. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -109,6 +110,7 @@ type ProtocolMapperParameters struct { // The ID of the client this protocol mapper should be added to. Conflicts with client_scope_id. This argument is required if client_scope_id is not set. // The mapper's associated client. Cannot be used at the same time as client_scope_id. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/client/v1alpha1/zz_rolemapper_types.go b/apis/client/v1alpha1/zz_rolemapper_types.go index abbec5a..6342511 100755 --- a/apis/client/v1alpha1/zz_rolemapper_types.go +++ b/apis/client/v1alpha1/zz_rolemapper_types.go @@ -18,6 +18,7 @@ type RoleMapperInitParameters struct { // The ID of the client this role mapper should be added to. Conflicts with client_scope_id. This argument is required if client_scope_id is not set. // The destination client of the role. Cannot be used at the same time as client_scope_id. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -85,6 +86,7 @@ type RoleMapperParameters struct { // The ID of the client this role mapper should be added to. Conflicts with client_scope_id. This argument is required if client_scope_id is not set. // The destination client of the role. Cannot be used at the same time as client_scope_id. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/ldap/v1alpha1/zz_generated.resolvers.go b/apis/ldap/v1alpha1/zz_generated.resolvers.go index e0b6929..ab4c613 100644 --- a/apis/ldap/v1alpha1/zz_generated.resolvers.go +++ b/apis/ldap/v1alpha1/zz_generated.resolvers.go @@ -11,6 +11,7 @@ import ( v1alpha13 "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1" v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1" v1alpha12 "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1" + common "github.com/crossplane-contrib/provider-keycloak/config/common" reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" @@ -682,7 +683,7 @@ func (mg *RoleMapper) ResolveReferences(ctx context.Context, c client.Reader) er rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -730,7 +731,7 @@ func (mg *RoleMapper) ResolveReferences(ctx context.Context, c client.Reader) er rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ diff --git a/apis/ldap/v1alpha1/zz_rolemapper_types.go b/apis/ldap/v1alpha1/zz_rolemapper_types.go index 956b8fb..a7dc80d 100755 --- a/apis/ldap/v1alpha1/zz_rolemapper_types.go +++ b/apis/ldap/v1alpha1/zz_rolemapper_types.go @@ -17,6 +17,7 @@ type RoleMapperInitParameters struct { // When specified, LDAP role mappings will be mapped to client role mappings tied to this client ID. Can only be set if use_realm_roles_mapping is false. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -148,6 +149,7 @@ type RoleMapperParameters struct { // When specified, LDAP role mappings will be mapped to client role mappings tied to this client ID. Can only be set if use_realm_roles_mapping is false. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/oidc/v1alpha1/zz_generated.resolvers.go b/apis/oidc/v1alpha1/zz_generated.resolvers.go index 768bd7b..492d1f9 100644 --- a/apis/oidc/v1alpha1/zz_generated.resolvers.go +++ b/apis/oidc/v1alpha1/zz_generated.resolvers.go @@ -9,6 +9,7 @@ import ( "context" v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1" v1alpha11 "github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1" + common "github.com/crossplane-contrib/provider-keycloak/config/common" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" @@ -23,7 +24,7 @@ func (mg *IdentityProvider) ResolveReferences(ctx context.Context, c client.Read rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -55,7 +56,7 @@ func (mg *IdentityProvider) ResolveReferences(ctx context.Context, c client.Read rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ diff --git a/apis/oidc/v1alpha1/zz_identityprovider_types.go b/apis/oidc/v1alpha1/zz_identityprovider_types.go index 00639fc..1e63acd 100755 --- a/apis/oidc/v1alpha1/zz_identityprovider_types.go +++ b/apis/oidc/v1alpha1/zz_identityprovider_types.go @@ -41,6 +41,7 @@ type IdentityProviderInitParameters struct { // The client or client identifier registered within the identity provider. // Client ID. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -315,6 +316,7 @@ type IdentityProviderParameters struct { // The client or client identifier registered within the identity provider. // Client ID. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/openidclient/v1alpha1/zz_client_types.go b/apis/openidclient/v1alpha1/zz_client_types.go index b163d06..014d9f5 100755 --- a/apis/openidclient/v1alpha1/zz_client_types.go +++ b/apis/openidclient/v1alpha1/zz_client_types.go @@ -125,6 +125,7 @@ type ClientInitParameters struct { // The Client ID for this client, referenced in the URI during authentication and in issued tokens. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -437,6 +438,7 @@ type ClientParameters struct { // The Client ID for this client, referenced in the URI during authentication and in issued tokens. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/openidclient/v1alpha1/zz_clientdefaultscopes_types.go b/apis/openidclient/v1alpha1/zz_clientdefaultscopes_types.go index ff5e14a..9684253 100755 --- a/apis/openidclient/v1alpha1/zz_clientdefaultscopes_types.go +++ b/apis/openidclient/v1alpha1/zz_clientdefaultscopes_types.go @@ -17,6 +17,7 @@ type ClientDefaultScopesInitParameters struct { // The ID of the client to attach default scopes to. Note that this is the unique ID of the client generated by Keycloak. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -63,6 +64,7 @@ type ClientDefaultScopesParameters struct { // The ID of the client to attach default scopes to. Note that this is the unique ID of the client generated by Keycloak. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/openidclient/v1alpha1/zz_clientpermissions_types.go b/apis/openidclient/v1alpha1/zz_clientpermissions_types.go index a6a3c1e..0175045 100755 --- a/apis/openidclient/v1alpha1/zz_clientpermissions_types.go +++ b/apis/openidclient/v1alpha1/zz_clientpermissions_types.go @@ -17,6 +17,7 @@ type ClientPermissionsInitParameters struct { // The id of the client that provides the role. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -90,6 +91,7 @@ type ClientPermissionsParameters struct { // The id of the client that provides the role. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/openidclient/v1alpha1/zz_clientserviceaccountrole_types.go b/apis/openidclient/v1alpha1/zz_clientserviceaccountrole_types.go index e194fe9..1396b01 100755 --- a/apis/openidclient/v1alpha1/zz_clientserviceaccountrole_types.go +++ b/apis/openidclient/v1alpha1/zz_clientserviceaccountrole_types.go @@ -17,6 +17,7 @@ type ClientServiceAccountRoleInitParameters struct { // The id of the client that provides the role. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -79,6 +80,7 @@ type ClientServiceAccountRoleParameters struct { // The id of the client that provides the role. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/openidclient/v1alpha1/zz_generated.resolvers.go b/apis/openidclient/v1alpha1/zz_generated.resolvers.go index eeb909c..613817e 100644 --- a/apis/openidclient/v1alpha1/zz_generated.resolvers.go +++ b/apis/openidclient/v1alpha1/zz_generated.resolvers.go @@ -23,7 +23,7 @@ func (mg *Client) ResolveReferences(ctx context.Context, c client.Reader) error rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -55,7 +55,7 @@ func (mg *Client) ResolveReferences(ctx context.Context, c client.Reader) error rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ @@ -139,7 +139,7 @@ func (mg *ClientDefaultScopes) ResolveReferences(ctx context.Context, c client.R rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -171,7 +171,7 @@ func (mg *ClientDefaultScopes) ResolveReferences(ctx context.Context, c client.R rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ @@ -255,7 +255,7 @@ func (mg *ClientPermissions) ResolveReferences(ctx context.Context, c client.Rea rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -287,7 +287,7 @@ func (mg *ClientPermissions) ResolveReferences(ctx context.Context, c client.Rea rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ @@ -487,7 +487,7 @@ func (mg *ClientServiceAccountRole) ResolveReferences(ctx context.Context, c cli rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -535,7 +535,7 @@ func (mg *ClientServiceAccountRole) ResolveReferences(ctx context.Context, c cli rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ diff --git a/apis/openidgroup/v1alpha1/zz_generated.resolvers.go b/apis/openidgroup/v1alpha1/zz_generated.resolvers.go index 8f41364..d9d8512 100644 --- a/apis/openidgroup/v1alpha1/zz_generated.resolvers.go +++ b/apis/openidgroup/v1alpha1/zz_generated.resolvers.go @@ -9,6 +9,7 @@ import ( "context" v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1" v1alpha11 "github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1" + common "github.com/crossplane-contrib/provider-keycloak/config/common" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" @@ -23,7 +24,7 @@ func (mg *GroupMembershipProtocolMapper) ResolveReferences(ctx context.Context, rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -71,7 +72,7 @@ func (mg *GroupMembershipProtocolMapper) ResolveReferences(ctx context.Context, rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ diff --git a/apis/openidgroup/v1alpha1/zz_groupmembershipprotocolmapper_types.go b/apis/openidgroup/v1alpha1/zz_groupmembershipprotocolmapper_types.go index d5333bf..0034402 100755 --- a/apis/openidgroup/v1alpha1/zz_groupmembershipprotocolmapper_types.go +++ b/apis/openidgroup/v1alpha1/zz_groupmembershipprotocolmapper_types.go @@ -30,6 +30,7 @@ type GroupMembershipProtocolMapperInitParameters struct { // The client this protocol mapper should be attached to. Conflicts with client_scope_id. One of client_id or client_scope_id must be specified. // The mapper's associated client. Cannot be used at the same time as client_scope_id. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -131,6 +132,7 @@ type GroupMembershipProtocolMapperParameters struct { // The client this protocol mapper should be attached to. Conflicts with client_scope_id. One of client_id or client_scope_id must be specified. // The mapper's associated client. Cannot be used at the same time as client_scope_id. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/role/v1alpha1/zz_generated.resolvers.go b/apis/role/v1alpha1/zz_generated.resolvers.go index 8e0cc27..2f403a4 100644 --- a/apis/role/v1alpha1/zz_generated.resolvers.go +++ b/apis/role/v1alpha1/zz_generated.resolvers.go @@ -9,6 +9,7 @@ import ( "context" v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1" v1alpha11 "github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1" + common "github.com/crossplane-contrib/provider-keycloak/config/common" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" @@ -24,7 +25,7 @@ func (mg *Role) ResolveReferences(ctx context.Context, c client.Reader) error { rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -72,7 +73,7 @@ func (mg *Role) ResolveReferences(ctx context.Context, c client.Reader) error { rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ diff --git a/apis/role/v1alpha1/zz_role_types.go b/apis/role/v1alpha1/zz_role_types.go index 670c0f9..ce35d8d 100755 --- a/apis/role/v1alpha1/zz_role_types.go +++ b/apis/role/v1alpha1/zz_role_types.go @@ -21,6 +21,7 @@ type RoleInitParameters struct { // When specified, this role will be created as a client role attached to the client with the provided ID // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -97,6 +98,7 @@ type RoleParameters struct { // When specified, this role will be created as a client role attached to the client with the provided ID // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/samlclient/v1alpha1/zz_client_types.go b/apis/samlclient/v1alpha1/zz_client_types.go index f67ab4d..bec31ff 100755 --- a/apis/samlclient/v1alpha1/zz_client_types.go +++ b/apis/samlclient/v1alpha1/zz_client_types.go @@ -61,6 +61,7 @@ type ClientInitParameters struct { // The unique ID of this client, referenced in the URI during authentication and in issued tokens. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -309,6 +310,7 @@ type ClientParameters struct { // The unique ID of this client, referenced in the URI during authentication and in issued tokens. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/samlclient/v1alpha1/zz_clientdefaultscopes_types.go b/apis/samlclient/v1alpha1/zz_clientdefaultscopes_types.go index ff5e14a..9684253 100755 --- a/apis/samlclient/v1alpha1/zz_clientdefaultscopes_types.go +++ b/apis/samlclient/v1alpha1/zz_clientdefaultscopes_types.go @@ -17,6 +17,7 @@ type ClientDefaultScopesInitParameters struct { // The ID of the client to attach default scopes to. Note that this is the unique ID of the client generated by Keycloak. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` // Reference to a Client in openidclient to populate clientId. @@ -63,6 +64,7 @@ type ClientDefaultScopesParameters struct { // The ID of the client to attach default scopes to. Note that this is the unique ID of the client generated by Keycloak. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` diff --git a/apis/samlclient/v1alpha1/zz_generated.resolvers.go b/apis/samlclient/v1alpha1/zz_generated.resolvers.go index 6644fdf..2fc8d65 100644 --- a/apis/samlclient/v1alpha1/zz_generated.resolvers.go +++ b/apis/samlclient/v1alpha1/zz_generated.resolvers.go @@ -9,6 +9,7 @@ import ( "context" v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1" v1alpha11 "github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1" + common "github.com/crossplane-contrib/provider-keycloak/config/common" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" @@ -23,7 +24,7 @@ func (mg *Client) ResolveReferences(ctx context.Context, c client.Reader) error rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -55,7 +56,7 @@ func (mg *Client) ResolveReferences(ctx context.Context, c client.Reader) error rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ @@ -97,7 +98,7 @@ func (mg *ClientDefaultScopes) ResolveReferences(ctx context.Context, c client.R rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.ForProvider.ClientIDRef, Selector: mg.Spec.ForProvider.ClientIDSelector, To: reference.To{ @@ -129,7 +130,7 @@ func (mg *ClientDefaultScopes) ResolveReferences(ctx context.Context, c client.R rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), Reference: mg.Spec.InitProvider.ClientIDRef, Selector: mg.Spec.InitProvider.ClientIDSelector, To: reference.To{ diff --git a/config/provider.go b/config/provider.go index 32f4768..2b20a23 100644 --- a/config/provider.go +++ b/config/provider.go @@ -90,7 +90,8 @@ func KnownReferencers() config.ResourceOption { //nolint:gocyclo } case "client_id": r.References["client_id"] = config.Reference{ - Type: "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client", + Type: "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client", + Extractor: common.PathUUIDExtractor, } case "service_account_user_id": r.References["service_account_user_id"] = config.Reference{ @@ -103,6 +104,12 @@ func KnownReferencers() config.ResourceOption { //nolint:gocyclo IgnoredFields: []string{"service_account_user_id"}, } + case "role_ids": + r.References["role_ids"] = config.Reference{ + Type: "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1.Role", + Extractor: common.PathUUIDExtractor, + } + case "role_id": r.References["role_id"] = config.Reference{ Type: "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1.Role", diff --git a/dev/apps/keycloak-provider/keycloak-provider.yaml b/dev/apps/keycloak-provider/keycloak-provider.yaml index 41ab0be..f362880 100644 --- a/dev/apps/keycloak-provider/keycloak-provider.yaml +++ b/dev/apps/keycloak-provider/keycloak-provider.yaml @@ -7,7 +7,7 @@ metadata: annotations: argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true spec: - package: xpkg.upbound.io/crossplane-contrib/provider-keycloak:v0.16.0 + package: xpkg.upbound.io/crossplane-contrib/provider-keycloak:v0.20.0 runtimeConfigRef: name: enable-ess --- diff --git a/dev/bugs/83-import-ref.yaml b/dev/bugs/83-import-ref.yaml index a412d5e..3873c91 100644 --- a/dev/bugs/83-import-ref.yaml +++ b/dev/bugs/83-import-ref.yaml @@ -2,12 +2,12 @@ apiVersion: group.keycloak.crossplane.io/v1alpha1 kind: Group metadata: - name: my-realm-default-group + name: dev-default-group spec: deletionPolicy: Delete forProvider: - realmId: my-realm - name: my-realm-default-group + realmId: dev + name: dev-default-group initProvider: {} providerConfigRef: name: "keycloak-provider-config" @@ -15,19 +15,17 @@ spec: apiVersion: group.keycloak.crossplane.io/v1alpha1 kind: Roles metadata: - name: my-realm-default-group-roles + name: dev-default-group-roles spec: deletionPolicy: Delete forProvider: groupIdRef: - name: my-realm-default-group - realmId: my-realm + name: dev-default-group + realmId: dev #roleIds: # - a1016794-5600-48ce-85d8-1a01274b3767 roleIdsRefs: - - name: builtin-my-realm-realm-management-view-users - - name: builtin-my-realm-realm-management-view-clients - - name: builtin-my-realm-realm-management-view-realm + - name: builtin-dev-realm-role-uma-authorization #roleIdsSelector: # matchLabels: # defaultRole: 'true' From 4bfe6e4a1960d4584d62c856edea0348cc639b6e Mon Sep 17 00:00:00 2001 From: Breee Date: Sat, 1 Jun 2024 16:38:06 +0200 Subject: [PATCH 3/3] fix resolver --- apis/group/v1alpha1/zz_generated.resolvers.go | 5 +++-- apis/group/v1alpha1/zz_roles_types.go | 2 ++ config/group/config.go | 3 --- dev/apps/keycloak-provider/keycloak-provider.yaml | 2 +- dev/bugs/83-import-ref.yaml | 13 ++++++++++++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/apis/group/v1alpha1/zz_generated.resolvers.go b/apis/group/v1alpha1/zz_generated.resolvers.go index 2d9b71a..3d606c2 100644 --- a/apis/group/v1alpha1/zz_generated.resolvers.go +++ b/apis/group/v1alpha1/zz_generated.resolvers.go @@ -9,6 +9,7 @@ import ( "context" v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1" v1alpha11 "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1" + common "github.com/crossplane-contrib/provider-keycloak/config/common" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" @@ -278,7 +279,7 @@ func (mg *Roles) ResolveReferences(ctx context.Context, c client.Reader) error { mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.RoleIds), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), References: mg.Spec.ForProvider.RoleIdsRefs, Selector: mg.Spec.ForProvider.RoleIdsSelector, To: reference.To{ @@ -326,7 +327,7 @@ func (mg *Roles) ResolveReferences(ctx context.Context, c client.Reader) error { mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.RoleIds), - Extract: reference.ExternalName(), + Extract: common.UUIDExtractor(), References: mg.Spec.InitProvider.RoleIdsRefs, Selector: mg.Spec.InitProvider.RoleIdsSelector, To: reference.To{ diff --git a/apis/group/v1alpha1/zz_roles_types.go b/apis/group/v1alpha1/zz_roles_types.go index 3b28800..19fc778 100755 --- a/apis/group/v1alpha1/zz_roles_types.go +++ b/apis/group/v1alpha1/zz_roles_types.go @@ -44,6 +44,7 @@ type RolesInitParameters struct { // A list of role IDs to map to the group. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1.Role + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +listType=set RoleIds []*string `json:"roleIds,omitempty" tf:"role_ids,omitempty"` @@ -108,6 +109,7 @@ type RolesParameters struct { // A list of role IDs to map to the group. // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1.Role + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() // +kubebuilder:validation:Optional // +listType=set RoleIds []*string `json:"roleIds,omitempty" tf:"role_ids,omitempty"` diff --git a/config/group/config.go b/config/group/config.go index 00b9911..6420542 100644 --- a/config/group/config.go +++ b/config/group/config.go @@ -26,9 +26,6 @@ func Configure(p *config.Provider) { r.References["group_id"] = config.Reference{ Type: "Group", } - r.References["role_ids"] = config.Reference{ - Type: "github.com/crossplane-contrib/provider-keycloak/apis/role/v1alpha1.Role", - } }) p.AddResourceConfigurator("keycloak_group_permissions", func(r *config.Resource) { // We need to override the default group that upjet generated for diff --git a/dev/apps/keycloak-provider/keycloak-provider.yaml b/dev/apps/keycloak-provider/keycloak-provider.yaml index f362880..690845f 100644 --- a/dev/apps/keycloak-provider/keycloak-provider.yaml +++ b/dev/apps/keycloak-provider/keycloak-provider.yaml @@ -7,7 +7,7 @@ metadata: annotations: argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true spec: - package: xpkg.upbound.io/crossplane-contrib/provider-keycloak:v0.20.0 + package: xpkg.upbound.io/crossplane-contrib/provider-keycloak:v0.21.0-rc.1 runtimeConfigRef: name: enable-ess --- diff --git a/dev/bugs/83-import-ref.yaml b/dev/bugs/83-import-ref.yaml index 3873c91..8f75401 100644 --- a/dev/bugs/83-import-ref.yaml +++ b/dev/bugs/83-import-ref.yaml @@ -1,3 +1,14 @@ +# Example 1: Basic Realm Configuration +# This example demonstrates the minimum required fields to create a realm. +apiVersion: realm.keycloak.crossplane.io/v1alpha1 +kind: Realm +metadata: + name: dev # The name of the realm in Kubernetes +spec: + forProvider: + realm: "dev" # The name of the realm in Keycloak + providerConfigRef: + name: "keycloak-provider-config" # Reference to the ProviderConfig resource --- apiVersion: group.keycloak.crossplane.io/v1alpha1 kind: Group @@ -23,7 +34,7 @@ spec: name: dev-default-group realmId: dev #roleIds: - # - a1016794-5600-48ce-85d8-1a01274b3767 + # - 6f6bc131-7a5c-467f-83cb-dac11bc8e8f5 roleIdsRefs: - name: builtin-dev-realm-role-uma-authorization #roleIdsSelector: