如何在 Kubernetes 上的 Keycloak Operator 部署中使用自定义主题?

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

我使用 Operator (version 12.0.1). It's using the repository github repository 安装了 Keycloak,一切运行顺畅。一个 keycloak 实例已经启动,我可以使用管理员凭据登录。我可以看到领域、客户、用户等按预期工作。

但我确实有一个自定义主题,我想使用它。为此,我在 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: "aftab@x.com"
        firstName: "Service"
        lastName: "Account"
  instanceSelector:
    matchLabels:
      app: my-keycloak

但是,我在 realms/my-realm/theme-settings 中没有看到任何主题。我只能在 select 框中看到默认主题(即 keycloak、base)。我期待 account-themeadmin-themeemail-themelogin-theme 在各自的 select 框中。

我是不是漏掉了什么?

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.

问题 is/was - 直到 yesterday the 26th of January of 2021, commit f2d0370290d6abe91724b2536748aa6b1245d1e1 (pull request #284) - 默认情况下,Keycloak Operator 无法识别与主题相关的字段(即, accountThemeadminThemeemailThemeloginTheme).

此功能未部署在当前最新版本 (12.0.2) 上,但主版本可用。所以你可以从那里开始。