Skip to content

Commit 48a0a83

Browse files
committed
Add field to CRD
1 parent 23e1120 commit 48a0a83

File tree

5 files changed

+153
-13
lines changed

5 files changed

+153
-13
lines changed

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.

docs/modules/spark-k8s/pages/usage-guide/configuration-environment-overrides.adoc renamed to docs/modules/spark-k8s/pages/usage-guide/overrides.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,10 @@ 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+
TODO more docs

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[]

rust/operator-binary/src/crd/history.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use stackable_operator::{
2424
ValidatedRoleConfigByPropertyKind,
2525
},
2626
product_logging::{self, spec::Logging},
27-
role_utils::{GenericProductSpecificCommonConfig, Role, RoleGroup, RoleGroupRef},
27+
role_utils::{GenericRoleConfig, JavaCommonConfig, Role, RoleGroup, RoleGroupRef},
2828
schemars::{self, JsonSchema},
2929
time::Duration,
3030
};
@@ -51,6 +51,8 @@ pub enum Error {
5151

5252
#[versioned(version(name = "v1alpha1"))]
5353
pub mod versioned {
54+
use stackable_operator::role_utils::{GenericRoleConfig, JavaCommonConfig};
55+
5456
/// A Spark cluster history server component. This resource is managed by the Stackable operator
5557
/// for Apache Spark. Find more information on how to use it in the
5658
/// [operator documentation](DOCS_BASE_URL_PLACEHOLDER/spark-k8s/usage-guide/history-server).
@@ -86,7 +88,7 @@ pub mod versioned {
8688
pub spark_conf: BTreeMap<String, String>,
8789

8890
/// A history server node role definition.
89-
pub nodes: Role<HistoryConfigFragment>,
91+
pub nodes: Role<HistoryConfigFragment, GenericRoleConfig, JavaCommonConfig>,
9092
}
9193

9294
#[derive(Clone, Deserialize, Debug, Default, Eq, JsonSchema, PartialEq, Serialize)]
@@ -133,15 +135,15 @@ impl CurrentlySupportedListenerClasses {
133135

134136
impl v1alpha1::SparkHistoryServer {
135137
/// Returns a reference to the role. Raises an error if the role is not defined.
136-
pub fn role(&self) -> &Role<HistoryConfigFragment> {
138+
pub fn role(&self) -> &Role<HistoryConfigFragment, GenericRoleConfig, JavaCommonConfig> {
137139
&self.spec.nodes
138140
}
139141

140142
/// Returns a reference to the role group. Raises an error if the role or role group are not defined.
141143
pub fn rolegroup(
142144
&self,
143145
rolegroup_ref: &RoleGroupRef<Self>,
144-
) -> Result<RoleGroup<HistoryConfigFragment, GenericProductSpecificCommonConfig>, Error> {
146+
) -> Result<RoleGroup<HistoryConfigFragment, JavaCommonConfig>, Error> {
145147
self.spec
146148
.nodes
147149
.role_groups
@@ -207,7 +209,10 @@ impl v1alpha1::SparkHistoryServer {
207209
) -> Result<ValidatedRoleConfigByPropertyKind, Error> {
208210
let roles_to_validate: HashMap<
209211
String,
210-
(Vec<PropertyNameKind>, Role<HistoryConfigFragment>),
212+
(
213+
Vec<PropertyNameKind>,
214+
Role<HistoryConfigFragment, GenericRoleConfig, JavaCommonConfig>,
215+
),
211216
> = vec![(
212217
HISTORY_ROLE_NAME.to_string(),
213218
(

rust/operator-binary/src/crd/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ use stackable_operator::{
3737
ValidatedRoleConfigByPropertyKind,
3838
},
3939
product_logging,
40-
role_utils::{
41-
CommonConfiguration, GenericProductSpecificCommonConfig, GenericRoleConfig, Role, RoleGroup,
42-
},
40+
role_utils::{CommonConfiguration, GenericRoleConfig, JavaCommonConfig, Role, RoleGroup},
4341
schemars::{self, JsonSchema},
4442
time::Duration,
4543
utils::crds::raw_object_list_schema,
@@ -174,19 +172,19 @@ pub struct SparkApplicationSpec {
174172
/// The reason this property uses its own type (SubmitConfigFragment) is because logging is not
175173
/// supported for spark-submit processes.
176174
#[serde(default, skip_serializing_if = "Option::is_none")]
177-
pub job: Option<CommonConfiguration<SubmitConfigFragment, GenericProductSpecificCommonConfig>>,
175+
pub job: Option<CommonConfiguration<SubmitConfigFragment, JavaCommonConfig>>,
178176

179177
/// The driver role specifies the configuration that, together with the driver pod template, is used by
180178
/// Spark to create driver pods.
181179
#[serde(default, skip_serializing_if = "Option::is_none")]
182-
pub driver: Option<CommonConfiguration<RoleConfigFragment, GenericProductSpecificCommonConfig>>,
180+
pub driver: Option<CommonConfiguration<RoleConfigFragment, JavaCommonConfig>>,
183181

184182
/// The executor role specifies the configuration that, together with the driver pod template, is used by
185183
/// Spark to create the executor pods.
186184
/// This is RoleGroup instead of plain CommonConfiguration because it needs to allows for the number of replicas.
187185
/// to be specified.
188186
#[serde(default, skip_serializing_if = "Option::is_none")]
189-
pub executor: Option<RoleGroup<RoleConfigFragment, GenericProductSpecificCommonConfig>>,
187+
pub executor: Option<RoleGroup<RoleConfigFragment, JavaCommonConfig>>,
190188

191189
/// A map of key/value strings that will be passed directly to spark-submit.
192190
#[serde(default)]
@@ -829,7 +827,7 @@ impl v1alpha1::SparkApplication {
829827
}
830828
};
831829

832-
let executor_conf: RoleGroup<RoleConfigFragment, GenericProductSpecificCommonConfig> =
830+
let executor_conf: RoleGroup<RoleConfigFragment, JavaCommonConfig> =
833831
if self.spec.executor.is_some() {
834832
self.spec.executor.as_ref().unwrap().clone()
835833
} else {

0 commit comments

Comments
 (0)