
Keycloak Operator
A Kubernetes Operator based on the Operator SDK for creating and syncing resources in Keycloak.
Install Go and Operator SDK
LEARN ABOUT Operator Framework
GOTO katacoda and run this
curl -LO https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.13.5.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
mkdir /root/go
export GOPATH=/root/go
export GOBIN=/usr/local/go/bin
export PATH=$PATH:$(go env GOPATH)/bin
go env GOPATH
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
mkdir -p $GOPATH/src/github.com/operator-framework
cd $GOPATH/src/github.com/operator-framework
git clone https://github.com/operator-framework/operator-sdk
cd operator-sdk
git checkout master
make dep
make install
mkdir -p $GOPATH/src/github.com/agilesolutions/agilesolutions
cd $GOPATH/src/github.com/agilesolutions
git clone https://github.com/agilesolutions/keycloak-operator.git
cd keycloak-operator
make setup
running controller
GOTO kubernetes playground
git clone https://github.com/agilesolutions/keycloak-operator.git
cd keycloak-operator
kubectl apply -f deploy/crds/
kubectl create namespace keycloak
kubectl apply -f deploy/role.yaml -n keycloak
kubectl apply -f deploy/role_binding.yaml -n keycloak
kubectl apply -f deploy/service_account.yaml -n keycloak
kubectl apply -f deploy/operator.yaml -n keycloak
kubectl apply -f deploy/examples/keycloak/keycloak.yaml -n keycloak
kubectl apply -f deploy/examples/realm/realm_with_users.yaml -n keycloak
watch kubectl get all -n keycloak
make cluster/prepare
make cluster/create/examples
make cluster/clean
building controller
Read the guide
Understand GO modules to support versioned modules
Operator SDK User Guilde
GOTO kubernetes playground
curl -LO https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.13.5.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
mkdir /root/go
export GOPATH=/root/go
export GOBIN=/usr/local/go/bin
export PATH=$PATH:$(go env GOPATH)/bin
export GO111MODULE=on
go env GOPATH
#curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
mkdir -p $GOPATH/src/github.com/agilesolutions/keycloak-operator
cd $GOPATH/src/github.com/agilesolutions
git clone https://github.com/agilesolutions/keycloak-operator.git
cd keycloak-operator
make setup/mod
make setup/operator-sdk
make code/gen
Problem with module manager
dependency manager "modules" requires working directory to be in $GOPATH/src and GO111MODULE=on, or outside of $GOPATH/src and GO111MODULE="on", "auto", or unset.
docker pull quay.io/keycloak/keycloak:7.0.1
docker run -ti --name rob --entrypoint /bin/bash quay.io/keycloak/keycloak:7.0.1
cat /opt/jboss/tools/docker-entrypoint.sh
if [ "$DB_VENDOR" != "h2" ]; then
/bin/sh /opt/jboss/tools/databases/change-database.sh $DB_VENDOR
fi
Help and Documentation
The documentation might be found in the docs directory.
Reporting Security Vulnerabilities
If you've found a security vulnerability, please look at the instructions on how to properly report it
Reporting an issue
If you believe you have discovered a defect in the Keycloak Operator please open an issue in our Issue Tracker.
Please remember to provide a good summary, description as well as steps to reproduce the issue.
Supported Custom Resources
CustomResourceDefinition |
Description |
Keycloak |
Manages, installs and configures Keycloak on the cluster |
KeycloakRealm |
Represents a realm in a keycloak server |
KeycloakClient |
Represents a client in a keycloak server |
KeycloakBackup |
Manage Keycloak database backups |
Deploying to a Cluster
Note: You will need a running Kubernetes or OpenShift cluster to use the Operator
- Run
make cluster/prepare
# This will apply the necessary Custom Resource Definitions (CRDs) and RBAC rules to the clusters
- Run
kubectl apply -f deploy/operator.yaml
# This will start the operator in the current namespace
Creating Keycloak Instance
Once the CRDs and RBAC rules are applied and the operator is running. Use the examples from the operator.
- Run
kubectl apply -f deploy/examples/keycloak/keycloak.yaml
Building from Source
To build from source refer to the building and working with the code base guide.
Components versions
Keycloak Operator supports the following version of key components:
Component |
Version/Tag |
Keycloak |
jboss/keycloak:7.0.1 |
Postgresql |
9.5 |
Contributing
Before contributing to Gatekeeper please read our contributing guidelines.
Other Keycloak Projects
License