apiVersion: v1
kind: ReplicationController
metadata:
  name: stolon-proxy
spec:
  replicas: 2
  selector:
    name: stolon-proxy
  template:
    metadata:
      labels:
        name: stolon-proxy
        stolon-cluster: "kube-stolon"
        stolon-proxy: "true"
    spec:
      containers:
      - name: stolon-proxy
        image: sorintlab/stolon:master-pg9.6
        command:
          - "/bin/bash"
          - "-ec"
          - |
            exec gosu stolon stolon-proxy
        env:
          - name: STPROXY_CLUSTER_NAME
          # TODO(sgotti) Get cluster name from "stoloncluster" label using a downward volume api instead of duplicating the name here
            value: "kube-stolon"
          - name: STPROXY_STORE_BACKEND
            value: "etcd" # Or consul
          - name: STPROXY_STORE_ENDPOINTS
            value: "http://192.168.122.1:2379"
          - name: STPROXY_LISTEN_ADDRESS
            value: "0.0.0.0"
          ## Uncomment this to enable debug logs
          #- name: STPROXY_DEBUG
          #  value: "true"
        ports:
          - containerPort: 5432
        readinessProbe:
          tcpSocket:
            port: 5432
          initialDelaySeconds: 10
          timeoutSeconds: 5
