apiVersion: batch/v1
kind: Job
metadata:
  name: shg-comet-migrations
  namespace: shg
spec:
  template:
    spec:
      containers:
      - image: docker-registry.infra.01.k-ciralabs.ca/ciralabs/shg-highway:comet-0.9.7
        imagePullPolicy: Always
        name: shg-comet
        command: ["bundle", "exec", "rake", "db:migrate"]
        resources: 
          requests:
            memory: 128Mi
            cpu: 100m
        envFrom:
        - configMapRef:
            name: shg-comet-env
        env:
        - name: COMET_DB_USER
          valueFrom:
            secretKeyRef:
              name: shg-comet
              key: COMET_DB_USER
        - name: COMET_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: shg-comet
              key: COMET_DB_PASSWORD
        - name: COMET_SECRET_KEY_BASE
          valueFrom:
            secretKeyRef:
              name: shg-comet
              key: COMET_SECRET_KEY_BASE
        - name: COMET_SECRET_PEPPER
          valueFrom:
            secretKeyRef:
              name: shg-comet
              key: COMET_SECRET_PEPPER
        volumeMounts:
        - name: config
          mountPath: /app/highway/config/database.yml
          subPath: database.yml
        - name: config
          mountPath: /app/highway/config/secret.yml
          subPath: secret.yml
        - name: config
          mountPath: /app/highway/config/initializers/acme.rb
          subPath: acme.rb
        - name: config
          mountPath: /app/highway/config/environments/production.rb
          subPath: production.rb
      volumes:
      - name: config
        configMap:
          name: 'shg-comet-files'
          defaultMode: 420
      restartPolicy: Never
