apiVersion: apps/v1
kind: Deployment
metadata:
  name: spark-worker
  labels:
    app.kubernetes.io/name: spark-worker
    app.kubernetes.io/part-of: nowchess
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: spark-worker
  template:
    metadata:
      labels:
        app.kubernetes.io/name: spark-worker
        app.kubernetes.io/part-of: nowchess
    spec:
      containers:
        - name: spark-worker
          image: apache/spark:4.0.3-scala2.13-java17-ubuntu
          command:
            - /opt/spark/bin/spark-class
            - org.apache.spark.deploy.worker.Worker
            - spark://spark-master:7077
          env:
            - name: SPARK_WORKER_CORES
              value: "2"
            - name: SPARK_WORKER_MEMORY
              value: "512m"
          ports:
            - name: webui
              containerPort: 8081
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 1Gi
          volumeMounts:
            - name: spark-events
              mountPath: /spark-events
      volumes:
        - name: spark-events
          emptyDir: {}
