Skip to content

Commit b28d8a4

Browse files
authored
feat: Support configuring JVM arguments (#532)
* Add field to CRD * Impl history server * Add test * cargo fmt * Implement stuff for SparkApplication * fix: Use spaces * Fix tests * Fix endless reconcile loop * changelog * docs * Remove unused import * Update error message * Update ring because of RUSTSEC-2025-0009
1 parent ab39eb2 commit b28d8a4

File tree

14 files changed

+556
-150
lines changed

14 files changed

+556
-150
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
1010
config property `requestedSecretLifetime`. This helps reducing frequent Pod restarts ([#501]).
1111
- Run a `containerdebug` process in the background of each Spark container to collect debugging information ([#508]).
1212
- Aggregate emitted Kubernetes events on the CustomResources ([#515]).
13+
- Support configuring JVM arguments ([#532]).
1314

1415
### Changed
1516

@@ -19,6 +20,7 @@ All notable changes to this project will be documented in this file.
1920
[#508]: https://github.com/stackabletech/spark-k8s-operator/pull/508
2021
[#514]: https://github.com/stackabletech/spark-k8s-operator/pull/514
2122
[#515]: https://github.com/stackabletech/spark-k8s-operator/pull/515
23+
[#532]: https://github.com/stackabletech/spark-k8s-operator/pull/532
2224

2325
## [24.11.1] - 2025-01-10
2426

Cargo.lock

Lines changed: 3 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/helm/spark-k8s-operator/crds/crds.yaml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,32 @@ spec:
256256
default: {}
257257
description: '`envOverrides` configure environment variables to be set in the Pods. It is a map from strings to strings - environment variables and the value to set. Read the [environment variable overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#env-overrides) for more information and consult the operator specific usage guide to find out about the product specific environment variables that are available.'
258258
type: object
259+
jvmArgumentOverrides:
260+
default:
261+
add: []
262+
remove: []
263+
removeRegex: []
264+
description: Allows overriding JVM arguments. Please read on the [JVM argument overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#jvm-argument-overrides) for details on the usage.
265+
properties:
266+
add:
267+
default: []
268+
description: JVM arguments to be added
269+
items:
270+
type: string
271+
type: array
272+
remove:
273+
default: []
274+
description: JVM arguments to be removed by exact match
275+
items:
276+
type: string
277+
type: array
278+
removeRegex:
279+
default: []
280+
description: JVM arguments matching any of this regexes will be removed
281+
items:
282+
type: string
283+
type: array
284+
type: object
259285
podOverrides:
260286
default: {}
261287
description: In the `podOverrides` property you can define a [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) for more information.
@@ -530,6 +556,32 @@ spec:
530556
default: {}
531557
description: '`envOverrides` configure environment variables to be set in the Pods. It is a map from strings to strings - environment variables and the value to set. Read the [environment variable overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#env-overrides) for more information and consult the operator specific usage guide to find out about the product specific environment variables that are available.'
532558
type: object
559+
jvmArgumentOverrides:
560+
default:
561+
add: []
562+
remove: []
563+
removeRegex: []
564+
description: Allows overriding JVM arguments. Please read on the [JVM argument overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#jvm-argument-overrides) for details on the usage.
565+
properties:
566+
add:
567+
default: []
568+
description: JVM arguments to be added
569+
items:
570+
type: string
571+
type: array
572+
remove:
573+
default: []
574+
description: JVM arguments to be removed by exact match
575+
items:
576+
type: string
577+
type: array
578+
removeRegex:
579+
default: []
580+
description: JVM arguments matching any of this regexes will be removed
581+
items:
582+
type: string
583+
type: array
584+
type: object
533585
podOverrides:
534586
default: {}
535587
description: In the `podOverrides` property you can define a [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) for more information.
@@ -620,6 +672,32 @@ spec:
620672
default: {}
621673
description: '`envOverrides` configure environment variables to be set in the Pods. It is a map from strings to strings - environment variables and the value to set. Read the [environment variable overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#env-overrides) for more information and consult the operator specific usage guide to find out about the product specific environment variables that are available.'
622674
type: object
675+
jvmArgumentOverrides:
676+
default:
677+
add: []
678+
remove: []
679+
removeRegex: []
680+
description: Allows overriding JVM arguments. Please read on the [JVM argument overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#jvm-argument-overrides) for details on the usage.
681+
properties:
682+
add:
683+
default: []
684+
description: JVM arguments to be added
685+
items:
686+
type: string
687+
type: array
688+
remove:
689+
default: []
690+
description: JVM arguments to be removed by exact match
691+
items:
692+
type: string
693+
type: array
694+
removeRegex:
695+
default: []
696+
description: JVM arguments matching any of this regexes will be removed
697+
items:
698+
type: string
699+
type: array
700+
type: object
623701
podOverrides:
624702
default: {}
625703
description: In the `podOverrides` property you can define a [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) for more information.
@@ -1416,6 +1494,32 @@ spec:
14161494
default: {}
14171495
description: '`envOverrides` configure environment variables to be set in the Pods. It is a map from strings to strings - environment variables and the value to set. Read the [environment variable overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#env-overrides) for more information and consult the operator specific usage guide to find out about the product specific environment variables that are available.'
14181496
type: object
1497+
jvmArgumentOverrides:
1498+
default:
1499+
add: []
1500+
remove: []
1501+
removeRegex: []
1502+
description: Allows overriding JVM arguments. Please read on the [JVM argument overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#jvm-argument-overrides) for details on the usage.
1503+
properties:
1504+
add:
1505+
default: []
1506+
description: JVM arguments to be added
1507+
items:
1508+
type: string
1509+
type: array
1510+
remove:
1511+
default: []
1512+
description: JVM arguments to be removed by exact match
1513+
items:
1514+
type: string
1515+
type: array
1516+
removeRegex:
1517+
default: []
1518+
description: JVM arguments matching any of this regexes will be removed
1519+
items:
1520+
type: string
1521+
type: array
1522+
type: object
14191523
podOverrides:
14201524
default: {}
14211525
description: In the `podOverrides` property you can define a [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) for more information.
@@ -1636,6 +1740,32 @@ spec:
16361740
default: {}
16371741
description: '`envOverrides` configure environment variables to be set in the Pods. It is a map from strings to strings - environment variables and the value to set. Read the [environment variable overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#env-overrides) for more information and consult the operator specific usage guide to find out about the product specific environment variables that are available.'
16381742
type: object
1743+
jvmArgumentOverrides:
1744+
default:
1745+
add: []
1746+
remove: []
1747+
removeRegex: []
1748+
description: Allows overriding JVM arguments. Please read on the [JVM argument overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#jvm-argument-overrides) for details on the usage.
1749+
properties:
1750+
add:
1751+
default: []
1752+
description: JVM arguments to be added
1753+
items:
1754+
type: string
1755+
type: array
1756+
remove:
1757+
default: []
1758+
description: JVM arguments to be removed by exact match
1759+
items:
1760+
type: string
1761+
type: array
1762+
removeRegex:
1763+
default: []
1764+
description: JVM arguments matching any of this regexes will be removed
1765+
items:
1766+
type: string
1767+
type: array
1768+
type: object
16391769
podOverrides:
16401770
default: {}
16411771
description: In the `podOverrides` property you can define a [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) for more information.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,18 @@ spec:
148148

149149
The Spark operator also supports Pod overrides, allowing you to override any property that you can set on a Kubernetes Pod.
150150
Read the xref:concepts:overrides.adoc#pod-overrides[Pod overrides documentation] to learn more about this feature.
151+
152+
== JVM argument overrides
153+
154+
Stackable operators automatically determine the set of needed JVM arguments, such as memory settings or trust- and keystores.
155+
Using JVM argument overrides you can configure the JVM arguments xref:concepts:overrides.adoc#jvm-argument-overrides[according to the concepts page].
156+
157+
=== Spark application
158+
159+
WARNING: Please note that you can currently not configure the JVM arguments of the spark-submit call, only on the drivers and executors.
160+
161+
The JVM arguments will be passed via `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions`.
162+
163+
=== History server
164+
165+
JVM arguments can be configured normally and will be passed via the env variable `SPARK_HISTORY_OPTS`.

docs/modules/spark-k8s/partials/nav.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
** xref:spark-k8s:usage-guide/logging.adoc[]
1111
** xref:spark-k8s:usage-guide/history-server.adoc[]
1212
** xref:spark-k8s:usage-guide/examples.adoc[]
13-
** xref:spark-k8s:usage-guide/configuration-environment-overrides.adoc[]
13+
** xref:spark-k8s:usage-guide/overrides.adoc[]
1414
** xref:spark-k8s:usage-guide/operations/index.adoc[]
1515
*** xref:spark-k8s:usage-guide/operations/applications.adoc[]
1616
*** xref:spark-k8s:usage-guide/operations/pod-placement.adoc[]

0 commit comments

Comments
 (0)