Aftab
Aftab

Reputation: 2963

How to use custom themes on Keycloak Operator deployment on Kubernetes?

I installed Keycloak using Operator (version 12.0.1). It's using the repository github repository Everything worked seamlessly. A keycloak instance has been launched and I could log in using admin credentials. I could see a realm, clients, users, etc working as expected.

But I do have a custom theme that I want to use it. For that, I make the following changes in my-realm.yaml.

apiVersion: keycloak.org/v1alpha1
kind: Keycloak
metadata:
  name: my-keycloak
  labels:
    app: my-keycloak
spec:
  instances: 1
  extensions:
    - https://github.com/aerogear/keycloak-metrics-spi/releases/download/1.0.4/keycloak-metrics-spi-1.0.4.jar
  externalAccess:
    enabled: False
  podDisruptionBudget:
    enabled: True
---
apiVersion: keycloak.org/v1alpha1
kind: KeycloakRealm
metadata:
  name: my-realm
  labels:
    app: my-realm
spec:
  realm:
    id: "my"
    realm: "my"
    enabled: True
    registrationEmailAsUsername: True
    accountTheme: "account-theme"       // THEMES
    adminTheme: "admin-theme"           // THEMES
    emailTheme: "email-theme"           // THEMES
    loginTheme: "login-theme"           // THEMES
    users:
      - username: "[email protected]"
        firstName: "Service"
        lastName: "Account"
  instanceSelector:
    matchLabels:
      app: my-keycloak

But, I didn't see any of the themes in my realms/my-realm/theme-settings. I can see only the default theme in the select box (i.e. keycloak, base). I am expecting account-theme, admin-theme, email-theme, login-theme in their respective select boxes.

Am I missing something here?

Upvotes: 3

Views: 1664

Answers (1)

dreamcrash
dreamcrash

Reputation: 51473

But, I didn't see any of the themes in my realms/my-realm/theme-settings. I can see only the default theme in the select box (i.e. keycloak, base). I am expecting account-theme, admin-theme, email-theme, login-theme in their respective select boxes.

The problem is/was that -- until yesterday the 26th of January of 2021, commit f2d0370290d6abe91724b2536748aa6b1245d1e1 (pull request #284) -- by default the Keycloak Operator did not recognize the Theme-related fields (i.e., accountTheme, adminTheme, emailTheme, loginTheme).

This feature was not deployed on the current latest release (12.0.2), however it is available of master. So you can go from there.

Upvotes: 2

Related Questions