codecentric / helm-charts

A curated set of Helm charts brought to you by codecentric

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error multiple primary keys constraint in Keycloak using YugabyteDB

sathishc58 opened this issue · comments

We have got the following stack and deploy Keycloak helm-chart (using Yugabyte DB) through Terraform

Cloud       - Azure
K8S Version - 1.27.3
Keycloak    - Helm Chart

and it failed with the following error

Error Message:

base info: {databaseUrl=jdbc:postgresql://yugabyte.svc.cluster.local:5432/postgres, databaseUser=keycloak, databaseProduct=PostgreSQL 11.2-YB-2.19.0.0-b0, databaseDriver=PostgreSQL JDBC Driver 42.2.5}
INFO  [org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider] (ServerService Thread Pool -- 62) Updating database. Using changelog META-INF/jpa-changelog-master.xml
ERROR [org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider] (ServerService Thread Pool -- 62) Error has occurred while updating the database: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set META-INF/jpa-changelog-3.4.0.xml::3.4.0::keycloak:
     Reason: liquibase.exception.DatabaseException: ERROR: multiple primary keys for table "realm_default_roles" are not allowed [Failed SQL: (0) ALTER TABLE public.REALM_DEFAULT_ROLES ADD CONSTRAINT CONSTRAINT_REALM_DEFAULT_ROLES PRIMARY KEY (REALM_ID, ROLE_ID)]```

I am running out of ideas as how this should be resolved and keycloak works fine on K8S version 1.23 and 1.24

This issue has been marked as stale because it has been open for 30 days with no activity. It will be automatically closed in 10 days if no further activity occurs.