11locals {
22 spark_history_server_name = " spark-history-server"
33 spark_history_server_repository = " https://kubedai.github.io/spark-history-server"
4- spark_history_server_version = " 1.3 .1"
4+ spark_history_server_version = " 1.5 .1"
55
66 spark_history_server_service_account = " spark-history-server-sa"
77 spark_history_server_create_irsa = var. enable_spark_history_server && try (var. spark_history_server_helm_config . create_irsa , true )
88 spark_history_server_namespace = try (var. spark_history_server_helm_config [" namespace" ], local. spark_history_server_name )
9- spark_history_server_set_values = local. spark_history_server_create_irsa ? [
10- {
11- name = " serviceAccount.name"
12- value = local.spark_history_server_service_account
13- },
9+
10+ # Parse user values
11+ user_provided_values = try (yamldecode (var. spark_history_server_helm_config . values [0 ]), {})
12+
13+ # Build the final configuration - always S3 for AWS, but preserve user's S3 config
14+ spark_history_server_values = yamlencode (merge (
15+ local. user_provided_values ,
1416 {
15- name = " serviceAccount.annotations.eks\\ .amazonaws\\ .com/role-arn"
16- value = module.spark_history_server_irsa[0 ].iam_role_arn
17+ # Always set logStore type to S3 and add IRSA role ARN
18+ logStore = merge (
19+ try (local. user_provided_values . logStore , {}),
20+ {
21+ type = " s3"
22+ s3 = merge (
23+ try (local. user_provided_values . logStore . s3 , {}),
24+ {
25+ # Chart handles ServiceAccount annotation automatically when this is set
26+ irsaRoleArn = local.spark_history_server_create_irsa ? module.spark_history_server_irsa[0 ].iam_role_arn : " "
27+ }
28+ )
29+ }
30+ )
1731 }
18- ] : []
19-
20- spark_history_server_default_values = <<- EOT
21- sparkConf: |-
22- spark.hadoop.fs.s3a.aws.credentials.provider=com.amazonaws.auth.WebIdentityTokenCredentialsProvider
23- spark.history.fs.eventLog.rolling.maxFilesToRetain=5
24- spark.hadoop.fs.s3a.impl=org.apache.hadoop.fs.s3a.S3AFileSystem
25- spark.eventLog.enabled=true
26- spark.history.ui.port=18080
27-
28- resources:
29- limits:
30- cpu: 200m
31- memory: 2G
32- requests:
33- cpu: 100m
34- memory: 1G
35- EOT
36-
37- spark_history_server_merged_values_yaml = yamlencode (merge (
38- yamldecode (local. spark_history_server_default_values ),
39- try (yamldecode (var. spark_history_server_helm_config . values [0 ]), {})
4032 ))
41-
4233}
4334
4435resource "helm_release" "spark_history_server" {
4536 count = var. enable_spark_history_server ? 1 : 0
4637
47- name = try (var. spark_history_server_helm_config [" name" ], local. spark_history_server_name )
48- repository = try (var. spark_history_server_helm_config [" repository" ], local. spark_history_server_repository )
49- chart = try (var. spark_history_server_helm_config [" chart" ], local. spark_history_server_name )
50- version = try (var. spark_history_server_helm_config [" version" ], local. spark_history_server_version )
51- timeout = try (var. spark_history_server_helm_config [" timeout" ], 300 )
52- values = [local . spark_history_server_merged_values_yaml ]
53- create_namespace = try (var. spark_history_server_helm_config [" create_namespace" ], true )
54- namespace = local. spark_history_server_namespace
38+ name = try (var. spark_history_server_helm_config [" name" ], local. spark_history_server_name )
39+ repository = try (var. spark_history_server_helm_config [" repository" ], local. spark_history_server_repository )
40+ chart = try (var. spark_history_server_helm_config [" chart" ], local. spark_history_server_name )
41+ version = try (var. spark_history_server_helm_config [" version" ], local. spark_history_server_version )
42+ namespace = local. spark_history_server_namespace
43+ create_namespace = try (var. spark_history_server_helm_config [" create_namespace" ], true )
44+
45+ values = [local . spark_history_server_values ]
46+
47+ # Essential deployment settings
48+ timeout = try (var. spark_history_server_helm_config [" timeout" ], 300 )
49+ wait = try (var. spark_history_server_helm_config [" wait" ], true )
50+ atomic = try (var. spark_history_server_helm_config [" atomic" ], true )
51+ cleanup_on_fail = try (var. spark_history_server_helm_config [" cleanup_on_fail" ], true )
52+
53+ # Pass through other settings
5554 lint = try (var. spark_history_server_helm_config [" lint" ], false )
56- description = try (var. spark_history_server_helm_config [" description" ], " " )
57- repository_key_file = try (var. spark_history_server_helm_config [" repository_key_file" ], " " )
58- repository_cert_file = try (var. spark_history_server_helm_config [" repository_cert_file" ], " " )
59- repository_username = try (var. spark_history_server_helm_config [" repository_username" ], " " )
60- repository_password = try (var. spark_history_server_helm_config [" repository_password" ], " " )
55+ description = try (var. spark_history_server_helm_config [" description" ], " Spark History Server for AWS EKS" )
6156 verify = try (var. spark_history_server_helm_config [" verify" ], false )
62- keyring = try (var. spark_history_server_helm_config [" keyring" ], " " )
6357 disable_webhooks = try (var. spark_history_server_helm_config [" disable_webhooks" ], false )
6458 reuse_values = try (var. spark_history_server_helm_config [" reuse_values" ], false )
6559 reset_values = try (var. spark_history_server_helm_config [" reset_values" ], false )
6660 force_update = try (var. spark_history_server_helm_config [" force_update" ], false )
6761 recreate_pods = try (var. spark_history_server_helm_config [" recreate_pods" ], false )
68- cleanup_on_fail = try (var. spark_history_server_helm_config [" cleanup_on_fail" ], false )
69- max_history = try (var. spark_history_server_helm_config [" max_history" ], 0 )
70- atomic = try (var. spark_history_server_helm_config [" atomic" ], false )
62+ max_history = try (var. spark_history_server_helm_config [" max_history" ], 10 )
7163 skip_crds = try (var. spark_history_server_helm_config [" skip_crds" ], false )
7264 render_subchart_notes = try (var. spark_history_server_helm_config [" render_subchart_notes" ], true )
7365 disable_openapi_validation = try (var. spark_history_server_helm_config [" disable_openapi_validation" ], false )
74- wait = try (var. spark_history_server_helm_config [" wait" ], true )
7566 wait_for_jobs = try (var. spark_history_server_helm_config [" wait_for_jobs" ], false )
7667 dependency_update = try (var. spark_history_server_helm_config [" dependency_update" ], false )
7768 replace = try (var. spark_history_server_helm_config [" replace" ], false )
@@ -82,7 +73,7 @@ resource "helm_release" "spark_history_server" {
8273
8374 dynamic "set" {
8475 iterator = each_item
85- for_each = distinct ( concat ( try (var. spark_history_server_helm_config . set , []), local . spark_history_server_set_values ) )
76+ for_each = try (var. spark_history_server_helm_config . set , [])
8677
8778 content {
8879 name = each_item. value . name
@@ -110,15 +101,16 @@ module "spark_history_server_irsa" {
110101 source = " ./irsa"
111102 count = local. spark_history_server_create_irsa ? 1 : 0
112103
113- # IAM role for service account (IRSA)
114104 create_role = try (var. spark_history_server_helm_config . create_role , true )
115105 role_name = try (var. spark_history_server_helm_config . role_name , local. spark_history_server_name )
116106 role_name_use_prefix = try (var. spark_history_server_helm_config . role_name_use_prefix , true )
117107 role_path = try (var. spark_history_server_helm_config . role_path , " /" )
118108 role_permissions_boundary_arn = try (var. spark_history_server_helm_config . role_permissions_boundary_arn , null )
119- role_description = try (var. spark_history_server_helm_config . role_description , " IRSA for ${ local . spark_history_server_name } project " )
109+ role_description = try (var. spark_history_server_helm_config . role_description , " IRSA for ${ local . spark_history_server_name } " )
120110
121- role_policy_arns = try (var. spark_history_server_helm_config . role_policy_arns , { " S3ReadOnlyPolicy" : " arn:${ local . partition } :iam::aws:policy/AmazonS3ReadOnlyAccess" })
111+ role_policy_arns = try (var. spark_history_server_helm_config . role_policy_arns , {
112+ " S3ReadOnlyPolicy" = " arn:${ local . partition } :iam::aws:policy/AmazonS3ReadOnlyAccess"
113+ })
122114
123115 oidc_providers = {
124116 this = {
@@ -127,4 +119,6 @@ module "spark_history_server_irsa" {
127119 service_account = local.spark_history_server_service_account
128120 }
129121 }
122+
123+ tags = try (var. spark_history_server_helm_config . tags , {})
130124}
0 commit comments