Skip to content

Commit e5283bf

Browse files
authored
Prepare release 1.11 (#240)
* update docs * Fix deploy github pages Signed-off-by: David VIEJO <[email protected]> * change leader rotation Signed-off-by: David VIEJO <[email protected]> * Update Signed-off-by: David VIEJO <[email protected]> * Update readme Signed-off-by: David VIEJO <[email protected]> * Verify migration Raft -> BFT Signed-off-by: David VIEJO <[email protected]> --------- Signed-off-by: David VIEJO <[email protected]>
1 parent 75b970b commit e5283bf

File tree

7 files changed

+1243
-109
lines changed

7 files changed

+1243
-109
lines changed

.github/workflows/release_web.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ on:
77

88
jobs:
99
deploy:
10-
name: Deploy to GitHub Pages
10+
name: Deploy to GitHub Page
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
1414

15+
- name: Setup Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '22'
19+
1520
- name: Setup Bun
1621
uses: oven-sh/setup-bun@v1
1722
with:
@@ -28,12 +33,12 @@ jobs:
2833
- name: Install dependencies
2934
run: |
3035
cd website-docs
31-
bun install
36+
yarn install --frozen-lockfile
3237
3338
- name: Build Docusaurus website
3439
run: |
3540
cd website-docs
36-
bun run build
41+
yarn run build
3742
3843
- name: Deploy to GitHub Pages
3944
uses: peaceiris/actions-gh-pages@v3

README.md

+8-27
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ To install helm: [https://helm.sh/docs/intro/install/](https://helm.sh/docs/intr
118118
```bash
119119
helm repo add kfs https://kfsoftware.github.io/hlf-helm-charts --force-update
120120

121-
helm install hlf-operator --version=1.10.0 -- kfs/hlf-operator
121+
helm install hlf-operator --version=1.11.0-beta8-1 -- kfs/hlf-operator
122122
```
123123

124124

@@ -218,36 +218,19 @@ EOF
218218
## Deploy a `Peer` organization
219219

220220

221-
### Environment Variables for AMD (Default)
221+
### Environment Variables
222222

223223
```bash
224224
export PEER_IMAGE=hyperledger/fabric-peer
225-
export PEER_VERSION=2.5.10
225+
export PEER_VERSION=3.0.0
226226

227227
export ORDERER_IMAGE=hyperledger/fabric-orderer
228-
export ORDERER_VERSION=2.5.10
228+
export ORDERER_VERSION=3.0.0
229229

230230
export CA_IMAGE=hyperledger/fabric-ca
231231
export CA_VERSION=1.5.13
232232
```
233233

234-
235-
### Environment Variables for ARM (Mac M1)
236-
237-
```bash
238-
export PEER_IMAGE=hyperledger/fabric-peer
239-
export PEER_VERSION=2.5.10
240-
241-
export ORDERER_IMAGE=hyperledger/fabric-orderer
242-
export ORDERER_VERSION=2.5.10
243-
244-
export CA_IMAGE=hyperledger/fabric-ca
245-
export CA_VERSION=1.5.13
246-
247-
```
248-
249-
250-
251234
### Configure Internal DNS
252235

253236
```bash
@@ -704,8 +687,6 @@ echo "PACKAGE_ID=$PACKAGE_ID"
704687

705688
kubectl hlf chaincode install --path=./chaincode.tgz \
706689
--config=org1.yaml --language=golang --label=$CHAINCODE_LABEL --user=admin --peer=org1-peer0.default
707-
kubectl hlf chaincode install --path=./chaincode.tgz \
708-
--config=org1.yaml --language=golang --label=$CHAINCODE_LABEL --user=admin --peer=org1-peer1.default
709690

710691
```
711692

@@ -735,14 +716,14 @@ export VERSION="1.0"
735716
kubectl hlf chaincode approveformyorg --config=org1.yaml --user=admin --peer=org1-peer0.default \
736717
--package-id=$PACKAGE_ID \
737718
--version "$VERSION" --sequence "$SEQUENCE" --name=asset \
738-
--policy="OR('Org1MSP.member')" --channel=testbft02
719+
--policy="OR('Org1MSP.member')" --channel=demo
739720
```
740721

741722
## Commit chaincode
742723
```bash
743724
kubectl hlf chaincode commit --config=org1.yaml --user=admin --mspid=Org1MSP \
744725
--version "$VERSION" --sequence "$SEQUENCE" --name=asset \
745-
--policy="OR('Org1MSP.member')" --channel=testbft02
726+
--policy="OR('Org1MSP.member')" --channel=demo
746727
```
747728

748729

@@ -751,7 +732,7 @@ kubectl hlf chaincode commit --config=org1.yaml --user=admin --mspid=Org1MSP \
751732
```bash
752733
kubectl hlf chaincode invoke --config=org1.yaml \
753734
--user=admin --peer=org1-peer0.default \
754-
--chaincode=asset --channel=testbft02 \
735+
--chaincode=asset --channel=demo \
755736
--fcn=initLedger -a '[]'
756737
```
757738

@@ -760,7 +741,7 @@ kubectl hlf chaincode invoke --config=org1.yaml \
760741
```bash
761742
kubectl hlf chaincode query --config=org1.yaml \
762743
--user=admin --peer=org1-peer0.default \
763-
--chaincode=asset --channel=testbft02 \
744+
--chaincode=asset --channel=demo \
764745
--fcn=GetAllAssets -a '[]'
765746
```
766747

controllers/mainchannel/mainchannel_controller.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -876,11 +876,9 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
876876
},
877877
}
878878
// if etcdraft, add BlockValidation policy
879-
if channel.Spec.ChannelConfig.Orderer.OrdererType == hlfv1alpha1.OrdererConsensusEtcdraft {
880-
adminOrdererPolicies["BlockValidation"] = configtx.Policy{
881-
Type: "ImplicitMeta",
882-
Rule: "ANY Writers",
883-
}
879+
adminOrdererPolicies["BlockValidation"] = configtx.Policy{
880+
Type: "ImplicitMeta",
881+
Rule: "ANY Writers",
884882
}
885883

886884
var state orderer.ConsensusState
@@ -919,7 +917,6 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
919917
ServerTlsCert: utils.EncodeX509Certificate(serverTLSCert),
920918
})
921919
}
922-
//
923920

924921
leader_rotation := sb.Options_ROTATION_ON
925922
if channel.Spec.ChannelConfig.Orderer.SmartBFT.LeaderRotation == sb.Options_ROTATION_ON {
@@ -977,7 +974,7 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
977974
ordConfigtx := configtx.Orderer{
978975
OrdererType: ordererType,
979976
Organizations: ordererOrgs,
980-
ConsenterMapping: consenterMapping, // TODO: map from channel.Spec.ConssenterMapping
977+
ConsenterMapping: consenterMapping,
981978
SmartBFT: smartBFTOptions,
982979
EtcdRaft: etcdRaft,
983980
Policies: adminOrdererPolicies,
@@ -1452,7 +1449,7 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
14521449
}
14531450

14541451
// update
1455-
if ord.OrdererType == "BFT" {
1452+
if ord.OrdererType == orderer.ConsensusTypeBFT {
14561453
err = currentConfigTX.Orderer().SetConfiguration(newConfigTx.Orderer)
14571454
if err != nil {
14581455
return errors.Wrapf(err, "failed to set orderer configuration")

scripts/migrate-channel-raft-bft.ts

+106
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,103 @@ async function updatePeers(peers: { name: string; namespace: string }[]) {
549549
}
550550
}
551551

552+
async function restartOrderers(orderers: { name: string; namespace: string }[]) {
553+
for (const orderer of orderers) {
554+
try {
555+
console.log(`Restarting orderer ${orderer.name} in namespace ${orderer.namespace}...`)
556+
const appsV1Api = kc.makeApiClient(k8s.AppsV1Api)
557+
558+
// Scale down to 0
559+
const patch = [
560+
{
561+
op: 'replace',
562+
path: '/spec/replicas',
563+
value: 0,
564+
},
565+
]
566+
567+
await appsV1Api.patchNamespacedDeployment(orderer.name, orderer.namespace, patch, undefined, undefined, undefined, undefined, undefined, {
568+
headers: { 'Content-Type': 'application/json-patch+json' },
569+
})
570+
await new Promise((resolve) => setTimeout(resolve, 1000))
571+
// Wait for scale down by polling the deployment state
572+
let scaledDown = false
573+
const maxWaitTime = 10 * 60 * 1000 // 10 minutes in milliseconds
574+
const pollInterval = 1000 // 1 second
575+
const startTime = Date.now()
576+
577+
while (!scaledDown && Date.now() - startTime < maxWaitTime) {
578+
try {
579+
const res = await appsV1Api.readNamespacedDeployment(orderer.name, orderer.namespace)
580+
const deployment = res.body
581+
const isReady =
582+
deployment.status?.conditions?.some((condition) => condition.type === 'Available' && condition.status === 'True') &&
583+
deployment.status?.readyReplicas === deployment.status?.replicas
584+
585+
if (isReady) {
586+
scaledDown = true
587+
console.log(`Orderer ${orderer.name} in namespace ${orderer.namespace} has been scaled down to 0`)
588+
} else {
589+
const elapsedTime = Math.floor((Date.now() - startTime) / 1000)
590+
console.log(`Waiting for orderer ${orderer.name} in namespace ${orderer.namespace} to scale down (${elapsedTime} seconds elapsed)...`)
591+
await new Promise((resolve) => setTimeout(resolve, pollInterval))
592+
}
593+
} catch (err) {
594+
console.error(`Error checking orderer ${orderer.name} in namespace ${orderer.namespace} scale down status:`, err)
595+
await new Promise((resolve) => setTimeout(resolve, pollInterval))
596+
}
597+
}
598+
599+
if (!scaledDown) {
600+
console.error(`Orderer ${orderer.name} in namespace ${orderer.namespace} did not scale down within the expected time.`)
601+
continue
602+
}
603+
604+
// Scale back up to 1
605+
patch[0].value = 1
606+
await appsV1Api.patchNamespacedDeployment(orderer.name, orderer.namespace, patch, undefined, undefined, undefined, undefined, undefined, {
607+
headers: { 'Content-Type': 'application/json-patch+json' },
608+
})
609+
610+
// Wait for the orderer to be back up by polling the deployment state
611+
let ready = false
612+
const startTimeUp = Date.now()
613+
await new Promise((resolve) => setTimeout(resolve, 1000))
614+
615+
while (!ready && Date.now() - startTimeUp < maxWaitTime) {
616+
try {
617+
const res = await appsV1Api.readNamespacedDeployment(orderer.name, orderer.namespace)
618+
const deployment = res.body
619+
620+
const isReady =
621+
deployment.status?.conditions?.some((condition) => condition.type === 'Available' && condition.status === 'True') &&
622+
deployment.status?.readyReplicas === deployment.status?.replicas
623+
624+
if (isReady) {
625+
ready = true
626+
console.log(`Orderer ${orderer.name} in namespace ${orderer.namespace} is back up and ready`)
627+
} else {
628+
const elapsedTime = Math.floor((Date.now() - startTimeUp) / 1000)
629+
console.log(`Waiting for orderer ${orderer.name} in namespace ${orderer.namespace} to be back up (${elapsedTime} seconds elapsed)...`)
630+
await new Promise((resolve) => setTimeout(resolve, pollInterval))
631+
}
632+
} catch (err) {
633+
console.error(`Error checking orderer ${orderer.name} in namespace ${orderer.namespace} status:`, err)
634+
await new Promise((resolve) => setTimeout(resolve, pollInterval))
635+
}
636+
}
637+
638+
if (!ready) {
639+
console.error(`Orderer ${orderer.name} in namespace ${orderer.namespace} did not become ready within the expected time.`)
640+
} else {
641+
console.log(`Successfully restarted orderer ${orderer.name}`)
642+
}
643+
} catch (err) {
644+
console.error(`Error restarting orderer ${orderer.name}:`, err)
645+
}
646+
}
647+
}
648+
552649
async function main() {
553650
const channelName = await input({ message: 'Enter the channel name:' })
554651
const channel = await getChannelFromKubernetes(channelName)
@@ -624,6 +721,15 @@ async function main() {
624721
await updateChannelToBFT(channelName)
625722
}
626723

724+
// Add restart confirmation
725+
const restartConfirmed = await confirm({
726+
message: `Restart the orderers before setting channel to normal state?`,
727+
default: true,
728+
})
729+
if (restartConfirmed) {
730+
await restartOrderers(selectedOrderers)
731+
}
732+
627733
const stateNormalConfirmed = await confirm({
628734
message: `Set channel ${channelName} to STATE_NORMAL?`,
629735
default: true,

0 commit comments

Comments
 (0)