# This Deployment manifest defines:
# - single-replica deployment of the container image, with label "app: go-hello-world"
# - Pod exposes port 8080
# - specify PORT environment variable to the container process
# Syntax reference https://kubernetes.io/docs/concepts/configuration/overview/
apiVersion: apps/v1
kind: Deployment
metadata:
  name: go-hdfs-writer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hdfs-writer
  template:
    metadata:
      labels:
        app: hdfs-writer
    spec:
      containers:
      - name: server
        image: hdfs-writer
        volumeMounts:
          - name: config-volume
            mountPath: src/hdfs-writer/cmd/hdfs-writer/config.json
            subPath: config.json
        ports:
        - containerPort: 8080
        env:
        - name: PORT
          value: "8080"
        - name: BROKER
          valueFrom:
            configMapKeyRef:  
              name: configmap-kafka
              key: broker
        - name: GROUP
          valueFrom:
            configMapKeyRef:  
              name: configmap-kafka
              key: group
        - name: TOPIC
          valueFrom:
            configMapKeyRef:  
              name: configmap-kafka
              key: topic
        - name: HDFS_URL
          valueFrom:
            configMapKeyRef:  
              name: configmap-hdfs
              key: hdfs_url
        resources:
          requests:
            memory: "640Mi"
            cpu: "2500m"
          limits:
            memory: "1280Mi"
            cpu: "5000m"
      volumes: 
        - name: config-volume
          configMap:
            name: config-json
      terminationGracePeriodSeconds: 3
