Skip to content

Commit 3802141

Browse files
razvanadwk67
andauthored
Use the CommonConfiguration structure for roles. (#277)
* wip * Re-add pod overrides for the submit pod. * Unify driver and executor configurations. * Successful smoke tests. * Rename config structs. * smoke tests pass on kind. * Refactor, cleanup and split configuration between driver and executor again. * Update docs, examples and changelog. * fix typo * Move replicas under spec.executor.config in tests and examples. * Clean up tests. * Apply suggestions * Remove old node selector struct * Added module doc for roles.rs * Use RoleGroup for executors to make replicas on the same level as executor configuration. * Update tests with "replicas" directly under "executor". * Update docs/examples with "replicas" directly under "executor". * Update rust/crd/src/roles.rs Co-authored-by: Andrew Kenworthy <[email protected]> * Implement review feedback. --------- Co-authored-by: Andrew Kenworthy <[email protected]>
1 parent f50ad32 commit 3802141

40 files changed

+2289
-2087
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ All notable changes to this project will be documented in this file.
1515
- `operator-rs` `0.44.0` -> `0.48.0` ([#267], [#275]).
1616
- Removed usages of SPARK_DAEMON_JAVA_OPTS since it's not a reliable way to pass extra JVM options ([#272]).
1717
- [BREAKING] use product image selection instead of version ([#275]).
18+
- BREAKING refactored application roles to use `CommonConfiguration` structures from the operator framework ([#277]).
1819

1920
[#267]: https://github.com/stackabletech/spark-k8s-operator/pull/267
2021
[#268]: https://github.com/stackabletech/spark-k8s-operator/pull/268
2122
[#269]: https://github.com/stackabletech/spark-k8s-operator/pull/269
2223
[#272]: https://github.com/stackabletech/spark-k8s-operator/pull/272
2324
[#275]: https://github.com/stackabletech/spark-k8s-operator/pull/275
25+
[#277]: https://github.com/stackabletech/spark-k8s-operator/pull/277
2426

2527
## [23.7.0] - 2023-07-14
2628

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ strum = { version = "0.25", features = ["derive"] }
2626
tokio = { version = "1.29", features = ["full"] }
2727
tracing = "0.1"
2828
tracing-futures = { version = "0.2", features = ["futures-03"] }
29+
indoc = "2"
2930

3031
# [patch."https://github.com/stackabletech/operator-rs.git"]
3132
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }

deploy/config-spec/properties.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ properties:
1717
- fromVersion: "0.0.0"
1818
value: "30"
1919
roles:
20-
- name: "node"
20+
- name: "submit"
21+
required: true
22+
- name: "driver"
23+
required: true
24+
- name: "executor"
2125
required: true
2226
asOfVersion: "0.0.0"
2327
comment: "History server - TTL for successfully resolved domain names."
@@ -36,7 +40,11 @@ properties:
3640
- fromVersion: "0.0.0"
3741
value: "0"
3842
roles:
39-
- name: "node"
43+
- name: "submit"
44+
required: true
45+
- name: "driver"
46+
required: true
47+
- name: "executor"
4048
required: true
4149
asOfVersion: "0.0.0"
4250
comment: "History server - TTL for domain names that cannot be resolved."

deploy/helm/spark-k8s-operator/configs/properties.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ properties:
1717
- fromVersion: "0.0.0"
1818
value: "30"
1919
roles:
20-
- name: "node"
20+
- name: "submit"
21+
required: true
22+
- name: "driver"
23+
required: true
24+
- name: "executor"
2125
required: true
2226
asOfVersion: "0.0.0"
2327
comment: "History server - TTL for successfully resolved domain names."
@@ -36,7 +40,11 @@ properties:
3640
- fromVersion: "0.0.0"
3741
value: "0"
3842
roles:
39-
- name: "node"
43+
- name: "submit"
44+
required: true
45+
- name: "driver"
46+
required: true
47+
- name: "executor"
4048
required: true
4149
asOfVersion: "0.0.0"
4250
comment: "History server - TTL for domain names that cannot be resolved."

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

Lines changed: 1088 additions & 1011 deletions
Large diffs are not rendered by default.

docs/modules/spark-k8s/examples/example-history-app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ spec:
3232
credentials:
3333
secretClass: history-credentials-class # <6>
3434
executor:
35-
instances: 1
35+
replicas: 1

docs/modules/spark-k8s/examples/example-sparkapp-configmap.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ spec:
2020
sparkConf:
2121
"spark.hadoop.fs.s3a.aws.credentials.provider": "org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider"
2222
driver:
23-
volumeMounts:
24-
- name: cm-job-arguments # <6>
25-
mountPath: /arguments # <7>
23+
config:
24+
volumeMounts:
25+
- name: cm-job-arguments # <6>
26+
mountPath: /arguments # <7>
2627
executor:
27-
instances: 3
28-
volumeMounts:
29-
- name: cm-job-arguments # <6>
30-
mountPath: /arguments # <7>
28+
replicas: 3
29+
config:
30+
volumeMounts:
31+
- name: cm-job-arguments # <6>
32+
mountPath: /arguments # <7>

docs/modules/spark-k8s/examples/example-sparkapp-external-dependencies.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ spec:
2424
persistentVolumeClaim:
2525
claimName: pvc-ksv
2626
driver:
27-
volumeMounts:
28-
- name: job-deps
29-
mountPath: /dependencies # <6>
27+
config:
28+
volumeMounts:
29+
- name: job-deps
30+
mountPath: /dependencies # <6>
3031
executor:
31-
instances: 3
32-
volumeMounts:
33-
- name: job-deps
34-
mountPath: /dependencies # <6>
32+
replicas: 3
33+
config:
34+
volumeMounts:
35+
- name: job-deps
36+
mountPath: /dependencies # <6>

docs/modules/spark-k8s/examples/example-sparkapp-image.yaml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,27 @@ spec:
1919
sparkConf: # <5>
2020
"spark.hadoop.fs.s3a.aws.credentials.provider": "org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider"
2121
job:
22-
resources:
23-
cpu:
24-
min: "1"
25-
max: "1"
26-
memory:
27-
limit: "1Gi"
22+
config:
23+
resources:
24+
cpu:
25+
min: "1"
26+
max: "1"
27+
memory:
28+
limit: "1Gi"
2829
driver:
29-
resources:
30-
cpu:
31-
min: "1"
32-
max: "1500m"
33-
memory:
34-
limit: "1Gi"
30+
config:
31+
resources:
32+
cpu:
33+
min: "1"
34+
max: "1500m"
35+
memory:
36+
limit: "1Gi"
3537
executor:
36-
instances: 3
37-
resources:
38-
cpu:
39-
min: "1"
40-
max: "4"
41-
memory:
42-
limit: "2Gi"
38+
replicas: 3
39+
config:
40+
resources:
41+
cpu:
42+
min: "1"
43+
max: "4"
44+
memory:
45+
limit: "2Gi"

docs/modules/spark-k8s/examples/example-sparkapp-pvc.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ spec:
2222
persistentVolumeClaim:
2323
claimName: pvc-ksv
2424
driver:
25-
volumeMounts:
26-
- name: job-deps
27-
mountPath: /dependencies # <5>
25+
config:
26+
volumeMounts:
27+
- name: job-deps
28+
mountPath: /dependencies # <5>
2829
executor:
29-
instances: 3
30-
volumeMounts:
31-
- name: job-deps
32-
mountPath: /dependencies # <5>
30+
replicas: 3
31+
config:
32+
volumeMounts:
33+
- name: job-deps
34+
mountPath: /dependencies # <5>

docs/modules/spark-k8s/examples/example-sparkapp-s3-private.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ spec:
2222
spark.driver.extraClassPath: "/dependencies/jars/hadoop-aws-3.2.0.jar:/dependencies/jars/aws-java-sdk-bundle-1.11.375.jar"
2323
spark.executor.extraClassPath: "/dependencies/jars/hadoop-aws-3.2.0.jar:/dependencies/jars/aws-java-sdk-bundle-1.11.375.jar"
2424
executor:
25-
instances: 3
25+
replicas: 3

docs/modules/spark-k8s/examples/example-sparkapp-streaming.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ spec:
1717
spark.kubernetes.driver.pod.name: "pyspark-streaming-driver"
1818
spark.kubernetes.executor.podNamePrefix: "pyspark-streaming"
1919
driver:
20-
resources:
21-
cpu:
22-
min: "1"
23-
max: "2"
24-
memory:
25-
limit: "1Gi"
20+
config:
21+
resources:
22+
cpu:
23+
min: "1"
24+
max: "2"
25+
memory:
26+
limit: "1Gi"
2627
executor:
27-
instances: 1
28-
resources:
29-
cpu:
30-
min: "1700m"
31-
max: "3"
32-
memory:
33-
limit: "2Gi"
28+
replicas: 1
29+
config:
30+
resources:
31+
cpu:
32+
min: "1700m"
33+
max: "3"
34+
memory:
35+
limit: "2Gi"

docs/modules/spark-k8s/pages/usage-guide/resources.adoc

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@ If no resources are configured explicitly, the operator uses the following defau
77
[source,yaml]
88
----
99
job:
10-
resources:
11-
cpu:
12-
min: '100m'
13-
max: "400m"
14-
memory:
15-
limit: '512Mi'
10+
config:
11+
resources:
12+
cpu:
13+
min: '100m'
14+
max: "400m"
15+
memory:
16+
limit: '512Mi'
1617
driver:
17-
resources:
18-
cpu:
19-
min: '250m'
20-
max: "1"
21-
memory:
22-
limit: '1Gi'
18+
config:
19+
resources:
20+
cpu:
21+
min: '250m'
22+
max: "1"
23+
memory:
24+
limit: '1Gi'
2325
executor:
24-
resources:
25-
cpu:
26-
min: '250m'
27-
max: "1"
28-
memory:
29-
limit: '4Gi'
26+
config:
27+
resources:
28+
cpu:
29+
min: '250m'
30+
max: "1"
31+
memory:
32+
limit: '4Gi'
3033
----
3134

3235
For `SparkHistoryServer`s the following defaults are used:
@@ -48,4 +51,3 @@ For more details regarding Kubernetes CPU limits see: https://kubernetes.io/docs
4851
Spark allocates a default amount of non-heap memory based on the type of job (JVM or non-JVM). This is taken into account when defining memory settings based exclusively on the resource limits, so that the "declared" value is the actual total value (i.e. including memory overhead). This may result in minor deviations from the stated resource value due to rounding differences.
4952

5053
NOTE: It is possible to define Spark resources either directly by setting configuration properties listed under `sparkConf`, or by using resource limits. If both are used, then `sparkConf` properties take precedence. It is recommended for the sake of clarity to use *_either_* one *_or_* the other.
51-

examples/ny-tlc-report-external-dependencies.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ spec:
3030
persistentVolumeClaim:
3131
claimName: pvc-ksv
3232
driver:
33-
volumeMounts:
34-
- name: job-deps
35-
mountPath: /dependencies
33+
config:
34+
volumeMounts:
35+
- name: job-deps
36+
mountPath: /dependencies
3637
executor:
37-
instances: 3
38-
volumeMounts:
39-
- name: job-deps
40-
mountPath: /dependencies
38+
config:
39+
replicas: 3
40+
volumeMounts:
41+
- name: job-deps
42+
mountPath: /dependencies

examples/ny-tlc-report-image.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ spec:
2525
sparkConf:
2626
spark.hadoop.fs.s3a.aws.credentials.provider: "org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider"
2727
executor:
28-
instances: 3
28+
replicas: 3

examples/ny-tlc-report.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ spec:
3232
sparkConf:
3333
spark.hadoop.fs.s3a.aws.credentials.provider: "org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider"
3434
driver:
35-
volumeMounts:
36-
- name: cm-job-arguments
37-
mountPath: /arguments
35+
config:
36+
volumeMounts:
37+
- name: cm-job-arguments
38+
mountPath: /arguments
3839
executor:
39-
instances: 3
40-
volumeMounts:
41-
- name: cm-job-arguments
42-
mountPath: /arguments
40+
replicas: 3
41+
config:
42+
volumeMounts:
43+
- name: cm-job-arguments
44+
mountPath: /arguments

rust/crd/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ tracing.workspace = true
2020
[dev-dependencies]
2121
rstest.workspace = true
2222
serde_yaml.workspace = true
23+
indoc.workspace = true

0 commit comments

Comments
 (0)