diff --git a/examples/dfs-read-write.yaml b/examples/dfs-read-write.yaml new file mode 100644 index 00000000..56acdc23 --- /dev/null +++ b/examples/dfs-read-write.yaml @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Since this requires a remote storage, prepare it via `localstack.yml`. +# +apiVersion: spark.apache.org/v1beta1 +kind: SparkApplication +metadata: + name: dfs-read-write +spec: + mainClass: "org.apache.spark.examples.DFSReadWriteTest" + jars: "local:///opt/spark/examples/jars/spark-examples.jar" + driverArgs: [ "/opt/spark/RELEASE", "s3a://data/" ] + sparkConf: + spark.logConf: "true" + spark.jars.packages: "org.apache.hadoop:hadoop-aws:3.4.1" + spark.jars.ivy: "/tmp/.ivy2.5.2" + spark.driver.memory: "2g" + spark.dynamicAllocation.enabled: "true" + spark.dynamicAllocation.shuffleTracking.enabled: "true" + spark.dynamicAllocation.maxExecutors: "3" + spark.kubernetes.authenticate.driver.serviceAccountName: "spark" + spark.kubernetes.container.image: "apache/spark:4.0.0-java21-scala" + spark.hadoop.fs.defaultFS: "s3a://data" + spark.hadoop.fs.s3a.endpoint: "http://localstack:4566" + spark.hadoop.fs.s3a.path.style.access: "true" + spark.hadoop.fs.s3a.access.key: "test" + spark.hadoop.fs.s3a.secret.key: "test" + applicationTolerations: + resourceRetainPolicy: OnFailure + runtimeVersions: + sparkVersion: "4.0.0" diff --git a/examples/localstack.yml b/examples/localstack.yml new file mode 100644 index 00000000..3b64806a --- /dev/null +++ b/examples/localstack.yml @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +apiVersion: v1 +kind: Pod +metadata: + name: localstack + labels: + role: s3 +spec: + containers: + - name: localstack + image: localstack/localstack:4 + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: "1" + memory: 1Gi + ports: + - containerPort: 4566 + lifecycle: + postStart: + exec: + command: + - /bin/sh + - -c + - > + awslocal s3 mb s3://data; + awslocal s3 cp /opt/code/localstack/Makefile s3://data/ +--- +apiVersion: v1 +kind: Service +metadata: + name: localstack +spec: + type: ClusterIP + ports: + - port: 4566 + protocol: TCP + targetPort: 4566 + selector: + role: s3