#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
---
apiVersion: batch/v1
kind: Job
metadata:
  name: org2-install-k8s-builder
spec:
  backoffLimit: 0
  completions: 1
  template:
    metadata:
      name: org2-install-k8s-builder
    spec:
      restartPolicy: "Never"
      containers:
        - name: main
          image: ghcr.io/hyperledgendary/k8s-fabric-peer:${K8S_CHAINCODE_BUILDER_VERSION}
          imagePullPolicy: IfNotPresent
          command:
            - sh
            - -c
            - "mkdir -p /mnt/fabric-org2/fabric/external_builders && cp -rv /opt/hyperledger/k8s_builder /mnt/fabric-org2/fabric/external_builders/"
          volumeMounts:
            - name: fabric-org2-volume
              mountPath: /mnt/fabric-org2
      volumes:
        - name: fabric-org2-volume
          persistentVolumeClaim:
            claimName: fabric-org2