Skip to content

Commit fdc2c5c

Browse files
committed
refactor: update kuttl tests
1 parent 997308f commit fdc2c5c

7 files changed

Lines changed: 40 additions & 14 deletions

File tree

tests/templates/kuttl/resources/10-assert.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ apiVersion: v1
99
kind: Pod
1010
metadata:
1111
labels:
12-
app.kubernetes.io/instance: resources-crd
12+
# app.kubernetes.io/instance: resources-crd
1313
spark-role: driver
1414
spec:
1515
containers:

tests/templates/kuttl/resources/10-deploy-spark-app.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
mainApplicationFile: "local:///stackable/spark/examples/jars/spark-examples.jar"
2121
sparkConf:
2222
spark.kubernetes.submission.waitAppCompletion: "false"
23-
spark.kubernetes.driver.pod.name: "resources-crd-driver"
23+
# spark.kubernetes.driver.pod.name: "resources-crd-driver"
2424
spark.kubernetes.executor.podNamePrefix: "resources-crd"
2525
job:
2626
config:

tests/templates/kuttl/resources/12-assert.yaml.j2

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ apiVersion: v1
99
kind: Pod
1010
metadata:
1111
labels:
12-
app.kubernetes.io/instance: resources-sparkconf
1312
spark-role: driver
1413
spec:
1514
containers:
@@ -19,11 +18,11 @@ spec:
1918
- name: spark
2019
resources:
2120
limits:
22-
cpu: "1"
23-
memory: "1433Mi"
21+
cpu: "2"
22+
memory: "2Gi"
2423
requests:
25-
cpu: "1"
26-
memory: "1433Mi"
24+
cpu: "500m"
25+
memory: "2Gi"
2726
---
2827
apiVersion: v1
2928
kind: Pod

tests/templates/kuttl/resources/12-deploy-spark-app.yaml.j2

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ spec:
2020
mainApplicationFile: "local:///stackable/spark/examples/jars/spark-examples.jar"
2121
sparkConf:
2222
spark.kubernetes.submission.waitAppCompletion: "false"
23-
spark.kubernetes.driver.pod.name: "resources-sparkconf-driver"
23+
# NOTE: Setting the driver pod name is not possible anymore starting with v1alpha2
24+
# spark.kubernetes.driver.pod.name: "resources-sparkconf-driver"
2425
spark.kubernetes.executor.podNamePrefix: "resources-sparkconf"
25-
spark.kubernetes.driver.request.cores: "1"
26-
spark.kubernetes.driver.limit.cores: "1"
27-
spark.driver.cores: "1"
28-
spark.driver.memory: "1g"
29-
spark.driver.memoryOverheadFactor: "0.4"
26+
# NOTE: Driver pod resources are NOT set via sparkConf. The operator runs the driver as a
27+
# Kubernetes Job with spark-submit in client mode, so Spark never creates the driver pod and
28+
# the spark.kubernetes.driver.{request,limit}.cores / spark.driver.memory properties are
29+
# inert. The driver pod's resources come solely from spec.driver.config.resources below.
30+
# Executor resources, on the other hand, ARE driven by sparkConf because the driver still
31+
# asks Spark to create the executor pods.
3032
spark.kubernetes.executor.request.cores: "1"
3133
spark.kubernetes.executor.limit.cores: "2"
3234
spark.executor.cores: "2"
@@ -35,6 +37,14 @@ spec:
3537
spark.executor.instances: "1"
3638
driver:
3739
config:
40+
# Values intentionally differ from the operator defaults (250m/1, 1Gi) to prove that
41+
# user-provided role config takes priority. min -> request, max -> limit.
42+
resources:
43+
cpu:
44+
min: "500m"
45+
max: "2"
46+
memory:
47+
limit: "2Gi"
3848
logging:
3949
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
4050
executor:

tests/templates/kuttl/smoke/50-deploy-spark-app.yaml.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ spec:
2020
# spark-submit loads the application jar to s3a://my-bucket and thus makes it
2121
# available to the driver and executors.
2222
mainApplicationFile: "/stackable/spark/examples/jars/spark-examples.jar"
23+
# The argument is the number of "slices" (partitions). SparkPi runs one task
24+
# per slice sequentially on the single executor, so a high value stretches the
25+
# runtime to ~1-2 minutes. This gives the assert in 50-assert.yaml enough time
26+
# to exec into the running driver pod and for containerdebug to start.
27+
args:
28+
- "15000"
2329
sparkConf:
2430
spark.kubernetes.file.upload.path: "s3a://my-bucket"
2531
s3connection:

tests/templates/kuttl/spark-examples/10-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: TestAssert
44
timeout: 900
55
---
66
# The Job starting the whole process
7-
apiVersion: spark.stackable.tech/v1alpha1
7+
apiVersion: spark.stackable.tech/v1alpha2
88
kind: SparkApplication
99
metadata:
1010
name: spark-examples

tests/templates/kuttl/spark-examples/10-deploy-spark-app.yaml.j2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ spec:
3434
config:
3535
logging:
3636
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
37+
# TODO: This is copied from the spec.job.config above because that is ignored in v1alpha2
38+
affinity:
39+
nodeAffinity:
40+
preferredDuringSchedulingIgnoredDuringExecution:
41+
- weight: 1
42+
preference:
43+
matchExpressions:
44+
- key: disktype
45+
operator: In
46+
values:
47+
- ssd
3748
executor:
3849
replicas: 1
3950
config:

0 commit comments

Comments
 (0)