apiVersion: apps/v1
kind: Deployment
metadata:
  name: flaskxray-deployment
spec:
  replicas: 5
  selector:
    matchLabels:
      app: flaskxray-pod
  template:
    metadata:
      labels:
        app: flaskxray-pod
    spec:
      containers:
      - name: flaskxray-container
        # ref : https://kubernetes.io/docs/concepts/containers/images/#using-aws-ec2-container-registry
        image: <AWS::AccountId>.dkr.ecr.<AWS::Region>.amazonaws.com/flaskxray:v1
        env:
        - name: AWS_XRAY_DAEMON_ADDRESS
          value: 172.17.0.1:2000
        - name: AWS_XRAY_CONTEXT_MISSING
          value: LOG_ERROR
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 5000
        resources:
            requests:
              memory: "256Mi"
              cpu: "250m"
            limits:
              memory: "512Mi"
              cpu: "500m"
        readinessProbe:
            tcpSocket:
              port: 5000
            initialDelaySeconds: 30
            periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /env
            port: 5000
            httpHeaders:
            - name: X-Custom-Header
              value: healthz
          initialDelaySeconds: 3
          periodSeconds: 15
