Skip to content

Add concepts page on JVM argument overrides #697

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

Merged
merged 5 commits into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions modules/concepts/pages/overrides.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,72 @@ The `podOverrides` will be merged onto the following resources the operators dep
They will *not* be applied to:

* Jobs, that are used to setup systems the product depends on e.g. create a database schema for Superset or Airflow.

[#jvm-argument-overrides]
== JVM argument overrides

You can configure the JVM arguments used by JVM based tools.
This is often needed to e.g. configure a HTTP proxy or other network settings.

As with other overrides, the operator generates a set of JVM arguments that are needed to run the tool. You can specify additional arguments which are merged on top of the ones the operator generated.
As some JVM arguments are mutually exclusive (think of `-Xmx123m` and `-Xmx456m`), you also have the option to remove JVM arguments - either by specifying the exact argument or a regex.

The merging mechanism is applied <operator generated> <- <role user specified> <- <rolegroup user specified> and works as follows:

1. All arguments listed in user specified `remove` are removed from operator generated
2. All arguments matching any regex from user removeRegex are removed from operator generated.
The regex needs to match the entire argument, not only a substring
3. All arguments from user specified `add` are added to operator

You can check the resulting effective JVM arguments by looking at the ConfigMap containing the config for the roleGroup (although some tools read the JVM arguments from environmental variables).

=== Simple example

One simple usage of this functionality is to add some JVM arguments, in this case needed for a special network setup:

[source,yaml]
----
kind: NifiCluster
spec:
# ...
nodes:
jvmArgumentOverrides:
add: # Add some networking arguments
- -Dhttps.proxyHost=proxy.my.corp
- -Dhttps.proxyPort=8080
- -Djava.net.preferIPv4Stack=true
----

=== Advanced example

The following more advanced setups shows how the garbage collector can be changed, the JVM memory configs can be changed and how roleGroups can override roles.

[source,yaml]
----
kind: NifiCluster
spec:
# ...
nodes:
config:
resources:
memory:
limit: 42Gi # We define some memory config, so that we can override it further down
jvmArgumentOverrides:
remove:
- -XX:+UseG1GC # Remove argument generated by operator
add: # Add some networking arguments
- -Dhttps.proxyHost=proxy.my.corp
- -Dhttps.proxyPort=8080
- -Djava.net.preferIPv4Stack=true
roleGroups:
default:
replicas: 1
jvmArgumentOverrides:
# We need more memory!
removeRegex: # They need to match the entire string, not only a part!
- -Xmx.* # So this will match "-Xmx123m", but not "-foo-Xmx123m"
- -Dhttps.proxyPort=.* # Remove arguments from the role, so that we can override it
add: # After we removed some arguments we can add the correct ones
- -Xmx40000m
- -Dhttps.proxyPort=1234 # Override arguments from the role
----
Loading