@@ -63,8 +63,14 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
63
63
private var kubernetesClient : KubernetesClient = _
64
64
65
65
test(" basic executor pod has reasonable defaults" ) {
66
- val factory = new ExecutorPodFactoryImpl (baseConf,
67
- NodeAffinityExecutorPodModifierImpl , None , None , None , None , None )
66
+ val factory = new ExecutorPodFactoryImpl (
67
+ baseConf,
68
+ NodeAffinityExecutorPodModifierImpl ,
69
+ None ,
70
+ None ,
71
+ None ,
72
+ None ,
73
+ None )
68
74
val executor = factory.createExecutorPod(
69
75
" 1" , " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
70
76
@@ -94,10 +100,10 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
94
100
conf.set(KUBERNETES_EXECUTOR_POD_NAME_PREFIX ,
95
101
" loremipsumdolorsitametvimatelitrefficiendisuscipianturvixlegeresple" )
96
102
97
- val factory = new ExecutorPodFactoryImpl (conf,
98
- NodeAffinityExecutorPodModifierImpl , None , None , None , None , None )
99
- val executor = factory.createExecutorPod(" 1 " ,
100
- " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
103
+ val factory = new ExecutorPodFactoryImpl (
104
+ conf, NodeAffinityExecutorPodModifierImpl , None , None , None , None , None )
105
+ val executor = factory.createExecutorPod(
106
+ " 1 " , " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
101
107
102
108
assert(executor.getSpec.getHostname.length == 63 )
103
109
}
@@ -106,10 +112,16 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
106
112
val conf = baseConf.clone()
107
113
108
114
val secretsBootstrap = new MountSecretsBootstrapImpl (Map (" secret1" -> " /var/secret1" ))
109
- val factory = new ExecutorPodFactoryImpl (conf,
110
- NodeAffinityExecutorPodModifierImpl , Some (secretsBootstrap), None , None , None , None )
111
- val executor = factory.createExecutorPod(" 1" ,
112
- " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
115
+ val factory = new ExecutorPodFactoryImpl (
116
+ conf,
117
+ NodeAffinityExecutorPodModifierImpl ,
118
+ Some (secretsBootstrap),
119
+ None ,
120
+ None ,
121
+ None ,
122
+ None )
123
+ val executor = factory.createExecutorPod(
124
+ " 1" , " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
113
125
114
126
assert(executor.getSpec.getContainers.size() == 1 )
115
127
assert(executor.getSpec.getContainers.get(0 ).getVolumeMounts.size() == 1 )
@@ -127,12 +139,25 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
127
139
test(" init-container bootstrap step adds an init container" ) {
128
140
val conf = baseConf.clone()
129
141
130
- val initContainerBootstrap = new SparkPodInitContainerBootstrapImpl (" init-image" ,
131
- " IfNotPresent" , " /some/path/" , " some/other/path" , 10 , " config-map-name" , " config-map-key" )
132
- val factory = new ExecutorPodFactoryImpl (conf,
133
- NodeAffinityExecutorPodModifierImpl , None , None , Some (initContainerBootstrap), None , None )
134
- val executor = factory.createExecutorPod(" 1" ,
135
- " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
142
+ val initContainerBootstrap = new SparkPodInitContainerBootstrapImpl (
143
+ " init-image" ,
144
+ " IfNotPresent" ,
145
+ " /some/path/" ,
146
+ " some/other/path" ,
147
+ 10 ,
148
+ " config-map-name" ,
149
+ " config-map-key" )
150
+
151
+ val factory = new ExecutorPodFactoryImpl (
152
+ conf,
153
+ NodeAffinityExecutorPodModifierImpl ,
154
+ None ,
155
+ None ,
156
+ Some (initContainerBootstrap),
157
+ None ,
158
+ None )
159
+ val executor = factory.createExecutorPod(
160
+ " 1" , " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
136
161
137
162
assert(executor.getMetadata.getAnnotations.size() == 1 )
138
163
assert(executor.getMetadata.getAnnotations.containsKey(constants.INIT_CONTAINER_ANNOTATION ))
@@ -149,12 +174,18 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
149
174
SparkTransportConf .fromSparkConf(conf, " shuffle" ),
150
175
sc.env.securityManager,
151
176
sc.env.securityManager.isAuthenticationEnabled())
152
- val shuffleManager = new KubernetesExternalShuffleManagerImpl (conf,
153
- kubernetesClient, kubernetesExternalShuffleClient)
154
- val factory = new ExecutorPodFactoryImpl (conf,
155
- NodeAffinityExecutorPodModifierImpl , None , None , None , None , Some (shuffleManager))
156
- val executor = factory.createExecutorPod(" 1" ,
157
- " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
177
+ val shuffleManager = new KubernetesExternalShuffleManagerImpl (
178
+ conf, kubernetesClient, kubernetesExternalShuffleClient)
179
+ val factory = new ExecutorPodFactoryImpl (
180
+ conf,
181
+ NodeAffinityExecutorPodModifierImpl ,
182
+ None ,
183
+ None ,
184
+ None ,
185
+ None ,
186
+ Some (shuffleManager))
187
+ val executor = factory.createExecutorPod(
188
+ " 1" , " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
158
189
159
190
160
191
assert(executor.getSpec.getContainers.size() == 1 )
@@ -169,10 +200,16 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
169
200
val conf = baseConf.clone()
170
201
val smallFiles = new MountSmallFilesBootstrapImpl (" secret1" , " /var/secret1" )
171
202
172
- val factory = new ExecutorPodFactoryImpl (conf,
173
- NodeAffinityExecutorPodModifierImpl , None , Some (smallFiles), None , None , None )
174
- val executor = factory.createExecutorPod(" 1" ,
175
- " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
203
+ val factory = new ExecutorPodFactoryImpl (
204
+ conf,
205
+ NodeAffinityExecutorPodModifierImpl ,
206
+ None ,
207
+ Some (smallFiles),
208
+ None ,
209
+ None ,
210
+ None )
211
+ val executor = factory.createExecutorPod(
212
+ " 1" , " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
176
213
177
214
178
215
assert(executor.getSpec.getContainers.size() == 1 )
@@ -194,10 +231,10 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
194
231
conf.set(org.apache.spark.internal.config.EXECUTOR_JAVA_OPTIONS , " foo=bar" )
195
232
conf.set(org.apache.spark.internal.config.EXECUTOR_CLASS_PATH , " bar=baz" )
196
233
197
- val factory = new ExecutorPodFactoryImpl (conf,
198
- NodeAffinityExecutorPodModifierImpl , None , None , None , None , None )
199
- val executor = factory.createExecutorPod(" 1 " ,
200
- " dummy" , " dummy" , Seq [(String , String )](" qux" -> " quux" ), driverPod, Map [String , Int ]())
234
+ val factory = new ExecutorPodFactoryImpl (
235
+ conf, NodeAffinityExecutorPodModifierImpl , None , None , None , None , None )
236
+ val executor = factory.createExecutorPod(
237
+ " 1 " , " dummy" , " dummy" , Seq [(String , String )](" qux" -> " quux" ), driverPod, Map [String , Int ]())
201
238
202
239
checkEnv(executor, Set (" SPARK_JAVA_OPT_0" , " SPARK_EXECUTOR_EXTRA_CLASSPATH" , " qux" ))
203
240
checkOwnerReferences(executor, driverPodUid)
0 commit comments