keycloak-scim/operator
2022-04-20 11:09:08 +02:00
..
olm-base OLM tests using ttl.sh 2022-04-19 09:44:25 -03:00
overlays/default-namespace Proper kustomize setup for the operator 2022-01-24 13:13:16 -03:00
scripts Inject the operand version as env var (#11511) 2022-04-20 11:09:08 +02:00
src Inject the operand version as env var (#11511) 2022-04-20 11:09:08 +02:00
.gitignore Build the Olm bundle and test it in CI (#10949) 2022-04-08 10:22:01 +02:00
patch-sources.sh CRD generation from RealmRepresentation (#9759) 2022-01-27 10:56:46 +01:00
pom.xml Update Operator SDK version 2022-04-19 09:40:35 -03:00
README.md Update operator/README.md 2022-03-30 12:46:32 -03:00

Keycloak on Quarkus

The module holds the codebase to build the Keycloak Operator on top of Quarkus. Using the Quarkus Operator SDK.

Activating the Module

When build from the project root directory, this module is only enabled if the installed JDK is 11 or newer.

Building

Ensure you have JDK 11 (or newer) installed.

Build the Docker image with:

mvn clean package -Doperator -Dquarkus.container-image.build=true

Configuration

The Keycloak image can be configured, when starting the operator, using the Java property:

operator.keycloak.image

And the imagePullPolicy with:

operator.keycloak.image-pull-policy

Contributing

Quick start on Minikube

Enable the Minikube Docker daemon:

eval $(minikube -p minikube docker-env)

Compile the project and generate the Docker image with JIB:

mvn clean package -Doperator -Dquarkus.container-image.build=true -Dquarkus.kubernetes.deployment-target=minikube

Install the CRD definition and the operator in the cluster in the keycloak namespace:

kubectl apply -k target

to install in the default namespace:

kubectl apply -k overlays/default-namespace

Remove the created resources with:

kubectl delete -k <previously-used-folder>

Testing

Testing allows 2 methods specified in the property test.operator.deployment : local & remote.

local : resources will be deployed to the local cluster and the operator will run out of the cluster

remote : same as local test but an image for the operator will be generated and deployed run inside the cluster

mvn clean verify \
  -Dquarkus.container-image.build=true \
  -Dquarkus.container-image.tag=test \
  -Dquarkus.kubernetes.deployment-target=kubernetes \
  -Dtest.operator.deployment=remote

To run tests on Mac with minikube and the docker driver you should run minikube tunnel in a separate shell and configure the Java properties as follows:

-Dtest.operator.kubernetes.ip=localhost

On Linux or on Mac using minikube on a VM, instead you should pass this additional property:

-Dtest.operator.kubernetes.ip=$(minikube ip)

To avoid skipping tests that are depending on custom Keycloak images, you need to build those first:

./build-testing-docker-images.sh [SOURCE KEYCLOAK IMAGE TAG] [SOURCE KEYCLOAK IMAGE]

And run the tests passing an extra Java property:

-Dtest.operator.custom.image=custom-keycloak:latest