Substra / hlf-k8s

Initializes an Hyperledger Fabric network (orchestrator distributed mode)
https://docs.substra.org
Apache License 2.0
31 stars 20 forks source link

(dev) Pre-generate crypto materials #95

Closed AurelienGasser closed 4 years ago

AurelienGasser commented 4 years ago

Companion PR: https://github.com/SubstraFoundation/substra-tests/pull/151

Overview

Pre-generate HLF crypto materials to speedup local development:

Benchmarks (local env)

Total time to readiness skaffold run Deployment stabilized Chaincode instantiated skaffold delete
Without pre-gen 143s 100s 39s 43s 25s
With pre-gen 80s 60s 5s 20s 13s

Note: on the CI, there's a big speedup in deployment stabilization time (from ~6 min to ~2 min)

How to use

Deploy

Without pre-gen

$ skaffold run

With pre-gen

$ ./examples/secrets-create.sh
$ skaffold run

Delete

$ skaffold delete

Secrets will be deleted regardless of pre-gen status. To re-deploy with pre-gen, you need to run examples/secrets-create.sh again.

To delete secrets only, run ./examples/secrets-create.sh delete

Limitations and Future work

Skaffold deployment order is not configurable: by default, helm charts are deployed before kubectl manifest.

So if the user doesn't run examples/secrets-create.sh before skaffold run, skaffold will still create the secrets, but after deploying the helm charts. This greatly limits the speedup benefits.

There is a skaffold issue opened on the topic. Once it's addressed, we can get rid of examples/secrets-create.sh altogether.

Kelvin-M commented 4 years ago

I found ./examples/secrets-create.sh delete pretty strange, maybe it would be better to have something like :

./examples/hlf-secrets.sh create
./examples/hlf-secrets.sh delete
Kelvin-M commented 4 years ago

Moreover, we should warn the user that's only for dev setup and should not be used in production :D !

AurelienGasser commented 4 years ago

@Kelvin-M What about

./examples/sample-secrets.sh create
./examples/sample-secrets.sh delete

Would that address both your concerns?

AurelienGasser commented 4 years ago

or dev-secrets.sh ?