When adding a group to a Keycloak operator user, I get a user not found error

754 Views Asked by At

I'm using manifests such as realm.yaml and user.yaml using examples from this github https://github.com/keycloak/keycloak-operator/tree/master/deploy/examples. our user manifest looks like this. When groups are added to this file we receive this error from helm:

Error from server (NotFound): keycloakusers.keycloak.org "example-user" not found

what is the correct way to create groups using keycloak manifests?

apiVersion: keycloak.org/v1alpha1
kind: KeycloakUser
metadata:
  name: example-user
spec:
  user:
    username: "example-user"
    email: "[email protected]"
    enabled: True
    emailVerified: True
    # credentials:
    #   - type: "password"
    #     value: "password"
    realmRoles:
      - "offline_access"
      - "uma_authorization"
      - "user"
    clientRoles:
      account:
        - "manage-account"
      realm-management:
        - "manage-users"
  realmSelector:
    matchLabels:
      app: sso
1

There are 1 best solutions below

0
On

When keycloak-user using crd, check out the yaml below. However, you should remember that the group (you want to put..) must already exist.

apiVersion: keycloak.org/v1alpha1
kind: KeycloakUser
metadata:
  name: example-user
spec:
  user:
    username: "example-user"
    email: "[email protected]"
    enabled: True
    emailVerified: True
    # credentials:
    #   - type: "password"
    #     value: "password"
    realmRoles:
      - "offline_access"
      - "uma_authorization"
      - "user"
    groups:
      - "your group"
    clientRoles:
      account:
        - "manage-account"
      realm-management:
        - "manage-users"
  realmSelector:
    matchLabels:
      app: sso