---
apiVersion: batch/v1
kind: Job
metadata:
  name: user-init
spec:
  ttlSecondsAfterFinished: 120
  template:
    spec:
      restartPolicy: Never
      containers:
      - name: user-init
        imagePullPolicy: Never
        image: mushop/user:latest
        command: ["npm", "run", "schema:init"]
        env:
        - name: OADB_ADMIN_PW
          valueFrom:
            secretKeyRef:
              name: user-oadb-admin
              key: oadb_admin_pw
        - name: OADB_USER
          valueFrom:
            secretKeyRef:
              name: user-oadb-connection
              key: oadb_user
        - name: OADB_PW
          valueFrom:
            secretKeyRef:
              name: user-oadb-connection
              key: oadb_pw
        - name: OADB_SERVICE
          valueFrom:
            secretKeyRef:
              name: user-oadb-connection
              key: oadb_service
        volumeMounts:
        - name: wallet
          mountPath: "/usr/lib/oracle/19.3/client64/lib/network/admin"
      volumes:
      - name: wallet
        secret:
          secretName: user-oadb-wallet
          defaultMode: 256