keycloak-containers icon indicating copy to clipboard operation
keycloak-containers copied to clipboard

Problems with setting POD ENV: JGROUPS_DISCOVERY_PROPERTIES with namespace+labels

Open devopstom-user opened this issue 2 years ago • 1 comments

Describe the bug

Hey!

it's either parsing bug or I'm doing something wrong but can't seem to find a way to pass both namespace and labels to select only subset of k8s PODs to form HA cluster. The following cfg:

        - name: JGROUPS_DISCOVERY_PROPERTIES
          value: 'namespace=test-keycloak,labels=app=test-keycloak-blue'

seem gets wrongly parsed i.e. = changes to => for entire thing, and then it obviously fails the HTTP request as well after URL encoding it: JGroups discovery to kubernetes.KUBE_PING with properties {namespace=>test-keycloak,labels=>app=>test-keycloak-blue} (...) WARN [org.jgroups.protocols.kubernetes.KUBE_PING] (ServerService Thread Pool -- 58) failed getting JSON response from Kubernetes Client[masterUrl=https://10.96.0.1:443/api/v1, headers={Authorization=#MASKED:947#}, connectTimeout=5000, readTimeout=30000, operationAttempts=3, operationSleep=1000, streamProvider=org.jgroups.protocols.kubernetes.stream.TokenStreamProvider@7690a9ce] for cluster [ejb], namespace [test-keycloak], labels [app=>test-keycloak-blue]; encountered [java.lang.Exception: 3 attempt(s) with a 1000ms sleep to execute [OpenStream] failed. Last failure was [java.io.IOException: Server returned HTTP response code: 400 for URL: https://10.96.0.1:443/api/v1/namespaces/test-keycloak/pods?labelSelector=app%3D%3Etest-keycloak-blue]] `

Version

v15.0.2

Expected behavior

The parsing should result in: JGroups discovery to kubernetes.KUBE_PING with properties {namespace=>test-keycloak,labels=>app=test-keycloak-blue}

Actual behavior

The parsing results in: JGroups discovery to kubernetes.KUBE_PING with properties {namespace=>test-keycloak,labels=>app=>test-keycloak-blue}

How to Reproduce?

add ENV var onto the pods with namespace + labels:

        - name: JGROUPS_DISCOVERY_PROPERTIES
          value: 'namespace=test-keycloak,labels=app=test-keycloak-blue'

Anything else?

No response

devopstom-user avatar Apr 01 '22 10:04 devopstom-user

You can pass another env variable like: - name: KUBERNETES_LABELS value: app=test-keycloak-blue

ndsnas avatar Apr 24 '22 13:04 ndsnas

With Keycloak 20 the WildFly based distribution is no longer supported. For the newer Quarkus distribution of Keycloak, check out the new documentation, or the updated container sources.

stianst avatar Oct 24 '22 07:10 stianst