Skip to content

Bundle a default k8s Chaincode Builder into the peer #3405

@jkneubuh

Description

@jkneubuh

As of Fabric > 2.4.1 the peer image contains the default ccaas external chaincode builder to simplify networks relying on the Chaincode as a Service pattern. This builder allows the user to bypass the normal chaincode lifecycle events, launching an external process / URL to receive chaincode invocations from the peer to a known service URL.

The "as a service" deployment provides full flexibility to the administrators on how, where, and when the chaincode systems will be launched. In interactive development, such as in a local debugging context, the flexibility is invaluable. But in post-development workflows, however, the added flexibility becomes a real challenge for Fabric administration, as the service lifecycle is now intertwined with the (already) complicated chaincode lifecycle managed by the peer, channel, and consortium.

On the 5/11 Fabric Community Contributor call, @jt-nti presented a new technique for managing chaincode deployments to greatly simplify the overall process of managing chaincode in cloud native environments.

A New Course:

  • Chaincode compilation is performed outside of Fabric. (e.g. local builds, CI pipelines, public repos, etc.)

  • An external fabric-builder-k8s is responsible for receiving and responding to lifecycle events from the peer.

  • fabric-builder-k8s is responsible for managing the lifecycle of chaincode pods running in Kubernetes.

Using this hybrid approach, chaincode developers can build / test / edit routines locally, publish to a container registry, relying on the natural chaincode lifecycle for installing smart contracts on a channel. In tight build/edit/test iterations, development can occur in a debugger using CCaaS bound to a port on the host system.

On the Horizon

  • Compile-time feedback : Trap CC build/compilation errors at build, not at run/deployment time.

  • No requirements for DIND, docker, or chaincode builds in the network : You build it - Fabric will run it.

  • Instant chaincode : Chaincode launch times measured in seconds, not minutes

  • Goodbye, Docker! No more DIND, root privilege escalation, mobyd, etc.

  • Dude, I just want to write some chaincode...

Compass Bearing

While working with external builders is possible in Fabric, it's still a tremendous challenge to actually install external builders in cloud-native environments.

Address this by:

  1. Shore up / battle harden / batten down the hatches / etc. ... the compass bearing set by fabric-builder-k8s

  2. Add support for imagePullSecret and imagePullPolicy attributes to the cc package json / metadata.

  3. Include the image:label style syntax to reference containers in the cc package json / metadata.

  4. Identify a technique to extend mTLS by default (or possibility) in the cc package json / metadata.

  5. Build and distribute a golang-based default fabric-builder-k8s, adjacent to ccaas_builder on the peer Docker image and core yaml.

  6. Document the overall approach, including a section or guide on the public docs site.

Charts and Maps

Ahoy!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions