Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator doesn't pass on system property 'jgroups.dns.query' to Keycloak but an env variable, leading to a warning in the log #21830

Closed
2 tasks done
ahus1 opened this issue Jul 19, 2023 · 0 comments · Fixed by #24057
Assignees
Labels
area/operator Keycloak.X Operator kind/bug Categorizes a PR related to a bug team/cloud-native
Milestone

Comments

@ahus1
Copy link
Contributor

ahus1 commented Jul 19, 2023

Before reporting an issue

Area

operator

Describe the bug

To configure discovery for Infinispan on Kubernetes, the docs as for the jgroups.dns.query to be added as a Java System Property using -D.... Instead the Operator passes an environment variable which leads to a warning.

Version

main

Expected behavior

No warning logged.

Actual behavior

Warning logged by Infinispan, which is misleading and wrong, as it is evaluated by JGroups in a second step:

ISPN000901: Property jgroups.dns.query could not be replaced as intended!

This is what is happening:

The Keycloak Operator set an environment variable jgroups.dns.query:

new EnvVarBuilder()
.withName("jgroups.dns.query")
.withValue(getName() + Constants.KEYCLOAK_DISCOVERY_SERVICE_SUFFIX +"." + getNamespace())
.build());

The environment variable is not visible inside of a shell, as shells ignore environment variable names which contain a dot. It is still there when I look at /proc/1/environ, and the Java process picks it up as it is started directly, and not from a shell.

After some debugging with @ryanemerson I found that Infinispan's StringPropertyReplacer doesn't look at environment variables and prints the warning, while JGroup's ProtocolConfiguration.substituteVariables calls Util.substituteVariable() which then takes into account the environment variables as well.

How to Reproduce?

Look at the logs of Keycloak started by the Operator in Kubernetes.

Anything else?

Looking at the JavaDoc of StringPropertyReplacer, environment variables need to be prefixed by env. to be replaced by Infinispan.

As we're using the default stacks and don't want to duplicate them, we can't use an environment variable.

The JAVA_OPTS shouldn't be overwritten, as it would overwrite all defaults in kc.sh. The JAVA_OPTS_APPEND is usually overwritten using the podTemplate, so if the Operator wants to use that path, it should only append that option there.

@ahus1 ahus1 added kind/bug Categorizes a PR related to a bug status/triage labels Jul 19, 2023
@ghost ghost added area/operator Keycloak.X Operator team/cloud-native labels Jul 19, 2023
@ahus1 ahus1 changed the title Operator doesn't pass on system property 'jgroups.dns.query' to Keycloak Operator doesn't pass on system property 'jgroups.dns.query' to Keycloak but an env variable, leading to a warning in the log Jul 19, 2023
@vmuzikar vmuzikar added this to the 23.0.0 milestone Aug 17, 2023
@shawkins shawkins self-assigned this Oct 10, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 17, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 17, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 17, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 17, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 18, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 18, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 18, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 18, 2023
shawkins added a commit to shawkins/keycloak that referenced this issue Oct 19, 2023
vmuzikar pushed a commit that referenced this issue Oct 20, 2023
* fix: moves jgroups.dns.query to a system property

closes #21830

* removing the dns query from import

* removing the dns query from import

also removing cache-stack
edewit pushed a commit to edewit/keycloak that referenced this issue Oct 23, 2023
* fix: moves jgroups.dns.query to a system property

closes keycloak#21830

* removing the dns query from import

* removing the dns query from import

also removing cache-stack
Yang-Xie-OSS pushed a commit to Hitachi/keycloak that referenced this issue Nov 21, 2023
* fix: moves jgroups.dns.query to a system property

closes keycloak#21830

* removing the dns query from import

* removing the dns query from import

also removing cache-stack
Yang-Xie-OSS pushed a commit to Hitachi/keycloak that referenced this issue Nov 22, 2023
* fix: moves jgroups.dns.query to a system property

closes keycloak#21830

* removing the dns query from import

* removing the dns query from import

also removing cache-stack
srose pushed a commit to srose/keycloak that referenced this issue Dec 20, 2023
* fix: moves jgroups.dns.query to a system property

closes keycloak#21830

* removing the dns query from import

* removing the dns query from import

also removing cache-stack
kamontat pushed a commit to kamontat/keycloak that referenced this issue Jan 20, 2024
* fix: moves jgroups.dns.query to a system property

closes keycloak#21830

* removing the dns query from import

* removing the dns query from import

also removing cache-stack

Signed-off-by: Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/operator Keycloak.X Operator kind/bug Categorizes a PR related to a bug team/cloud-native
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants