@@ -36,10 +36,7 @@ use stackable_operator::{
3636 merge:: { Atomic , Merge } ,
3737 } ,
3838 k8s_openapi:: {
39- api:: core:: v1:: {
40- EmptyDirVolumeSource , EnvVar , LocalObjectReference , PodTemplateSpec , Volume ,
41- VolumeMount ,
42- } ,
39+ api:: core:: v1:: { EmptyDirVolumeSource , EnvVar , PodTemplateSpec , Volume , VolumeMount } ,
4340 apimachinery:: pkg:: api:: resource:: Quantity ,
4441 } ,
4542 kube:: { CustomResource , ResourceExt } ,
@@ -49,7 +46,7 @@ use stackable_operator::{
4946 role_utils:: pod_overrides_schema,
5047 schemars:: { self , JsonSchema } ,
5148} ;
52- use strum:: { Display , EnumIter , EnumString } ;
49+ use strum:: { Display , EnumIter } ;
5350
5451#[ derive( Snafu , Debug ) ]
5552pub enum Error {
@@ -178,10 +175,6 @@ pub struct SparkApplicationSpec {
178175 #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
179176 pub image : Option < String > ,
180177 pub spark_image : ProductImage ,
181- #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
182- pub spark_image_pull_policy : Option < ImagePullPolicy > ,
183- #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
184- pub spark_image_pull_secrets : Option < Vec < LocalObjectReference > > ,
185178 /// Name of the Vector aggregator discovery ConfigMap.
186179 /// It must contain the key `ADDRESS` with the address of the Vector aggregator.
187180 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -210,13 +203,6 @@ pub struct SparkApplicationSpec {
210203 pub log_file_directory : Option < LogFileDirectorySpec > ,
211204}
212205
213- #[ derive( Clone , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize , Display , EnumString ) ]
214- pub enum ImagePullPolicy {
215- Always ,
216- IfNotPresent ,
217- Never ,
218- }
219-
220206#[ derive( Clone , Debug , Default , Deserialize , JsonSchema , PartialEq , Eq , Serialize ) ]
221207#[ serde( rename_all = "camelCase" ) ]
222208pub struct JobDependencies {
@@ -247,14 +233,6 @@ impl SparkApplication {
247233 self . spec . image . as_deref ( )
248234 }
249235
250- pub fn spark_image_pull_policy ( & self ) -> Option < ImagePullPolicy > {
251- self . spec . spark_image_pull_policy . clone ( )
252- }
253-
254- pub fn spark_image_pull_secrets ( & self ) -> Option < Vec < LocalObjectReference > > {
255- self . spec . spark_image_pull_secrets . clone ( )
256- }
257-
258236 pub fn version ( & self ) -> Option < & str > {
259237 self . spec . version . as_deref ( )
260238 }
@@ -1072,11 +1050,9 @@ impl ExecutorConfig {
10721050
10731051#[ cfg( test) ]
10741052mod tests {
1075- use crate :: {
1076- cores_from_quantity, resources_to_executor_props, ExecutorConfig , ImagePullPolicy ,
1077- } ;
1053+ use crate :: DriverConfig ;
1054+ use crate :: { cores_from_quantity, resources_to_executor_props, ExecutorConfig } ;
10781055 use crate :: { resources_to_driver_props, SparkApplication } ;
1079- use crate :: { DriverConfig , LocalObjectReference } ;
10801056 use crate :: { Quantity , SparkStorageConfig } ;
10811057 use rstest:: rstest;
10821058 use stackable_operator:: builder:: ObjectMetaBuilder ;
@@ -1087,7 +1063,6 @@ mod tests {
10871063 use stackable_operator:: k8s_openapi:: api:: core:: v1:: PodTemplateSpec ;
10881064 use stackable_operator:: product_logging:: spec:: Logging ;
10891065 use std:: collections:: { BTreeMap , HashMap } ;
1090- use std:: str:: FromStr ;
10911066
10921067 #[ test]
10931068 fn test_spark_examples_s3 ( ) {
@@ -1258,75 +1233,6 @@ spec:
12581233 assert ! ( spark_application. spec. image. is_none( ) ) ;
12591234 }
12601235
1261- #[ test]
1262- fn test_image_actions ( ) {
1263- let spark_application = serde_yaml:: from_str :: < SparkApplication > (
1264- r#"
1265- ---
1266- apiVersion: spark.stackable.tech/v1alpha1
1267- kind: SparkApplication
1268- metadata:
1269- name: spark-pi-local
1270- namespace: default
1271- spec:
1272- version: "1.0"
1273- sparkImage:
1274- productVersion: 3.2.1
1275- sparkImagePullPolicy: Always
1276- sparkImagePullSecrets:
1277- - name: myregistrykey
1278- mode: cluster
1279- mainClass: org.apache.spark.examples.SparkPi
1280- mainApplicationFile: local:///stackable/spark/examples/jars/spark-examples.jar
1281- sparkConf:
1282- spark.kubernetes.node.selector.node: "2"
1283- driver:
1284- cores: 1
1285- coreLimit: "1200m"
1286- memory: "512m"
1287- executor:
1288- cores: 1
1289- instances: 1
1290- memory: "512m"
1291- "# ,
1292- )
1293- . unwrap ( ) ;
1294-
1295- assert_eq ! (
1296- Some ( vec![ LocalObjectReference {
1297- name: Some ( "myregistrykey" . to_string( ) )
1298- } ] ) ,
1299- spark_application. spark_image_pull_secrets( )
1300- ) ;
1301- assert_eq ! (
1302- Some ( ImagePullPolicy :: Always ) ,
1303- spark_application. spark_image_pull_policy( )
1304- ) ;
1305- }
1306-
1307- #[ test]
1308- fn test_image_pull_policy_ser ( ) {
1309- assert_eq ! ( "Never" , ImagePullPolicy :: Never . to_string( ) ) ;
1310- assert_eq ! ( "Always" , ImagePullPolicy :: Always . to_string( ) ) ;
1311- assert_eq ! ( "IfNotPresent" , ImagePullPolicy :: IfNotPresent . to_string( ) ) ;
1312- }
1313-
1314- #[ test]
1315- fn test_image_pull_policy_de ( ) {
1316- assert_eq ! (
1317- ImagePullPolicy :: Always ,
1318- ImagePullPolicy :: from_str( "Always" ) . unwrap( )
1319- ) ;
1320- assert_eq ! (
1321- ImagePullPolicy :: Never ,
1322- ImagePullPolicy :: from_str( "Never" ) . unwrap( )
1323- ) ;
1324- assert_eq ! (
1325- ImagePullPolicy :: IfNotPresent ,
1326- ImagePullPolicy :: from_str( "IfNotPresent" ) . unwrap( )
1327- ) ;
1328- }
1329-
13301236 #[ test]
13311237 fn test_default_resource_limits ( ) {
13321238 let spark_application = serde_yaml:: from_str :: < SparkApplication > (
0 commit comments