Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add how-to for migrating from LDAP to Keycloak authentication #184

Draft
wants to merge 1 commit into
base: feat/keycloak-login
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
= Migrate cluster from LDAP to Keycloak authentication

[abstract]
--
Steps to migrate an existing OpenShift 4 cluster from LDAP to Keycloak authentication.
--

== Starting situation

* You have an existing OpenShift 4 cluster which is setup with LDAP authentication
* You have access to create a new Keycloak client on https://id.vshn.net[id.vshn.net]

== Prerequisites

* `yq` https://mikefarah.gitbook.io/yq[yq YAML processor] (version 4 or higher)
* `commodore`

== Set up Keycloak client

include::partial$setup-keycloak-client.adoc[]

== Update cluster configuration

. Compile cluster
+
[source,bash]
----
export CLUSTER_ID=c-cluster-id-1234 <1>
commodore catalog compile "${CLUSTER_ID}"
----
<1> Replace with the Lieutenant ID of the cluster you're migrating

. Update cluster to use `keycloak` as the IDP
+
[source,bash]
----
export TENANT_ID=$(yq e '.parameters.cluster.tenant' inventory/classes/params/cluster.yml)

pushd inventory/classes/${TENANT_ID}

yq eval -i ".parameters.openshift.idp = \"keycloak\"" \
${CLUSTER_ID}.yml
yq eval -i ".parameters.vshnKeycloak.clientId = \"${KEYCLOAK_CLIENT_ID}\"" \
${CLUSTER_ID}.yml

git commit -am"Configure Keycloak authentication for ${CLUSTER_ID}"
git push origin master

popd
----
+
TIP: You can also completely remove `.parameters.openshift.idp`, as the Commodore global defaults set the parameter to `keycloak`.

. Set the Keycloak client secret in Vault
+
include::partial$connect-to-vault.adoc[]
+
[source,bash]
----
# Set the Keycloak client secret
vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/oidc/vshn-keycloak \
clientSecret=${KEYCLOAK_CLIENT_SECRET}
----

. Compile and push cluster catalog
+
[source,bash]
----
commodore catalog compile --push -i
----

== Verify migration

. Check rollout of the changes in ArgoCD on the cluster

. Once rollout is complete, verify that you get redirected to id.vshn.net when logging in to the cluster.
1 change: 1 addition & 0 deletions docs/modules/ROOT/partials/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
** xref:oc4:ROOT:how-tos/authentication/disable-access.adoc[Disable per cluster access]
** xref:oc4:ROOT:how-tos/authentication/disable-self-provisioning.adoc[Disable project self-provisioning]
** xref:oc4:ROOT:explanations/sudo.adoc[]
** xref:oc4:ROOT:how-tos/authentication/migrate-ldap-keycloak.adoc[Migrate cluster from LDAP to Keycloak authentication]

* Networking
** xref:oc4:ROOT:how-tos/network/migrate-to-cilium.adoc[]
Expand Down