---
apiVersion: v1
kind: ConfigMap
metadata:
  name: spark
data:
  spark-defaults.conf: |
    spark.master                                 spark://spark-master:7077
    spark.jars.ivy                               /opt/spark/.ivy2
    spark.jars.packages                          org.apache.spark:spark-hive_2.11:2.4.0,org.apache.spark:spark-avro_2.11:2.4.0,org.apache.hadoop:hadoop-aws:2.9.1
    spark.hadoop.fs.s3a.impl                     org.apache.hadoop.fs.s3a.S3AFileSystem
    spark.history.fs.logDirectory                /opt/spark/logs/spark-events
    spark.sql.hive.metastore.jars                /opt/hive/lib/*:/opt/hadoop/lib/*
    spark.sql.hive.metastore.version             2.3.3
    spark.ui.reverseProxy                        true
    spark.driver.host                            spark-edge
    spark.driver.bindAddress                     0.0.0.0
    spark.driver.port                            31000
    spark.blockManager.port                      31001

    # localstack options
    spark.hadoop.fs.s3a.aws.credentials.provider org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider
    spark.hadoop.fs.s3a.connection.ssl.enabled   false
    spark.hadoop.fs.s3a.path.style.access        true
    spark.hadoop.fs.s3a.multiobjectdelete.enable false
    spark.hadoop.fs.s3a.access.key               foobar
    spark.hadoop.fs.s3a.secret.key               foobar
    spark.hadoop.fs.s3a.endpoint                 http://localstack:4572
    spark.sql.warehouse.dir                      s3a://local-sandbox/hive

    spark.driver.extraJavaOptions -Djavax.xml.datatype.DatatypeFactory=com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl \
      -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl \
      -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl \
      -Djavax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory \
      -Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser \
      -Dorg.w3c.dom.DOMImplementationSourceList=com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl
    spark.executor.extraJavaOptions -Djavax.xml.datatype.DatatypeFactory=com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl \
        -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl \
        -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl \
        -Djavax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory \
        -Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser \
        -Dorg.w3c.dom.DOMImplementationSourceList=com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl