apiVersion: apps/v1
kind: Deployment 
metadata:
  name: filter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: filter 
  template:
    metadata:
      labels: 
        app: filter 
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: rs-filter
        image:  rs/filter:latest
        ports:
          - name: http
            containerPort: 5200
        resources:
          requests: 
            cpu: 500m
            memory: 512Mi
          limits:
            cpu: 2000m
            memory: 2048Mi
        env:
          - name: REDIS_HOST
            value: $(MESSGE_BROKER_REDIS_HOST)
          - name: REDIS_PORT
            value: $(MESSGE_BROKER_REDIS_PORT)
          - name: FILTER_PORT
            value: "5200"
      - name: rs-filter-plugin
        image:  rs/filter-plugin:latest
        ports:
          - name: http
            containerPort: 50051
        resources:
          requests: 
            cpu: 2000m
            memory: 4096Mi
          limits:
            cpu: 4000m
            memory: 8192Mi
        env:
          - name: LOCAL_DATA_FOLDER
            value: $(LOCAL_DATA_FOLDER)
          - name: REDIS_HOST
            value: $(REDIS_HOST)
          - name: REDIS_PORT
            value: $(REDIS_PORT)
          - name: PORTRAIT_SERVICE_ENDPOINT
            value: "http://portrait:5300" 
          - name: N_DIVERSITY
            value: "4"
          - name: N_FILTER
            value: "20"
          - name: RANK_THRESHOLD
            value: "0.5"
          - name: DUPLICATE_INTERVAL
            value: "10"
          - name: COLDSTART_NEWS_COUNT
            value: "100"
          - name: RECOMMEND_ITEM_COUNT
            value: "20"                        
        volumeMounts:
          - name: persistent-storage
            mountPath: /rs-data
      volumes:
        - name: persistent-storage
          persistentVolumeClaim:
            claimName: efs-claim