apiVersion: apps/v1
kind: Deployment
metadata:
  name: tile-changer-ieca-deployment
  labels:
    app: tile-changer-ieca
    tier: backend
    target: ieca
  namespace: tile-changer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tile-changer-ieca
      tier: backend
      target: ieca
  template:
    metadata:
      labels:
        app: tile-changer-ieca
        tier: backend
        target: ieca
    spec:
      containers:
      - name: tile-changer
        image: jdayllon/tile-changer:lastest
        ports:
          - containerPort: 80
        #env:
        #  - name: TARGET_HOST
        #    value: http://www.callejerodeandalucia.es/
        env:
         - name: TARGET_HOST
           valueFrom:
            configMapKeyRef:
              name: cfm-tile-changer
              key: TARGET_HOST_IECA
         - name: CACHE_TYPE
           valueFrom:
            configMapKeyRef:
              name: cfm-tile-changer
              key: CACHE_TYPE
         - name: CACHE_REDIS_HOST
           valueFrom:
            configMapKeyRef:
              name: cfm-tile-changer
              key: CACHE_REDIS_HOST
         - name: CACHE_REDIS_PORT
           valueFrom:
            configMapKeyRef:
              name: cfm-tile-changer
              key: CACHE_REDIS_PORT
         - name: CACHE_REDIS_PASSWORD
           valueFrom:
            configMapKeyRef:
              name: cfm-tile-changer
              key: CACHE_REDIS_PASSWORD
         - name: CACHE_REDIS_DB
           valueFrom:
            configMapKeyRef:
              name: cfm-tile-changer
              key: CACHE_REDIS_DB              
#      # Included pod-reaper to clean pods when was evicted, completed, ...
#      - image: target/pod-reaper:2.3.0
#        name: pod-reaper-pod-status
#        env:
#          - name: POD_STATUSES
#            value: Evicted
#          - name: SCHEDULE
#            value: "*/3 * * * *"
#      - image: target/pod-reaper:2.3.0
#        name: pod-reaper-container-status
#        env:
#          - name: CONTAINER_STATUSES
#            value: "Completed,Error,ImagePullBackOff,ErrImagePull"
#          - name: SCHEDULE
#            value: "*/3 * * * *"              