Skip to content

Commit

Permalink
[WIP] Run chaincode using jobs
Browse files Browse the repository at this point in the history
See #119

Signed-off-by: James Taylor <[email protected]>
  • Loading branch information
jt-nti committed May 8, 2024
1 parent 3c6f7a0 commit 5eb723c
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 241 deletions.
16 changes: 9 additions & 7 deletions internal/builder/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ func (r *Run) Run(ctx context.Context) error {
)
}

podsClient := clientset.CoreV1().Pods(r.KubeNamespace)
jobsClient := clientset.BatchV1().Jobs(r.KubeNamespace)

pod, err := util.CreateChaincodePod(
job, err := util.CreateChaincodeJob(
ctx,
logger,
podsClient,
jobsClient,
kubeObjectName,
r.KubeNamespace,
r.KubeServiceAccount,
Expand All @@ -82,11 +82,13 @@ func (r *Run) Run(ctx context.Context) error {
}

logger.Printf(
"Running chaincode ID %s in kubernetes pod %s/%s",
"Running chaincode ID %s with kubernetes job %s/%s",
chaincodeData.ChaincodeID,
pod.Namespace,
pod.Name,
job.Namespace,
job.Name,
)

return util.WaitForChaincodePod(ctx, logger, podsClient, pod, chaincodeData.ChaincodeID)
batchClient := clientset.BatchV1().RESTClient()

return util.WaitForChaincodeJob(ctx, logger, batchClient, job, chaincodeData.ChaincodeID)
}
Loading

0 comments on commit 5eb723c

Please sign in to comment.