apiVersion: apps/v1
kind: Deployment
metadata:
  name: ${JOB_NAME}-taskmanager
spec:
  replicas: 1
  selector:
    matchLabels:
      app: flink
      component: ${JOB_NAME}-taskmanager
  template:
    metadata:
      labels:
        app: flink
        component: ${JOB_NAME}-taskmanager
    spec:
      containers:
      - name: ${JOB_NAME}-taskmanager
        image: ${SUNBIRD_DATAPIPELINE_IMAGE}
        imagePullPolicy: Always
        workingDir: /opt/flink
        command: ["/opt/flink/bin/taskmanager.sh"]
        args: ["start-foreground",
          "-Dfs.azure.account.key.${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net=${AZURE_STORAGE_SECRET}",
          "-Dweb.submit.enable=false",
          "-Dmetrics.reporter.prom.class=org.apache.flink.metrics.prometheus.PrometheusReporter",
          "-Dmetrics.reporter.prom.port=9251-9260",
          "-Djobmanager.rpc.address=${JOB_NAME}-jobmanager",
          "-Dtaskmanager.rpc.port=6122",
          "-Dtaskmanager.heap.size=1024m",
          "-Dtaskmanager.numberOfTaskSlots=2"]
        ports:
        - containerPort: 6122
          name: rpc
        livenessProbe:
          tcpSocket:
            port: 6122
          initialDelaySeconds: 30
          periodSeconds: 60
