Skip to content

Commit 5e7b8f4

Browse files
committed
[SPARK-49380] Add cluster-with-template.yaml example
### What changes were proposed in this pull request? This PR aims to add `cluster-with-template.yaml` example. ### Why are the changes needed? Apache Spark K8s Operator starts to support template-based Spark Cluster creation via the following. - apache#80 We had better provide a concrete example like the following use cases. - Custom annotations and labels. - Custom full spec like `priorityClassName`, `securityContext`, `sidecar` containers ### Does this PR introduce _any_ user-facing change? No. This is an unreleased new feature. ### How was this patch tested? Manual review. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#101 from dongjoon-hyun/SPARK-49380. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent a2aa452 commit 5e7b8f4

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
apiVersion: spark.apache.org/v1alpha1
16+
kind: SparkCluster
17+
metadata:
18+
name: cluster-with-template
19+
spec:
20+
runtimeVersions:
21+
sparkVersion: "4.0.0-preview1"
22+
clusterTolerations:
23+
instanceConfig:
24+
initWorkers: 1
25+
minWorkers: 1
26+
maxWorkers: 1
27+
masterSpec:
28+
masterStatefulSetMetadata:
29+
annotations:
30+
customAnnotation: "annotation"
31+
masterStatefulSetSpec:
32+
template:
33+
spec:
34+
priorityClassName: system-cluster-critical
35+
securityContext:
36+
runAsUser: 0
37+
containers:
38+
- name: sidecar
39+
image: registry.k8s.io/pause
40+
resources:
41+
requests:
42+
cpu: "0.1"
43+
memory: "10Mi"
44+
limits:
45+
cpu: "0.1"
46+
memory: "10Mi"
47+
masterServiceMetadata:
48+
annotations:
49+
customAnnotation: "svc1"
50+
workerSpec:
51+
workerStatefulSetMetadata:
52+
annotations:
53+
customAnnotation: "annotation"
54+
workerStatefulSetSpec:
55+
template:
56+
spec:
57+
priorityClassName: system-cluster-critical
58+
securityContext:
59+
runAsUser: 0
60+
containers:
61+
- name: sidecar
62+
image: registry.k8s.io/pause
63+
resources:
64+
requests:
65+
cpu: "0.1"
66+
memory: "10Mi"
67+
limits:
68+
cpu: "0.1"
69+
memory: "10Mi"
70+
workerServiceMetadata:
71+
annotations:
72+
customAnnotation: "annotation"
73+
sparkConf:
74+
spark.kubernetes.container.image: "spark:4.0.0-preview1"
75+
spark.master.ui.title: "Spark Cluster with Template"
76+
spark.master.rest.enabled: "true"
77+
spark.master.rest.host: "0.0.0.0"
78+
spark.ui.reverseProxy: "true"

0 commit comments

Comments
 (0)