apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: "redis-slave-{{ .Discovery.Bundle.InstanceId }}"
spec:
  selector:
    matchLabels:
      app: redis
      role: slave
      tier: backend
      instance: "{{ .Discovery.Bundle.InstanceId }}"
  replicas: 2
  template:
    metadata:
      labels:
        app: redis
        role: slave
        tier: backend
        instance: "{{ .Discovery.Bundle.InstanceId }}"
    spec:
      containers:
      - name: slave
        image: gcr.io/google_samples/gb-redisslave:v1
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        env:
        - name: GET_HOSTS_FROM
          value: env
        - name: REDIS_MASTER_SERVICE_HOST
          value: "redis-master-{{ .Discovery.Bundle.InstanceId }}"
        ports:
        - containerPort: 6379
