hyperledger / bevel-operator-fabric

Hyperledger Fabric Kubernetes operator - Hyperledger Fabric operator for Kubernetes (v2.3, v2.4 and v2.5, soon 3.0)
https://hyperledger.github.io/bevel-operator-fabric/
Apache License 2.0
270 stars 91 forks source link

Problem join orderer to channel #21

Closed nkaramolegos closed 2 years ago

nkaramolegos commented 2 years ago

I am trying this command: kubectl hlf ordnode join --block=demo.block --name=ordservice --namespace=default --identity=admin-tls-ordservice.yaml and I have the following error:

INFO[0000] name=ordservice namespace=default
INFO[0000] Nodes=[0xc000298000]
Error: Orderer Node with name=ordservice.default not found

Until this point I have not any errors. How can I debug it?

Dviejopomata commented 2 years ago

Hi @nkaramolegos

I think that the ordservice was deployed on a different namespace, can you run this command and confirm that the orderer name is ordservice and namespace is default?

kubectl get fabricorderernodes.hlf.kungfusoftware.es  -A
nkaramolegos commented 2 years ago

Hi @Dviejopomata I can verify that. Specifically, NAMESPACE NAME STATE AGE default ord-node1 RUNNING 97s The previous command returns: kubectl hlf ca enroll --name=ord-ca --namespace=default --user=admin --secret=adminpw --mspid OrdererMSP -ca-name tlsca --output admin-tls-ordservice.yaml [fabsdk/fab] 2021/09/27 09:56:09 UTC - n/a -> INFO TLS Enabled [fabsdk/fab] 2021/09/27 09:56:09 UTC - n/a -> INFO generating key: &{A:ecdsa S:256} [fabsdk/fab] 2021/09/27 09:56:09 UTC - logbridge.(*cLogger).Info -> INFO encoded CSR Is it ok?

Dviejopomata commented 2 years ago

Hi @nkaramolegos

The orderer node is named as ord-node1, not ordservice

Can you try the following command?

kubectl hlf ordnode join --block=demo.block --name=ord-node1 --namespace=default --identity=admin-tls-ordservice.yaml
nkaramolegos commented 2 years ago

Nice. It works. How can I see the version of fabric running in the peer or orderer nodes?

nkaramolegos commented 2 years ago

Also, how can I pass a stringArray to ChangeCarOwner function?

Dviejopomata commented 2 years ago

Hi @nkaramolegos

The kubectl plugin abstracts you from the image and version used.

You can find the default image and tag used for both peers and orderers, keep in mind that the getting started only works for 2.3 since it uses the Channel participation API only available at this version.

https://github.com/kfsoftware/hlf-operator/blob/main/kubectl-hlf/cmd/helpers/constants.go#L13

In order to interact with the smart contract, it's recommended that you set up a client either with Node.JS, Java or Golang, the commands provided by the Kubectl plugin are only for testing purposes.

You can get the network config in this guide:

https://kfsoftware.github.io/hlf-operator/docs/user-guide/network-config

nkaramolegos commented 2 years ago

In order to interact with the smart contract, it's recommended that you set up a client either with Node.JS, Java or Golang, the commands provided by the Kubectl plugin are only for testing purposes.

You can get the network config in this guide:

https://kfsoftware.github.io/hlf-operator/docs/user-guide/network-config

I would like to it using Go. Can you give an example. I don't understand how this config will help me

Dviejopomata commented 2 years ago

Hi @nkaramolegos Network config is the standard way to define the orderers, peers and channel the SDK needs to connect to. You can use any programming language like Go, NodeJS or Java.

Take a look at fabric-samples: https://github.com/hyperledger/fabric-samples

nkaramolegos commented 2 years ago

Sorry for commenting on a closed issue but I really have not understood how to deploy the client application (GW) after deploying the network with the hlf-operator. I can see in the readme instruction that during invoke a transaction the queryAllCars function is called. Therefore, taking a look in fabric-samples I can see that the fabcar application is the appropriate application. However, I don't know how to use it inside my kind cluster where I had deployed the network using the hlf-operator. Any help will be very important. Thank you for your time.

nkaramolegos commented 2 years ago

Can you give some hint on that?

nkaramolegos commented 2 years ago

I am following these steps by setting the CA_NAME=org1-ca, USER_TYPE=client, USER_NAME=nikos, USER_PWD=nikospw but then I don't know how to deploy the fabcar client application from fabric-samples

dviejokfs commented 2 years ago

Hi @nkaramolegos

Could you upload the repository to be able to help you?

I don't know at what step you're having problems, whether it is when installing the chaincode, approving, committing or executing it.

nkaramolegos commented 2 years ago

I follow your steps until query the ledger and I have no problem. Next I would like to have an client application like this in Java or this in Javascript. For this reason, I generated the connection profile as you proposed before, I changed the network name to demo, I added a new user following these steps (after declaring the aforementioned ENVs) but I don't know how to find/use the wallet of the enrolled/registered user "nikos" to run my client application. Thus, the changes that I have made to official fabcar application are what I have just described.

dviejokfs commented 2 years ago

@nkaramolegos The wallet format of Hyperledger Fabric is a directory with files ending in .id, if you want to create a wallet you can create a folder, for example:

mkdir ./wallet

And then inside the wallet, you can create a file called, client.id:

cd wallet
touch client.id

The format of client.id is the following:

{
    "credentials": {
        "certificate": "<CRT>",
        "privateKey": "<PK>"
    },
    "mspId": "<YOUR_MSPID>",
    "type": "X.509",
    "version": 1
}

You can get the certificate and private key by enrolling a user and copying it to your client.id file.

This functionality will be added to the kubectl-hlf in the next release

nkaramolegos commented 2 years ago

Ok, I will try to run the application after doing that and I will be back. Where the next release is going public?

dviejokfs commented 2 years ago

@nkaramolegos

Start of february earliest, but beta late next week

dviejokfs commented 2 years ago

@nkaramolegos The changes are in this PR: https://github.com/kfsoftware/hlf-operator/pull/35

You can compile the kubectl plugin to have access:

  1. Clone the hlf-operator
  2. Execute the following commands
    cd kubectl-hlf
    go build -o hlf ./main.go && sudo mv hlf /usr/local/bin/kubectl-hlf

    The tag v1.5.0-beta1 is being built, you can also download the kubectl-plugin for your platform in the releases section

adityajoshi12 commented 2 years ago

Sorry for commenting on a closed issue but I really have not understood how to deploy the client application (GW) after deploying the network with the hlf-operator. I can see in the readme instruction that during invoke a transaction the queryAllCars function is called. Therefore, taking a look in fabric-samples I can see that the fabcar application is the appropriate application. However, I don't know how to use it inside my kind cluster where I had deployed the network using the hlf-operator. Any help will be very important. Thank you for your time.

Hi @nkaramolegos ,

I will add the client application in NodeJS and Golang shortly

adityajoshi12 commented 2 years ago

I have added the client application in NodeJS PR 42

nkaramolegos commented 2 years ago

The client application is not running in k8s. Correct? How the client knows where to connect to communicate with the BC network deployed in k8s?

dviejokfs commented 2 years ago

Hi @nkaramolegos You need to configure the connection-org.yaml, you can see how to get the kubeconfig in this documentation page: https://kfsoftware.github.io/hlf-operator/docs/user-guide/network-config

dviejokfs commented 2 years ago

Closing this issue since the topic has been changed, please @nkaramolegos reopen a new issue if necessary.

nkaramolegos commented 2 years ago

The difference between invokeCCgw and invokeCC is that the first one use the functionality added by HLF v2.4?

dviejokfs commented 2 years ago

@nkaramolegos Fabric gateway is an API added in the server side of the peers in 2.4. The nodes must be running 2.4+ version in order to use the fabric gateway