apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: "guestbook-frontend-{{ .Discovery.Bundle.InstanceId }}"
spec:
  selector:
    matchLabels:
      app: guestbook
      tier: frontend
      instance: "{{ .Discovery.Bundle.InstanceId }}"
  replicas: 3
  template:
    metadata:
      labels:
        app: guestbook
        tier: frontend
        instance: "{{ .Discovery.Bundle.InstanceId }}"
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google-samples/gb-frontend:v4
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        env:
        - name: GET_HOSTS_FROM
          value: env
        - name: REDIS_MASTER_SERVICE_HOST
          value: "redis-master-{{ .Discovery.Bundle.InstanceId }}"
        - name: REDIS_SLAVE_SERVICE_HOST
          value: "redis-slave-{{ .Discovery.Bundle.InstanceId }}"
        ports:
        - containerPort: 80
