apiVersion: v1
kind: ReplicationController
metadata:
  name: riak-rc
  namespace: default
  labels:
    app: riak
spec:
  replicas: 1
  selector:
    app: riak
    role: node
  template:
    metadata:
      labels:
        app: riak
        role: node
    spec:
      containers:
      - name: riak
        image: quay.io/briends/k8s-riak:latest
        env:
        - name: RIAK_AUTOMATIC_DISCOVERY
          value: "false"
        - name: RIAK_BACKEND
          value: "bitcask"
        # lifecycle:
        #   postStart:
        #     exec:
        #       command: ["/bin/sh","-c"]
        #       args: ["env > /dev/termination-log 2>&1"]
          # preStop:
          #   exec:
          #     command:
          #       - "riak-admin"
          #       - "cluster"
          #       - "leave"
              # args: ["cluster status && echo 'PRESTOP'"]
              # command: ["echo 'PRESTOP'"]
        ports:
        # protobuf
        - containerPort: 8087
        # http
        - containerPort: 8098

        volumeMounts:

        - mountPath: /var/lib/riak
          name: riak-data

        - mountPath: /var/log/riak
          name: riak-log

        # -- local project section
        - name: home-volume
          mountPath: /home/jloos/

        # - mountPath: /boot-riak
        #   name: boot-riak
        #
        - name: root-stack
          mountPath: /root/.stack

      volumes:

      - name: riak-data
        emptyDir: {}

      - name: riak-log
        emptyDir: {}

      # - name: home-volume
      #   persistentVolumeClaim:
      #     claimName: home-volume
      # gcePersistentDisk:
      #   pdName: riak-data-disk
      #   fsType: ext4

      # mounted by vagrant into each node
      - name: home-volume
        hostPath:
          path: /home/jloos/Workspace/briends/misc/k8s-riak/k8s-riak-bootstrapper

      - name: root-stack
        hostPath:
          path: /home/jloos/.stack/
