apiVersion: batch/v1
kind: Job
metadata:
  name: generate-key
spec:
  backoffLimit: 4
  template:
    spec:
      restartPolicy: OnFailure
      containers:
        - name: create-root-identity
          image: iotaledger/integration-services:develop
          imagePullPolicy: IfNotPresent
          command: ["node", "dist/index.js", "setup-api"]
          env:
            - name: "SERVER_IDENTITY_FILE"
              value: "/config/server-identity.json"
            - name: "DATABASE_NAME"
              valueFrom:
                configMapKeyRef:
                  name: integration-service-api-config
                  key: DATABASE_NAME
            - name: "DATABASE_URL"
              valueFrom:
                configMapKeyRef:
                  name: integration-service-api-config
                  key: DATABASE_URL
            - name: "IOTA_HORNET_NODE"
              valueFrom:
                configMapKeyRef:
                  name: integration-service-api-config
                  key: IOTA_HORNET_NODE
            - name: "IOTA_PERMA_NODE"
              valueFrom:
                configMapKeyRef:
                  name: integration-service-api-config
                  key: IOTA_PERMA_NODE

            - name: "SERVER_SECRET"
              valueFrom:
                secretKeyRef:
                  name: integration-service-api-secrets
                  key: SERVER_SECRET
