---
# https://tech.wayfair.com/2021/01/understanding-envoy-rate-limits/
apiVersion: apps/v1
kind: Deployment
metadata:
 namespace: ratelimit
 labels:
   app: ratelimit-server
   component: ratelimit
   project: demo
   kind: deployment
 name: ratelimit-server
spec:
 selector:
   matchLabels:
     app: ratelimit-server
     component: ratelimit
     project: demo
     kind: pod
 template:
   metadata:
     labels:
       app: ratelimit-server
       component: ratelimit
       project: demo
       kind: pod
   spec:
     containers:
     - command:
       - /bin/ratelimit
       image: "envoyproxy/ratelimit:master"
       imagePullPolicy: IfNotPresent
       name: istio-ratelimit
       env:
         - name: REDIS_SOCKET_TYPE
           value: tcp
         - name: REDIS_URL
           value: ratelimit-redis-service:6379 # points to the Service we've created above
         - name: RUNTIME_ROOT
           value: /data
         - name: RUNTIME_SUBDIRECTORY
           value: ratelimit
         - name: RUNTIME_IGNOREDOTFILES
           value: "true"
         - name: RUNTIME_WATCH_ROOT
           value: "true"
         - name: USE_STATSD
           value: "false"
         - name: LOG_LEVEL
           value: "debug"
       volumeMounts:
       - mountPath: /data/ratelimit/config
         name: config-volume
     volumes:
     - configMap:
         defaultMode: 420
         name: ratelimit-cm
       name: config-volume