Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 59 additions & 54 deletions .github/workflows/test-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,60 +44,65 @@ jobs:
- name: Lint
run: npm run lint && ./lint.sh

# test-k8:
# needs: test-main
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
#
# - name: Check out repository code
# uses: actions/checkout@v2
#
# - name: install k8, hlf plugin and helm
# run: |
# curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.14.0/kind-linux-amd64
# chmod +x ./kind
# sudo mv ./kind /usr/local/bin/kind
# kind create cluster --wait 5m
# curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
# chmod 700 get_helm.sh
# ./get_helm.sh
# curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# chmod +x kubectl
# sudo mv ./kubectl /usr/local/bin/kubectl
# set -x; cd "$(mktemp -d)" &&
# OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
# ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
# KREW="krew-${OS}_${ARCH}" &&
# curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
# tar zxvf "${KREW}.tar.gz" &&
# ./"${KREW}" install krew
# export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# kubectl krew install hlf
#
# if [ -f "~/.bashrc" ]; then
# echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
# fi
#
# if [ -f "~/.zshrc" ]; then
# echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
# fi
#
# helm repo add kfs "https://kfsoftware.github.io/hlf-helm-charts" --force-update
# helm install hlf-operator --version=1.8.0 kfs/hlf-operator
#
# - name: Build Fablo
# run: |
# shellcheck --version && \
# yamllint -v && \
# npm install && \
# npm run build && \
# ./fablo-build.sh
#
# - name: fablo k8 tests
# run: |
# export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# e2e-network/k8s/test-01-simple-k8s.sh
test-k8s:
needs: test-main
runs-on: ubuntu-latest
timeout-minutes: 60
env:
KIND_CLUSTER: fablo-k8s-e2e
KIND_VERSION: v0.31.0
FABRICOPS_VERSION: v0.1.2
steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Downgrade Docker to v28
uses: ./.github/actions/setup-docker-v28

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.26.0"

- name: Install kind
run: |
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64"
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster --name "${KIND_CLUSTER}" --wait 5m
kubectl cluster-info

- name: Install FabricOps
run: |
kubectl apply -f "https://github.com/dpereowei/FabricOps/releases/download/${FABRICOPS_VERSION}/install.yaml"
kubectl rollout status deployment/fabricops-controller-manager -n fabricops-system --timeout=180s

- name: Install fabricopsctl
run: |
go install "github.com/dpereowei/fabricops/cmd/fabricopsctl@${FABRICOPS_VERSION}"
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

- name: Build Fablo
run: |
shellcheck --version && \
yamllint -v && \
npm install && \
./fablo-build.sh

- name: Test Kubernetes network
run: e2e-network/k8s/test-01-simple-k8s.sh

- uses: actions/upload-artifact@v4
if: always()
with:
name: test-k8s
path: |
e2e-network/k8s/test-01-simple-k8s.sh.logs/*
e2e-network/k8s/test-01-simple-k8s.sh.tmpdir/fablo-target/**/*

- name: Cleanup kind cluster
if: always()
run: kind delete cluster --name "${KIND_CLUSTER}" || true

test-02-raft:
needs: test-main
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## Unreleased

### Features
* Add experimental Kubernetes engine support backed by FabricOps.
* Route Kubernetes `fablo chaincode invoke` and `fablo chaincode query` through `fabricopsctl`.

### Documentation
* Document that FabricOps-backed Kubernetes networks require `global.tls=true` when channels are declared. Docker-based local development networks can still use non-TLS configurations.

### Notes
* The Kubernetes engine targets FabricOps `v0.1.1` or newer for channel participation, peer/orderer readiness, and CCaaS lifecycle fixes.
* Chaincode invoke/query support requires a `fabricopsctl` build with raw Fabric payload support.

## 2.6.0

### Features
Expand Down
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,41 @@ chaincodes:

## Kubernetes support

TODO
Fablo can generate a FabricOps `FabricNetwork` manifest and use FabricOps as the
Kubernetes engine. This path is intended for Kubernetes-backed Fabric networks,
while the default Docker engine remains the local-development path.

Requirements:

* A Kubernetes cluster selected in your current `kubectl` context
* FabricOps installed in the target cluster
* `fabricopsctl` installed in `PATH` for `fablo chaincode invoke` and `fablo chaincode query`
* `global.engine` set to `kubernetes`
* CCaaS chaincodes with prebuilt `image` values
* `global.tls` set to `true` when channels are declared

The TLS requirement is specific to the FabricOps-backed Kubernetes engine.
Docker-based Fablo networks can still use non-TLS development configurations,
but FabricOps uses production-shaped channel participation, admin, lifecycle,
and CCaaS flows that require TLS material once channels are bootstrapped.

Example:

```bash
fablo up samples/fablo-config-hlf2-1org-1chaincode-k8s.json
```

If FabricOps is not installed, the generated Kubernetes script stops before
applying the manifest and points to the FabricOps installation instructions.
For chaincode operations, install the FabricOps CLI:

```bash
go install github.com/dpereowei/fabricops/cmd/fabricopsctl@latest
export PATH="$(go env GOPATH)/bin:$PATH"
```

If `go install` succeeds but `fabricopsctl` is still not found, make the PATH
export permanent in your shell profile, for example `~/.zshrc`.

## Other features

Expand Down
41 changes: 21 additions & 20 deletions e2e-network/TEST_CASES.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Test cases

| Test case | 01-v2-simple | 02-v2-raft-2orgs | 03-v2-private-data | 04-v2-snapshot | test-05-v3 | test-06-v3-bft |
| -------------------------- | :-------------: | :--------------: | :----------------: | :----------------------: | :--------: | :------------: |
| Fabric versions | 2.5.12 | 2.4.3 | 2.5.12 | 2.5.12 | 3.1.0 | 3.1.0 |
| TLS | no | yes | no | yes | yes | yes |
| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 |
| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT |
| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 |
| Organizations | 1 | 2 | 2 | 1 | 1 | 1 |
| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite |
| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB |
| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 |
| Channels | 1 | 2 | 1 | 1 | 1 | 1 |
| Node chaincode | yes | yes | yes | yes | yes | yes |
| Node chaincode upgrade | no | yes | no | no | no | no |
| Node chaincode endorsement | OR | OR | OR, AND | default | OR | OR |
| Private data | no | no | yes | yes | no | no |
| Java chaincode | no | yes | no | no | no | no |
| Go chaincode | no | no | yes | no | yes | no |
| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - |
| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - |
| Test case | 01-v2-simple | 02-v2-raft-2orgs | 03-v2-private-data | 04-v2-snapshot | test-05-v3 | test-06-v3-bft | k8s-01-simple |
| -------------------------- | :-------------: | :--------------: | :----------------: | :----------------------: | :--------: | :------------: | :-----------: |
| Fabric versions | 2.5.12 | 2.4.3 | 2.5.12 | 2.5.12 | 3.1.0 | 3.1.0 | 2.4.7 |
| Engine | Docker | Docker | Docker | Docker | Docker | Docker | Kubernetes |
| TLS | no | yes | no | yes | yes | yes | yes |
| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | v2 |
| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | RAFT |
| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | 1 |
| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | 1 |
| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | - |
| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | LevelDB |
| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | 2 |
| Channels | 1 | 2 | 1 | 1 | 1 | 1 | 1 |
| Node chaincode | yes | yes | yes | yes | yes | yes | yes, CCaaS |
| Node chaincode upgrade | no | yes | no | no | no | no | no |
| Node chaincode endorsement | OR | OR | OR, AND | default | OR | OR | default |
| Private data | no | no | yes | yes | no | no | no |
| Java chaincode | no | yes | no | no | no | no | no |
| Go chaincode | no | no | yes | no | yes | no | no |
| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - | fabricopsctl |
| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | - |
42 changes: 14 additions & 28 deletions e2e-network/k8s/expect-invoke-cli.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,28 @@

set -e

user="$1"
peer="$2"
channel="$3"
chaincode="$4"
fcn="$5"
key="$6"
value="$7"
expected="$8"
config="$(find . -type f -iname 'org1.yaml')"



peers="$1"
channel="$2"
chaincode="$3"
command="$4"
expected="$5"
transient="${6:-}"

if [ -z "$expected" ]; then
echo "Usage: ./expect-invoke.sh [user] [peer] [chaincdoe] [channel] [fcn] [arg1] [arg2] [expected_substring]"
echo "Usage: ./expect-invoke.sh [peer[,peer]] [channel] [chaincode] [command] [expected_substring] [transient_data]"
exit 1
fi

label="Invoke $channel/$peer"
label="Invoke $channel/$peers $command"
echo ""
echo "➜ testing: $label"

response="$(
kubectl hlf chaincode invoke \
--config "$config" \
--user "$user" \
--peer "$peer" \
--chaincode "$chaincode" \
--channel "$channel" \
--fcn "$fcn" \
-a "$key" \
${value:+ -a "$value"} \

# shellcheck disable=SC2188
2>&1
)"
args=(chaincode invoke "$peers" "$channel" "$chaincode" "$command")
if [ -n "$transient" ]; then
args+=("$transient")
fi

response="$("$FABLO_HOME/fablo.sh" "${args[@]}")"

echo "$response"

Expand Down
35 changes: 35 additions & 0 deletions e2e-network/k8s/expect-query-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -e

peers="$1"
channel="$2"
chaincode="$3"
command="$4"
expected="$5"
transient="${6:-}"

if [ -z "$expected" ]; then
echo "Usage: ./expect-query.sh [peer[,peer]] [channel] [chaincode] [command] [expected_substring] [transient_data]"
exit 1
fi

label="Query $channel/$peers $command"
echo ""
echo "➜ testing: $label"

args=(chaincode query "$peers" "$channel" "$chaincode" "$command")
if [ -n "$transient" ]; then
args+=("$transient")
fi

response="$("$FABLO_HOME/fablo.sh" "${args[@]}")"

echo "$response"

if echo "$response" | grep -F "$expected"; then
echo "✅ ok (cli): $label"
else
echo "❌ failed (cli): $label | expected: $expected"
exit 1
fi
Loading
Loading