이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 3. Red Hat build of Keycloak Realm Import
3.1. Importing a Red Hat build of Keycloak Realm 링크 복사링크가 클립보드에 복사되었습니다!
Using the Red Hat build of Keycloak Operator, you can perform a realm import for the Keycloak Deployment.
- If a Realm with the same name already exists in Red Hat build of Keycloak, it will not be overwritten.
- The Realm Import CR only supports creation of new realms and does not update or delete those. Changes to the realm performed directly on Red Hat build of Keycloak are not synced back in the CR.
3.1.1. Creating a Realm Import Custom Resource 링크 복사링크가 클립보드에 복사되었습니다!
The following is an example of a Realm Import Custom Resource (CR):
This CR should be created in the same namespace as the Keycloak Deployment CR, defined in the field keycloakCRName
. The realm
field accepts a full RealmRepresentation.
The recommended way to obtain a RealmRepresentation
is by leveraging the export functionality Importing and Exporting Realms.
- Export the Realm to a single file.
- Convert the JSON file to YAML.
-
Copy and paste the obtained YAML file as body for the
realm
key, making sure the indentation is correct.
3.1.2. Applying the Realm Import CR 링크 복사링크가 클립보드에 복사되었습니다!
Use oc
to create the CR in the correct cluster namespace:
Create YAML file example-realm-import.yaml
:
Apply the changes:
oc apply -f example-realm-import.yaml
oc apply -f example-realm-import.yaml
To check the status of the running import, enter the following command:
oc get keycloakrealmimports/my-realm-kc -o go-template='{{range .status.conditions}}CONDITION: {{.type}}{{"\n"}} STATUS: {{.status}}{{"\n"}} MESSAGE: {{.message}}{{"\n"}}{{end}}'
oc get keycloakrealmimports/my-realm-kc -o go-template='{{range .status.conditions}}CONDITION: {{.type}}{{"\n"}} STATUS: {{.status}}{{"\n"}} MESSAGE: {{.message}}{{"\n"}}{{end}}'
When the import has successfully completed, the output will look like the following example: