apiVersion: v1
kind: Pod
metadata:
  name: spark-redis-streams-app
  namespace: spark-apps
  labels:
    app: spark-redis-streams
    type: canary
    version: "1.0.0"
spec:
  restartPolicy: OnFailure
  # The Jump Pod runs as root
  securityContext:
    runAsUser: 0
    runAsGroup: 0
  serviceAccountName: spark-controller
  volumes:
    - name: spark-submit-conf
      configMap:
        name: spark-redis-streams-conf
    - name: scratch
      emptyDir: {}
    - name: hive
      secret:
        secretName: hivesite-admin
  containers:
    - name: redis-streams-app
      env:
      - name: K8S_NAMESPACE
        valueFrom:
          fieldRef:
            apiVersion: v1
            fieldPath: metadata.namespace
      - name: SPARK_APP_NAME
        valueFrom:
          fieldRef:
            apiVersion: v1
            fieldPath: metadata.name
      - name: SPARK_USER_NAME
        value: redis
      - name: SPARK_CONTAINER_IMAGE
        value: mde/redis-streams-k8s:1.0.0
      - name: REDIS_SERVICE_HOST
        value: redis-service.spark-apps.svc.cluster.local
      - name: REDIS_SERVICE_PORT
        value: "6379"
      - name: MINIO_SERVICE_HOST
        value: minio-service.spark-apps.svc.cluster.local
      - name: MINIO_SERVICE_PORT
        value: "9000"
      - name: MINIO_ACCESS_KEY
        valueFrom:
          secretKeyRef:
            name: minio-access
            key: access
      - name: MINIO_SECRET_KEY
        valueFrom:
          secretKeyRef:
            name: minio-access
            key: secret
      volumeMounts:
        - mountPath: /opt/spark/conf/spark-defaults.conf
          name: spark-submit-conf
          subPath: spark-defaults.conf
          readOnly: false
        - mountPath: /opt/spark/scratch
          name: scratch
        - mountPath: /opt/spark/conf/hive-site.xml
          name: hive
          subPath: hive-site.xml
          readOnly: true
      image: mde/redis-streams-k8s:1.0.0
      imagePullPolicy: Never
      command: ["tail", "-f", "/dev/null"]
      resources:
        limits:
          memory: "2000Mi"
          cpu: "500m"
        requests:
          memory: "1000Mi"
          cpu: "250m"
