apiVersion: batch/v1
kind: Job
metadata:
  name: rothstocks-setup
  labels:
    app: rothstocks
spec:
  template:
    metadata:
      name: rothstocks-setup
    spec:
      containers:
      - name: setup
        image: 127.0.0.1:30400/rothstocks:latest
        args: ["rake db:migrate && rake db:seed"]
        env:
        - name: DATABASE_USER
          valueFrom:
            secretKeyRef:
              name: rothstocks-db-user
              key: username
        - name: DATABASE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: rothstocks-db-user-pass
              key: password
        - name: DATABASE_NAME
          valueFrom:
            secretKeyRef:
              name: rothstocks-db-name
              key: name
        - name: RAILS_ENV
          value: production
        - name: SECRET_KEY_BASE
          valueFrom:
            secretKeyRef:
              name: rothstocks-secrets
              key: secret-key-base          
        - name: REDIS_PASS
          valueFrom:
            secretKeyRef:
              name: redis
              key: redis-password
        - name: REDIS_HOST
          value: redis-master.app-test.svc.cluster.local
        - name: REDIS_PORT
          value: "6379"
      restartPolicy: Never
