Skip to content

Commit

Permalink
Adding FD_SOCK2 -> FD_SOCK workaround
Browse files Browse the repository at this point in the history
Closes #439
  • Loading branch information
ahus1 committed Jul 24, 2023
1 parent d35e06b commit 4d82ffd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions provision/minikube/keycloak/config/kcb-infinispan-cache-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@
xsi:schemaLocation="urn:infinispan:config:14.0 https://www.infinispan.org/schemas/infinispan-config-14.0.xsd"
xmlns="urn:infinispan:config:14.0">

<!-- Workaround for https://github.com/keycloak/keycloak/issues/21092 -->
<jgroups>
<stack name="kubernetes-with-fdsock" extends="kubernetes">
<!-- When using an embedded stack, replacement is done by Infinispan which requires environment variables to be
prefixed with ".env", while JGroups falls back to environment variables without the prefix.
The Keycloak Operator passes this information in an enviornment variable `jgroups.dns.query`.
See https://github.com/keycloak/keycloak/issues/21830 for a discussion.
-->
<dns.DNS_PING dns_query="${env.jgroups.dns.query}" />
<!-- Workaround for problems with FD_SOCK2, which might fail when the other nodes are not ready yet.
See https://github.com/keycloak/keycloak/issues/21092 -->
<FD_SOCK stack.combine="REPLACE" stack.position="FD_SOCK2"/>
</stack>
</jgroups>

<!-- the statistics="true" attribute is not part of the original KC config and was added by Keycloak Benchmark -->
<cache-container name="keycloak" statistics="true">
<transport lock-timeout="60000"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@
urn:infinispan:config:store:remote:14.0 https://www.infinispan.org/schemas/infinispan-cachestore-remote-config-14.0.xsd"
xmlns="urn:infinispan:config:14.0">

<!-- Workaround for https://github.com/keycloak/keycloak/issues/21092 -->
<jgroups>
<stack name="kubernetes-with-fdsock" extends="kubernetes">
<!-- When using an embedded stack, replacement is done by Infinispan which requires environment variables to be
prefixed with ".env", while JGroups falls back to environment variables without the prefix.
The Keycloak Operator passes this information in an enviornment variable `jgroups.dns.query`.
See https://github.com/keycloak/keycloak/issues/21830 for a discussion.
-->
<dns.DNS_PING dns_query="${env.jgroups.dns.query}" />
<!-- Workaround for problems with FD_SOCK2, which might fail when the other nodes are not ready yet.
See https://github.com/keycloak/keycloak/issues/21092 -->
<FD_SOCK stack.combine="REPLACE" stack.position="FD_SOCK2"/>
</stack>
</jgroups>

<!-- the statistics="true" attribute is not part of the original KC config and was added by Keycloak Benchmark -->
<cache-container name="keycloak" statistics="true">
<transport lock-timeout="60000" site="ISPN"/>
Expand Down
3 changes: 3 additions & 0 deletions provision/minikube/keycloak/templates/keycloak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ spec:
haproxy.router.openshift.io/disable_cookies: 'true'
{{end}}
additionalOptions:
# Workaround for https://github.com/keycloak/keycloak/issues/21092
- name: 'cache-stack'
value: kubernetes-with-fdsock
{{ if or (eq .Values.database "aurora-postgres") (eq .Values.database "postgres") (eq .Values.database "postgres+infinispan") }}
- name: db
value: postgres
Expand Down

2 comments on commit 4d82ffd

@scila1996
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ahus1 . How can I generate cache-config.xml alternative this from a xsd schema ?

@ahus1
Copy link
Contributor Author

@ahus1 ahus1 commented on 4d82ffd Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scila1996 - when you extract the Keycloak Quarkus distribution, you'll find a file cache-ispn.xml. Add the jgroups block to it, and you'll have your configuration with the new stack. Then reference the new cache stack with the cache-stack parameter.

Please sign in to comment.