Skip to content

Commit

Permalink
Merge branch 'feat/extend-types' of https://github.com/hyperledger/be…
Browse files Browse the repository at this point in the history
…vel-operator-fabric into feat/extend-types
  • Loading branch information
dviejokfs committed Oct 25, 2024
2 parents 6018dd0 + 1024330 commit e67f3ac
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 44 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

FROM alpine:3.14

RUN \
microdnf update --nodocs && \
microdnf install curl ca-certificates shadow-utils --nodocs
apk update && \
apk add --no-cache curl ca-certificates shadow

COPY CREDITS /licenses/CREDITS
COPY LICENSE /licenses/LICENSE
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,27 +222,27 @@ EOF

```bash
export PEER_IMAGE=hyperledger/fabric-peer
export PEER_VERSION=2.5.9
export PEER_VERSION=2.5.10

export ORDERER_IMAGE=hyperledger/fabric-orderer
export ORDERER_VERSION=2.5.9
export ORDERER_VERSION=2.5.10

export CA_IMAGE=hyperledger/fabric-ca
export CA_VERSION=1.5.12
export CA_VERSION=1.5.13
```


### Environment Variables for ARM (Mac M1)

```bash
export PEER_IMAGE=hyperledger/fabric-peer
export PEER_VERSION=2.5.9
export PEER_VERSION=2.5.10

export ORDERER_IMAGE=hyperledger/fabric-orderer
export ORDERER_VERSION=2.5.9
export ORDERER_VERSION=2.5.10

export CA_IMAGE=hyperledger/fabric-ca
export CA_VERSION=1.5.12
export CA_VERSION=1.5.13

```

Expand Down Expand Up @@ -541,7 +541,6 @@ kubectl hlf identity create --name org2-admin --namespace default \
```bash
kubectl create secret generic wallet --namespace=default \
--from-file=org1msp.yaml=$PWD/org1msp.yaml \
--from-file=org2msp.yaml=$PWD/org2msp.yaml \
--from-file=orderermsp.yaml=$PWD/orderermsp.yaml \
--from-file=orderermspsign.yaml=$PWD/orderermspsign.yaml

Expand All @@ -567,9 +566,9 @@ kubectl apply -f - <<EOF
apiVersion: hlf.kungfusoftware.es/v1alpha1
kind: FabricMainChannel
metadata:
name: demo5
name: demo
spec:
name: demo5
name: demo
adminOrdererOrganizations:
- mspID: OrdererMSP
adminPeerOrganizations:
Expand Down
2 changes: 1 addition & 1 deletion controllers/followerchannel/followerchannel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func (r *FabricFollowerChannelReconciler) updateCRStatusOrFailReconcile(ctx cont
}
if p.Status.Status == hlfv1alpha1.FailedStatus {
return reconcile.Result{
RequeueAfter: 1 * time.Minute,
RequeueAfter: 5 * time.Minute,
}, nil
}
return reconcile.Result{
Expand Down
37 changes: 10 additions & 27 deletions controllers/mainchannel/mainchannel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/hyperledger/fabric-config/protolator"
"github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go/common"
mspa "github.com/hyperledger/fabric-protos-go/msp"
sb "github.com/hyperledger/fabric-protos-go/orderer/smartbft"
"github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
fab2 "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
Expand Down Expand Up @@ -722,7 +721,7 @@ func (r *FabricMainChannelReconciler) updateCRStatusOrFailReconcile(ctx context.
}
if p.Status.Status == hlfv1alpha1.FailedStatus {
return reconcile.Result{
RequeueAfter: 1 * time.Minute,
RequeueAfter: 5 * time.Minute,
}, nil
}
return reconcile.Result{}, nil
Expand Down Expand Up @@ -1383,10 +1382,7 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
return errors.Wrapf(err, "failed to get application configuration")
}
log.Infof("New config tx: %v", newConfigTx.Orderer)
err = currentConfigTX.Orderer().SetConfiguration(newConfigTx.Orderer)
if err != nil {
return errors.Wrapf(err, "failed to set orderer configuration")
}

currentConfig, err := currentConfigTX.Orderer().Configuration()
if err != nil {
return errors.Wrapf(err, "failed to get current orderer configuration")
Expand Down Expand Up @@ -1433,6 +1429,10 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
}
}
} else if newConfigTx.Orderer.OrdererType == orderer.ConsensusTypeBFT {
err = currentConfigTX.Orderer().SetConfiguration(newConfigTx.Orderer)
if err != nil {
return errors.Wrapf(err, "failed to set orderer configuration")
}
var consenterMapping []*cb.Consenter
for _, consenter := range newConfigTx.Orderer.ConsenterMapping {
consenterMapping = append(consenterMapping, &cb.Consenter{
Expand All @@ -1449,31 +1449,14 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
if err != nil {
return errors.Wrapf(err, "failed to set consenter mapping")
}

var identities []*mspa.MSPPrincipal
var pols []*cb.SignaturePolicy
for i, consenter := range consenterMapping {
if consenter == nil {
return fmt.Errorf("consenter %d in the mapping is empty", i)
}
pols = append(pols, &cb.SignaturePolicy{
Type: &cb.SignaturePolicy_SignedBy{
SignedBy: int32(i),
},
})
identities = append(identities, &mspa.MSPPrincipal{
PrincipalClassification: mspa.MSPPrincipal_IDENTITY,
Principal: protoutil.MarshalOrPanic(&mspa.SerializedIdentity{Mspid: consenter.MspId, IdBytes: consenter.Identity}),
})
}
}
err = currentConfigTX.Orderer().SetConfiguration(newConfigTx.Orderer)
if err != nil {
return errors.Wrapf(err, "failed to set orderer configuration")
}

// update
if ord.OrdererType == "BFT" {
err = currentConfigTX.Orderer().SetConfiguration(newConfigTx.Orderer)
if err != nil {
return errors.Wrapf(err, "failed to set orderer configuration")
}
log.Infof("updateOrdererChannelConfigTx: Orderer type: %s", ord.OrdererType)
// update policies but blockValidation
err = currentConfigTX.Orderer().SetPolicy("Admins", newConfigTx.Orderer.Policies["Admins"])
Expand Down
12 changes: 9 additions & 3 deletions kubectl-hlf/cmd/chaincode/getlatest.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package chaincode

import (
"io"
"io/ioutil"
"strconv"

"github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
"github.com/hyperledger/fabric-sdk-go/pkg/core/config"
"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"io"
"io/ioutil"
"strconv"
)

type getLatestInfoCmd struct {
Expand Down Expand Up @@ -46,9 +47,14 @@ func (c *getLatestInfoCmd) run(out io.Writer, stdErr io.Writer) error {
if err != nil {
return err
}
resmgmtOptions := []resmgmt.RequestOption{}
if c.peer != "" {
resmgmtOptions = append(resmgmtOptions, resmgmt.WithTargetEndpoints(c.peer))
}
committedCCs, err := resClient.LifecycleQueryCommittedCC(
c.channelName,
resmgmt.LifecycleQueryCommittedCCRequest{Name: c.name},
resmgmtOptions...,
)
if err != nil {
return err
Expand Down

0 comments on commit e67f3ac

Please sign in to comment.