OPERATOR KEYCLOAK keycloak-operator.v20.0.0-alpha.1 - ADD PROVIDERS IN KEYCLOAK INSTANCE

Hello,

In the previous version of the keycloak operator (WILDFLY 18.0.0), there was the extensions tag, to add the themes to the keycloak path.
Example:

apiVersion: keycloak.org/v1alpha1
kind: Keycloak
metadata:
  name: example-keycloak
  labels:
    app: keycloak 
  namespace: example-iam
spec:
  instances: 1
  extensions:
    - >-
      https://URL/keycloak-example-themes-1.0.0.jar
  externalAccess:
    enabled: false
  externalDatabase:
    enabled: true

Now in the latest version of the operator there is no such tag, and he found a solution; however, this configuration is “unsupported” in production.

apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
  name: example-keycloak
  namespace: example-iam
  labels:
    app: keycloak
spec:
  hostname: keycloak.example.com
  instances: 1
  serverConfiguration:
    - name: db
      value: postgres
    - name: db-url-host
      secret:
        key: POSTGRES_EXTERNAL_ADDRESS
        name: keycloak-db-secret
    - name: db-url-port
      secret:
        key: POSTGRES_EXTERNAL_PORT
        name: keycloak-db-secret
    - name: db-username
      secret:
        key: POSTGRES_USERNAME
        name: keycloak-db-secret
    - name: db-password
      secret:
        key: POSTGRES_PASSWORD
        name: keycloak-db-secret
    - name: proxy
      value: passthrough
  tlsSecret: example-tls-secret
  unsupported:
    podTemplate:
      metadata:
        labels:
          app: keycloak
          my-label: keycloak
      spec:
        containers:
          - volumeMounts:
              - mountPath: /opt/keycloak/providers
                name: providers-volume
        volumes:
          - name: providers-volume
            persistentVolumeClaim:
              claimName: keycloak-providers-claim

Is there an alternative to add these providers from the keycloak instance configuration of the keycloak-operator.v20.0.0-alpha.1 operator that is compatible.

**unsupported** object
In this section you can configure podTemplate advanced features, not production-ready, and not supported settings.
Use at your own risk and open an issue with your use-case if you don't find an alternative way.

Thank you in advance for your help.

The solution that worked for me

We first place the custom theme jar in s3 bucket or azure blob storage with public access url. The jar is downloaded and placed in providers folder during startup using init containers


apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
  name: example-keycloak
  namespace: example-iam
  labels:
    app: keycloak
spec:
  hostname: keycloak.example.com
  instances: 1
  serverConfiguration:
    - name: db
      value: postgres
    - name: db-url-host
      secret:
        key: POSTGRES_EXTERNAL_ADDRESS
        name: keycloak-db-secret
    - name: db-url-port
      secret:
        key: POSTGRES_EXTERNAL_PORT
        name: keycloak-db-secret
    - name: db-username
      secret:
        key: POSTGRES_USERNAME
        name: keycloak-db-secret
    - name: db-password
      secret:
        key: POSTGRES_PASSWORD
        name: keycloak-db-secret
    - name: proxy
      value: passthrough
  tlsSecret: example-tls-secret
  unsupported:
	podTemplate:
	  metadata:
		labels:
		  app: keycloak
	  spec:
		containers:
		 - volumeMounts:
			- mountPath: /opt/keycloak/providers
			  name: providers-dir
		initContainers:
		  - name: install-custom-theme
			image: alpine/curl:3.14
			command:
			- curl
			- "-H"
			- "Accept: application/zip"
			- https://<s3-url-to-custom-theme>/custom-theme.jar>
			- "-o"
			- "/providers/custom-theme.jar"
			volumeMounts:
			- name: providers-dir
			  mountPath: "/providers"
		volumes:
		   - name: providers-dir
			 emptyDir: {}