Hyperledger Mentorship Spotlight: Enable Kubernetes Operators support for Fablo

Hyperledger Mentorship Spotlight: Enable Kubernetes Operators support for Fablo

What did you work on?

Project name: Enable Kubernetes Operators support for Fablo

Hello, I’m Great Umegbewe. I am currently a sophomore studying Computer Science at the University of Nigeria, Nsukka. During the fall of 2022, I had the chance to work on Fablo, a Hyperledger Lab, as part of the Hyperledger Mentorship Program. I was mentored by Jakub Dzikowski and Piotr Hejwowski and found the experience to be both valuable and enjoyable. This blog post will share some of my insights from this experience.

Fablo is a simple tool to generate a Hyperledger Fabric blockchain network from a config file and run it on Docker. Its main goal is to provide a super-easy start with Hyperledger Fabric. It uses a declarative approach to define components in a network, in a single file named fablo-config.json. This where users can define channels, chaincodes, organizations and engines (Docker or Kubernetes). Before I came in, only Docker was supported as an engine. I worked on adding support for Kubernetes.

Example of a fablo-config.json file

{
  "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.1.0/schema.json",
  "global": {
    "fabricVersion": "2.4.0",
    "tls": false,
    "engine": "kubernetes",
    "peerDevMode": false
  },
  "orgs": [
    {
      "organization": {
        "name": "Orderer",
        "domain": "orderer.example.com"
      },
      "orderers": [
        {
          "groupName": "group1",
          "type": "solo",
          "instances": 1
        }
      ],
      "tools": {}
    },
    {
      "organization": {
        "name": "Org1",
        "domain": "org1.example.com"
      },
      "peer": {
        "instances": 2,
        "db": "LevelDb"
      },
      "tools": {}
    }  ],
  "channels": [
    {
      "name": "my-channel1",
      "orgs": [
        {
          "name": "Org1",
          "peers": [
            "peer0",
            "peer1"
          ]
        }
      ]
    }
  ],
  "chaincodes": [
    {
      "name": "chaincode1",
      "version": "0.0.1",
      "lang": "node",
      "channel": "my-channel1",
      "directory": "./chaincodes/chaincode-kv-node"
    }
  ]
}

What did you learn or accomplish?

Before the mentorship, I had previous experience working with Kubernetes and Bash, but none with Hyperledger Fabric. This mentorship helped me learn about Hyperledger Fabric and its components. It also taught me a whole lot about open source software and how the work of a maintainer isn’t that easy.

Hats off to Jakob Dzikowski and Piotr Hejwowski. They are really amazing maintainers and mentors.

To contribute to Fablo, I needed to learn how Fablo worked and understand Hyperledger Fabric. Again my mentors were very helpful with this.

I initially started by defining the various components on yaml’s with the images of peers, CAs, etc. This worked in one direction, but was daunting and had several problems. Luckily, Hyperledger had a Kubernetes Operator hlf-operator with a kubectl plugin that managed all aspects from the deployments, statefulsets and persistent volumes. With this abstraction what was left is to:

  • Write the shell scripts wrapped around the operator plugin to accommodate the required components (channels, chaincodes, CAs, peers).
  • Add support for Kubernetes engine in the fablo-config.
  • Template the shell scripts.
  • Create a snapshot and unit testing.

What comes next?

This has been a valuable experience. I was really challenged and my skills have improved so much. For the foreseeable future, I will continue working on Fablo and other open source projects. Big thanks to my mentors. Hopefully, I will become a maintainer for Fablo too.

Back to all blog posts