/bevel.git" # Gitops git repository URL for git push
- username: "git_username" # Git Service user who has rights to check-in in all branches
- password: "git_access_token" # Git Server user access token (Optional for ssh; Required for https)
- email: "git_email" # Email to use in git config
- private_key: "path_to_private_key" # Path to private key file which has write-access to the git repo (Optional for https; Required for ssh)
- # The participating nodes are named as peers
- services:
- peers:
- - peer:
- name: neworg
- subject: "O=Neworg,OU=Neworg,L=51.50/-0.13/London,C=GB" # This is the node subject. L=lat/long is mandatory for supplychain sample app
- type: validator # value can be validator or member, only applicable if consensus = 'ibft'
- geth_passphrase: 12345 # Passphrase to be used to generate geth account
- p2p:
- port: 21000
- ambassador: 15010 #Port exposed on ambassador service (use one port per org if using single cluster)
- rpc:
- port: 8546
- ambassador: 15011 #Port exposed on ambassador service (use one port per org if using single cluster)
- transaction_manager:
- port: 443
- ambassador: 443
- raft: # Only used if consensus = 'raft'
- port: 50401
- ambassador: 15013
- db: # Only used if transaction_manager = "tessera"
- port: 3306
-
-```
Below three new sections are added to the network.yaml
| Field | Description |
diff --git a/docs/source/index.md b/docs/source/index.md
index 6e489321c74..06fbe61269d 100644
--- a/docs/source/index.md
+++ b/docs/source/index.md
@@ -1,27 +1,27 @@
# Introduction
-Hyperledger Bevel is an advanced automation framework tailored for the seamless deployment of robust, production-ready Distributed Ledger Technology (DLT) networks on cloud-based infrastructures. Eliminating the need for intricate solution architecture, Bevel empowers teams to deliver with precision.
+Hyperledger Bevel is a sophisticated automation framework designed for the deployment of production-ready Distributed Ledger Technology (DLT) networks across cloud infrastructures. By eliminating the need for complex solution architecture, Bevel empowers teams to deliver with precision and efficiency.
![](./_static/bevel-overview.png)
## Key Features
- * Security Excellence: Bevel establishes a secure foundation for DLT development, implementing best practices in key management and providing essential security features by default.
- * Scalability at Its Core: Bevel's network implementation is designed for seamless scalability, allowing users to effortlessly expand their environment and resources according to project requirements.
- * Accelerated Deployment: Bevel expedites blockchain solution deployment, offering an opportunity for active participation and the acceleration of additional services.
+ - **Helm Charts**: Simplifies the deployment of complex DLT networks.
+ - **Security**: Implements best practices in key management.
+ - **Scalability**: Designed for seamless expansion.
+ - **Accelerated Deployment**: Expedites the creation of complex DLT environments.
+ - **Developer Flexibility**: Option to deploy without Hahsicorp Vault and Flux for streamlined development.
-Hyperledger Bevel serves as a pivotal accelerator, enabling developers to efficiently create a DLT environment. With Bevel, users not only expedite the creation of a DLT network but also ensure its suitability for continuous utilization throughout the project lifecycle.
+## Supported DLT Platforms
-## Which platforms does Bevel Support?
-
-Bevel currently supports the following DLT/Blockchain Platforms:
+Hyperledger Bevel currently supports the following DLT/Blockchain Platforms:
* [R3 Corda](https://docs.corda.net/)
* [Hyperledger Fabric](https://hyperledger-fabric.readthedocs.io)
* [Hyperledger Indy](https://hyperledger-indy.readthedocs.io/en/latest/)
* [Hyperledger Besu]( https://besu.hyperledger.org/en/stable/)
* [Quorum]( https://www.goquorum.com/)
- * [Substrate](https://www.parity.io/technologies/substrate/).
+ * [Substrate](https://www.parity.io/technologies/substrate/)
Get started with the [pre-requisites](./getting-started/prerequisites.md) to rapidly deploy blockchain networks.
diff --git a/docs/source/references/roadmap.md b/docs/source/references/roadmap.md
index b9cd9e4a61d..59e558daf5a 100644
--- a/docs/source/references/roadmap.md
+++ b/docs/source/references/roadmap.md
@@ -18,12 +18,13 @@ timeline
: Fabric
: Quorum
section 2024 Q3
- Deployment using Kubernetes Operator
- : Besu
- section 2024 Q4
Helm depencencies
: Indy
: Substrate
+ AWS secrets as vault
+ section 2024 Q4
+ Deployment using Kubernetes Operator
+ : Besu
```
@@ -37,27 +38,23 @@ Legend of annotations:
| :octicons-pin-16: | work to do |
| :octicons-check-16: | work completed |
| :material-run: | on-going work |
-| :octicons-trophy-16: | stretch goal |
+| :octicons-trophy-16: | stretch goal |
| :octicons-stop-16: | on hold |
## Documentation
-- :octicons-check-16: Spell and grammar linting
-- :octicons-check-16: Replace ansible roles readme with high level information
-- :octicons-check-16: Add helm chart readme for platform charts
-- :octicons-check-16: Complete restructure and redesign of documentation
+- :material-run: Spell linting workflow for PR checks
- :material-run: Format/Update configuration file and ops section
+- :material-run: Troubleshooting guide
+- :octicons-pin-16: deployment workflow guide
## General/Shared
- :material-run: Grafana and Promethus integration
- :material-run: Consistent variable names for helm chart values
-- :octicons-check-16: Support of Ambassador Edge Stack
-- :octicons-check-16: Add git actions to automate creation of helm repo chart artifacts
-- :octicons-check-16: Creation of vault auth role from the vault-k8s chart
-- :octicons-check-16: Add default values to chart templates/values section
+- :material-run: Add default values to chart templates/values section
- :octicons-trophy-16: Improve logging/error messaging in playbooks and log storage
- :octicons-trophy-16: Devcontainer for vscode containers/codespaces
- :octicons-trophy-16: Git commit/yaml linting
-- :octicons-trophy-16: Support for additional vault, hashicorp alternatives
+- :octicons-trophy-16: Support for additional vault, hashicorp alternatives
- :octicons-stop-16: Setup AWS cloudwatch exporter
## Platforms
@@ -66,40 +63,45 @@ Legend of annotations:
- :octicons-stop-16: HA Notary options
- :octicons-stop-16: Enable PostGreSQL support for Corda Enterprise
- :octicons-stop-16: Removal of node
- - :octicons-stop-16: Cacti connector for Corda opensource
- - :octicons-check-16: Corda enterprise Node/Notary v4.9 support
+ - :octicons-pin-16: Cacti connector for Corda opensource
+ - :octicons-pin-16: Deploy using just helm with no proxy, no vault option
+ - :octicons-pin-16: Corda enterprise and opensource Node/Notary v4.11 support
+ - :octicons-pin-16: Add cordapps operations and update docs
- R3 Corda OS v5
- - :octicons-pin-16: Base network deployment
+ - :octicons-stop-16: Base network deployment
- Hyperledger Fabric
- - :octicons-check-16: External chaincode for Fabric 2.2.x
- - :octicons-check-16: Support for Fabric 2.5.x
- - :material-run: Operational features for Fabric 2.5.x
+ - :octicons-pin-16: Deploy using just helm with no proxy, no vault option
+ - :octicons-pin-16: chaincode and channel mgmt. decoupled from network deployment
- :octicons-pin-16: chaincode operations via operator console
- - :octicons-pin-16: chaincode operations automation using bevel-operator-fabric
- - :octicons-pin-16: chaincode upgrade for external chaincode
+ - :octicons-stop-16: chaincode operations automation using bevel-operator-fabric
- :octicons-stop-16: CI/CD piplelines for chaincode deployment
- Hyperledger Besu
- :octicons-stop-16: Enable node discovery
- :octicons-stop-16: Enable bootnodes
- - :octicons-check-16: Add promethus/Grafana chart for node monitoring data
- - :octicons-check-16: Test onchain permission for Besu platform
- - :octicons-pin-16: Node version upgrades
- - :octicons-pin-16: Tessera version upgrades
+ - :octicons-pin-16: Test promethus/Grafana chart for node monitoring data
+ - :octicons-pin-16: Test tls cert creation using letsencrypt
+ - :octicons-pin-16: Test onchain permission for Besu platform
+ - :octicons-pin-16: Addition of new validator node and add guide for the same
+ - :octicons-pin-16: Besu node version upgrades
+ - :octicons-check-16: Tessera version upgrades
- :octicons-stop-16: Support for Besu node on public network
- Quorum
- - :octicons-pin-16: Deployment using just helm charts
+ - :octicons-pin-16: Deploy using just helm with no proxy, no vault option
+ - :octicons-pin-16: Addition of new validator node and add guide for the same
- Hyperledger Indy
- - :octicons-stop-16: Removal of organizations from a running Indy Network
- - ::octicons-pin-16: Node version upgrades
+ - :octicons-pin-16: Deploy using just helm with no proxy, no vault option
+ - :octicons-pin-16: Node version upgrades
+ - :octicons-stop-16: Removal of organizations from a running Indy Network
- Substrate
+ - :octicons-pin-16: Deploy using just helm with no proxy, no vault option
- :octicons-trophy-16: Test with generic substrate node
- :octicons-trophy-16: Adding of org/new node
## Bevel Samples
-- :octicons-pin-16: Upgrade Ambassador proxy to Edge stack
-- :octicons-pin-16: Upgrade rest server/middleware applications
-- :octicons-pin-16: Upgrade aca py application
+- :material-run: Upgrade Ambassador proxy to Edge stack
+- :material-run: Upgrade rest server/middleware applications
+- :octicons-pin-16: Test Hyperledger Aries contribution and see if can replace aca-py
## Bevel Kubernetes Operators
@@ -114,5 +116,4 @@ Legend of annotations:
- :octicons-stop-16: Architecture diagram
## DevOps-Pipeline
-
-- :material-run: GitHub Actions automation script for each DLT platform
+- :octicons-pin-16: Chart testing
diff --git a/docs/source/tutorials/index.md b/docs/source/tutorials/index.md
index b916ba76b0d..d517bee3967 100644
--- a/docs/source/tutorials/index.md
+++ b/docs/source/tutorials/index.md
@@ -1,12 +1,45 @@
# Tutorials
-These are the developer and operator tutorials:
-
-| Tutorial | Description |
-| :-------------------------- | :---------------------------------- |
-| [Developer pre-requisites](dev-prereq.md)| How to set up Developer pre-requisites|
-| [Deploy using Docker](docker-deploy.md) | How to use Bevel from a docker container which has all pre-requisites installed. |
-| [Deploy using Machine](machine-deploy.md) | How to use Bevel from your own machine. |
-| [Update DNS](dns-settings.md) | How to configure DNS for use with Bevel. |
-| [Use Bevel with minikube](bevel-minikube-setup.md)| How to deploy any network on minikube|
-| [Add a new StorageClass](adding-new-storageclass.md)| How to add a new StorageClass for a new Cloud Provider|
+Here are few developer and operator tutorials:
+
+
+
+- :fontawesome-solid-laptop-code:{ .lg .middle } __[Developer pre-requisites](dev-prereq.md)__
+
+ ---
+
+ Learn how to set up Developer pre-requisites.
+
+- :fontawesome-solid-box:{ .lg .middle } __[Deploy using Docker](docker-deploy.md)__
+
+ ---
+
+ Learn how to use Bevel from a docker container which has all pre-requisites installed.
+
+- :fontawesome-solid-laptop:{ .lg .middle } __[Deploy using Machine](machine-deploy.md)__
+
+ ---
+
+ Learn how to use Bevel from your own machine.
+
+- :material-dns-outline:{ .lg .middle } __[Update DNS](dns-settings.md)__
+
+ ---
+
+ Learn how to configure DNS for use with Bevel.
+
+- :material-school:{ .lg .middle } __[Use Bevel with minikube](bevel-minikube-setup.md)__
+
+ ---
+
+ Learn how to deploy any network on minikube.
+
+- :fontawesome-regular-hard-drive:{ .lg .middle } __[Add a new StorageClass](adding-new-storageclass.md)__
+
+ ---
+
+ Learn how to add a new StorageClass for a new Cloud Provider.
+
+
+
+
diff --git a/docs/source/tutorials/machine-deploy.md b/docs/source/tutorials/machine-deploy.md
index d8de332fcb9..f912d8a4389 100644
--- a/docs/source/tutorials/machine-deploy.md
+++ b/docs/source/tutorials/machine-deploy.md
@@ -8,7 +8,7 @@
To create a Production DLT/Blockchain network, ensure you have the following:
1. One running Kubernetes Cluster and the Config file (default ~/.kube.config) per Organization.
-1. One running Hashicorp Vault server per Organization. Unsealed and configured as per [guidance here](../getting-started/configure-prerequisites.md#vaultunseal).
+1. One running Hashicorp Vault server per Organization. Unsealed and configured as per [guidance here](../getting-started/configure-prerequisites.md#unseal-hashicorp-vault).
1. Domain Name(s) configured as per [tutorial here](../tutorials/dns-settings.md).
1. Git user details per Organization as per [pre-requisites](../getting-started/configure-prerequisites.md#gitops-authentication).
1. Ansible controller configured as per [guidance here](../getting-started/prerequisites-machine.md).
diff --git a/platforms/hyperledger-besu/charts/README.md b/platforms/hyperledger-besu/charts/README.md
index 1c9a423fd4d..c0ddcc017cd 100644
--- a/platforms/hyperledger-besu/charts/README.md
+++ b/platforms/hyperledger-besu/charts/README.md
@@ -6,7 +6,7 @@
# Charts for Hyperledger Besu components
## About
-This folder contains the helm charts which are used for the deployment of the Hyperledger Besu components. Each helm that you can use has the following keys and you need to set them. The `global.cluster.provider` is used as a key for the various cloud features enabled. Also you only need to specify one cloud provider, **not** both if deploying to cloud. As of writing this doc, AWS is fully supported.
+This folder contains the helm charts which are used for the deployment of the Hyperledger Besu components. Each helm chart that you can use has the following keys and you need to set them. The `global.cluster.provider` is used as a key for the various cloud features to be enabled. Also you only need to specify one cloud provider, **not** both if deploying to cloud. As of writing this doc, AWS is fully supported.
```yaml
global:
@@ -110,24 +110,48 @@ helm install genesis ./besu-genesis --namespace carrier-bes --values ./values/pr
helm install carrier ./besu-node --namespace carrier-bes --values ./values/proxy-and-vault/txnode-sec.yaml --set global.proxy.p2p=15016 --set node.besu.identity="O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
```
-### API Calls
-Once deployed, services are available as follows on the address as provided in your `global.proxy.externalUrlSuffix`.
+### API call
-```bash
-# HTTP RPC API
-curl -v -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://supplychainrpc.test.yourdomain.com
-
-# which should return (confirming that the node running the JSON-RPC service is syncing):
-{
- "jsonrpc" : "2.0",
- "id" : 1,
- "result" : "0x64"
-}
-```
+Once your services are deployed, they can be accessed using the domain name provided in your `global.proxy.externalUrlSuffix`.
+
+1. **Retrieve the Source Host for Your Node**
+
+ Run the following command to get the mapping for your node:
+
+ ```bash
+ kubectl get mapping --namespace supplychain-bes
+ ```
+
+ From the output, copy the source host for your node.
+
+2. **Make HTTP RPC API Calls**
+
+ You can interact with your node using HTTP RPC API calls. Here's an example of how to do it:
+
+ ```bash
+ curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://
+ ```
+
+ Replace `` with the source host you copied earlier.
+
+3. **Verify the Node Syncing Status**
+
+ If the node running the JSON-RPC service is syncing correctly, the previous command should return the following:
+
+ ```json
+ {
+ "jsonrpc" : "2.0",
+ "id" : 1,
+ "result" : "0x64"
+ }
+ ```
+
+ This confirms that your node is syncing as expected.
### Clean-up
-To clean up, just uninstall the helm releases.
+To clean up, simply uninstall the Helm releases. It's important to uninstall the genesis Helm chart at the end to prevent any cleanup failure.
+
```bash
helm uninstall --namespace supplychain-bes validator-1
helm uninstall --namespace supplychain-bes validator-2
@@ -138,5 +162,11 @@ helm uninstall --namespace supplychain-bes genesis
helm uninstall --namespace carrier-bes carrier
helm uninstall --namespace carrier-bes genesis
+```
+### Add and remove qbft validators
+
+To deploy the proposed validator chart, we need to deploy the Besu node chart first.
-```
\ No newline at end of file
+```bash
+helm install validator-5 ./besu-propose-validator --namespace supplychain-bes --values besu-propose-validator/values.yaml
+```
diff --git a/platforms/hyperledger-besu/charts/besu-genesis/README.md b/platforms/hyperledger-besu/charts/besu-genesis/README.md
index 4d599b9030d..6af902b63e9 100644
--- a/platforms/hyperledger-besu/charts/besu-genesis/README.md
+++ b/platforms/hyperledger-besu/charts/besu-genesis/README.md
@@ -14,7 +14,7 @@ helm repo add bevel https://hyperledger.github.io/bevel
helm install genesis bevel/besu-genesis
```
-## Prerequisitess
+## Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+
@@ -54,7 +54,7 @@ These parameters are refered to as same in each parent or child chart
| Name | Description | Default Value |
|--------|---------|-------------|
|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
-| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws` and `minikube` is tested | `aws` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently only `aws`, `azure` and `minikube` are tested | `aws` |
| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
| `global.cluster.kubernetesUrl` | URL of the Kubernetes Cluster | `""` |
| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
@@ -71,10 +71,10 @@ These parameters are refered to as same in each parent or child chart
| -------------| ---------- | --------- |
| `image.genesisUtils.repository` | Quorum/Besu hooks image repository | `ghcr.io/hyperledger/bevel-k8s-hooks` |
| `image.genesisUtils.tag` | Quorum/Besu hooks image tag | `qgt-0.2.12` |
-| `image.pullSecret` | Provide the docker secret name in the namespace | `""` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
| `image.pullPolicy` | Pull policy to be used for the Docker images | `IfNotPresent` |
-### TLS
+### Settings
| Name | Description | Default Value |
|--------|---------|-------------|
diff --git a/platforms/hyperledger-besu/charts/besu-genesis/requirements.yaml b/platforms/hyperledger-besu/charts/besu-genesis/requirements.yaml
index b878161ca1a..b1195396c5f 100644
--- a/platforms/hyperledger-besu/charts/besu-genesis/requirements.yaml
+++ b/platforms/hyperledger-besu/charts/besu-genesis/requirements.yaml
@@ -1,11 +1,11 @@
dependencies:
- name: bevel-vault-mgmt
- repository: "https://hyperledger.github.io/bevel"
+ repository: "file://../../../shared/charts/bevel-vault-mgmt"
tags:
- bevel
version: ~1.0.0
- name: bevel-scripts
- repository: "https://hyperledger.github.io/bevel"
+ repository: "file://../../../shared/charts/bevel-scripts"
tags:
- bevel
version: ~1.0.0
diff --git a/platforms/hyperledger-besu/charts/besu-genesis/templates/_helpers.tpl b/platforms/hyperledger-besu/charts/besu-genesis/templates/_helpers.tpl
index 3b8a9a0febe..48be575a0f7 100644
--- a/platforms/hyperledger-besu/charts/besu-genesis/templates/_helpers.tpl
+++ b/platforms/hyperledger-besu/charts/besu-genesis/templates/_helpers.tpl
@@ -27,4 +27,3 @@ Create chart name and version as used by the chart label.
{{- define "besu-genesis.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
-
diff --git a/platforms/hyperledger-besu/charts/besu-genesis/templates/genesis-job-cleanup.yaml b/platforms/hyperledger-besu/charts/besu-genesis/templates/genesis-job-cleanup.yaml
index d653afcd19e..c296b6aa511 100644
--- a/platforms/hyperledger-besu/charts/besu-genesis/templates/genesis-job-cleanup.yaml
+++ b/platforms/hyperledger-besu/charts/besu-genesis/templates/genesis-job-cleanup.yaml
@@ -41,11 +41,14 @@ spec:
- |
{{- if .Values.settings.removeGenesisOnDelete }}
+ if kubectl get configmap --namespace {{ .Release.Namespace }} besu-genesis &> /dev/null; then
+ echo "Deleting genesis configmap in k8s ..."
+ kubectl delete configmap --namespace {{ .Release.Namespace }} besu-genesis
+ fi
- echo "Deleting genesis configmap in k8s ..."
- kubectl delete configmap --namespace {{ .Release.Namespace }} besu-genesis
-
- echo "Deleting node-enodes configmap in k8s ..."
- kubectl delete configmap --namespace {{ .Release.Namespace }} besu-peers
+ if kubectl get configmap --namespace {{ .Release.Namespace }} besu-peers &> /dev/null; then
+ echo "Deleting node-enodes configmap in k8s ..."
+ kubectl delete configmap --namespace {{ .Release.Namespace }} besu-peers
+ fi
{{- end}}
diff --git a/platforms/hyperledger-besu/charts/besu-genesis/values.yaml b/platforms/hyperledger-besu/charts/besu-genesis/values.yaml
index 352c2355ce5..1aa90bfc651 100644
--- a/platforms/hyperledger-besu/charts/besu-genesis/values.yaml
+++ b/platforms/hyperledger-besu/charts/besu-genesis/values.yaml
@@ -11,10 +11,10 @@ global:
#Provide the service account name which will be created.
serviceAccountName: vault-auth
cluster:
- provider: aws # choose from: minikube | aws
- cloudNativeServices: false # 'false' is implemented
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
#Provide the kubernetes host url
- #Eg. kubernetesUrl: https://10.3.8.5:6443
+ #Eg. kubernetesUrl: https://10.3.8.5:8443
kubernetesUrl:
vault:
#Provide the type of vault
diff --git a/platforms/hyperledger-besu/charts/besu-node/README.md b/platforms/hyperledger-besu/charts/besu-node/README.md
index af27ae11581..fc7c1ad867c 100644
--- a/platforms/hyperledger-besu/charts/besu-node/README.md
+++ b/platforms/hyperledger-besu/charts/besu-node/README.md
@@ -14,7 +14,7 @@ helm repo add bevel https://hyperledger.github.io/bevel
helm install validator-1 bevel/besu-node
```
-## Prerequisitess
+## Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+
@@ -85,10 +85,10 @@ This is where you can override the values for the [besu-tessera-node subchart](.
### Image
| Name | Description | Default Value |
| -------------| ---------- | --------- |
-| `image.pullSecret` | Provide the docker secret name in the namespace | `""` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
| `image.pullPolicy` | Pull policy to be used for the Docker images | `IfNotPresent` |
| `image.besu.repository` | Besu image repository | `hyperledger/besu`|
-| `image.besu.tag` | Besu image tag as per version of Besu | `22.10.2`|
+| `image.besu.tag` | Besu image tag as per version of Besu | `23.10.2`|
| `image.hooks.repository` | Quorum/Besu hooks image repository | `ghcr.io/hyperledger/bevel-k8s-hooks` |
| `image.hooks.tag` | Quorum/Besu hooks image tag | `qgt-0.2.12` |
diff --git a/platforms/hyperledger-besu/charts/besu-node/requirements.yaml b/platforms/hyperledger-besu/charts/besu-node/requirements.yaml
index 9244f887e30..059282799c1 100644
--- a/platforms/hyperledger-besu/charts/besu-node/requirements.yaml
+++ b/platforms/hyperledger-besu/charts/besu-node/requirements.yaml
@@ -1,20 +1,20 @@
dependencies:
- name: bevel-storageclass
alias: storage
- repository: "https://hyperledger.github.io/bevel"
+ repository: "file://../../../shared/charts/bevel-storageclass"
tags:
- storage
version: ~1.0.0
- name: besu-tessera-node
alias: tessera
- repository: "https://hyperledger.github.io/bevel"
+ repository: "file://../besu-tessera-node"
tags:
- tessera
version: ~1.0.0
condition: tessera.enabled
- name: besu-tlscert-gen
alias: tls
- repository: "https://hyperledger.github.io/bevel"
+ repository: "file://../besu-tlscert-gen"
tags:
- bevel
version: ~1.0.0
diff --git a/platforms/hyperledger-besu/charts/besu-node/templates/besu-config-configmap.yaml b/platforms/hyperledger-besu/charts/besu-node/templates/besu-config-configmap.yaml
index 7b711609ce9..d0ef3e34c47 100644
--- a/platforms/hyperledger-besu/charts/besu-node/templates/besu-config-configmap.yaml
+++ b/platforms/hyperledger-besu/charts/besu-node/templates/besu-config-configmap.yaml
@@ -27,8 +27,7 @@ data:
node-private-key-file={{.Values.node.besu.privateKeyPath | quote }}
# Transaction Pool
- tx-pool-retention-hours={{ .Values.node.besu.txPool.retentionHours }}
- tx-pool-max-size={{ .Values.node.besu.txPool.maxSize }}
+ tx-pool-max-size={{ .Values.node.besu.txPool.maxCapacity }}
{{ if .Values.node.besu.p2p.enabled -}}
# P2P network
diff --git a/platforms/hyperledger-besu/charts/besu-node/templates/node-statefulset.yaml b/platforms/hyperledger-besu/charts/besu-node/templates/node-statefulset.yaml
index e6f8112cbbc..bb86f3f524e 100644
--- a/platforms/hyperledger-besu/charts/besu-node/templates/node-statefulset.yaml
+++ b/platforms/hyperledger-besu/charts/besu-node/templates/node-statefulset.yaml
@@ -96,6 +96,8 @@ spec:
- name: {{ .Release.Name }}-besu
image: {{ .Values.image.besu.repository }}:{{ .Values.image.besu.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
+ securityContext:
+ runAsUser: 0
resources:
requests:
cpu: "{{ .Values.node.besu.resources.cpuRequest }}"
@@ -172,10 +174,9 @@ spec:
--identity={{ .Values.node.besu.identity | quote }} --miner-enabled=false \
--Xdns-enabled=true --Xdns-update-enabled=true --Xnat-kube-service-name={{ include "besu-node.fullname" . }} \
--min-gas-price=0
-
livenessProbe:
httpGet:
- path: /liveness
+ path: /
port: 8545
initialDelaySeconds: 180
periodSeconds: 60
diff --git a/platforms/hyperledger-besu/charts/besu-node/values.yaml b/platforms/hyperledger-besu/charts/besu-node/values.yaml
index 837b34f6333..2fd6b191c68 100644
--- a/platforms/hyperledger-besu/charts/besu-node/values.yaml
+++ b/platforms/hyperledger-besu/charts/besu-node/values.yaml
@@ -49,7 +49,7 @@ image:
pullPolicy: IfNotPresent
besu:
repository: hyperledger/besu
- tag: 22.10.2
+ tag: 23.10.2
hooks:
repository: ghcr.io/hyperledger/bevel-k8s-hooks
tag: qgt-0.2.12
@@ -104,8 +104,7 @@ node:
port: 8547
corsOrigins: '["all"]'
txPool:
- retentionHours: 999
- maxSize: 1024
+ maxCapacity: 12
http:
allowlist: '["*"]'
metrics:
@@ -149,4 +148,4 @@ volumePermissionsFix:
labels:
service: []
pvc: []
- deployment: []
\ No newline at end of file
+ deployment: []
diff --git a/platforms/hyperledger-besu/charts/besu-propose-validator/Chart.yaml b/platforms/hyperledger-besu/charts/besu-propose-validator/Chart.yaml
new file mode 100644
index 00000000000..6cb9b839259
--- /dev/null
+++ b/platforms/hyperledger-besu/charts/besu-propose-validator/Chart.yaml
@@ -0,0 +1,20 @@
+apiVersion: v1
+name: besu-propose-validator
+description: "besu: Proposes to add or remove a validator with the specified address."
+version: 1.0.1
+appVersion: latest
+keywords:
+ - bevel
+ - ethereum
+ - besu
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-besu/charts/besu-propose-validator/README.md b/platforms/hyperledger-besu/charts/besu-propose-validator/README.md
new file mode 100644
index 00000000000..fb52300539a
--- /dev/null
+++ b/platforms/hyperledger-besu/charts/besu-propose-validator/README.md
@@ -0,0 +1,94 @@
+[//]: # (##############################################################################################)
+[//]: # (Copyright Accenture. All Rights Reserved.)
+[//]: # (SPDX-License-Identifier: Apache-2.0)
+[//]: # (##############################################################################################)
+
+# besu-propose-validator
+
+This chart is a component of Hyperledger Bevel. The besu-propose-validator chart injects a new authorization candidate that the validator attempts to push through. If a majority of the validators vote the candidate in/out, the candidate is added/removed in the validator set.
+
+## TL;DR
+
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install propose-validator bevel/besu-propose-validator
+```
+
+## Prerequisites
+
+- Kubernetes 1.19+
+- Helm 3.2.0+
+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
+
+> **Important**: Also check the dependent charts.
+
+## Installing the Chart
+
+To install the chart with the release name `propose-validator`:
+
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install propose-validator bevel/besu-propose-validator
+```
+
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
+
+> **Tip**: List all releases using `helm list`
+
+## Uninstalling the Chart
+
+To uninstall/delete the `besu-propose-validator` deployment:
+
+```bash
+helm uninstall besu-propose-validator
+```
+
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Image
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.genesisUtils.repository` | Besu hooks image repository | `ghcr.io/hyperledger/bevel-k8s-hooks` |
+| `image.genesisUtils.tag` | Besu hooks image tag | `qgt-0.2.12` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
+| `image.pullPolicy` | Pull policy to be used for the Docker images | `IfNotPresent` |
+
+### validators
+
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `validators.auth` | Set to 'true' to vote the candidate in and 'false' to vote them out | `true` |
+| `validators.authorizedValidatorsURL` | URLs of already authorized validators | `""` |
+| `validators.nonAuthorizedValidatorsNodeAddress` | Node addresses of the validators that need to be proposed | `""` |
+
+
+## License
+
+This chart is licensed under the Apache v2.0 license.
+
+Copyright © 2023 Accenture
+
+### Attribution
+
+This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
+
+```
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+```
diff --git a/platforms/hyperledger-besu/charts/besu-propose-validator/templates/_helpers.tpl b/platforms/hyperledger-besu/charts/besu-propose-validator/templates/_helpers.tpl
new file mode 100644
index 00000000000..3c89ba48f04
--- /dev/null
+++ b/platforms/hyperledger-besu/charts/besu-propose-validator/templates/_helpers.tpl
@@ -0,0 +1,31 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "besu-propose-validator.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "besu-propose-validator.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "besu-propose-validator.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
diff --git a/platforms/hyperledger-besu/charts/besu-propose-validator/templates/besu-propose-validator.yaml b/platforms/hyperledger-besu/charts/besu-propose-validator/templates/besu-propose-validator.yaml
new file mode 100644
index 00000000000..138c67ced1c
--- /dev/null
+++ b/platforms/hyperledger-besu/charts/besu-propose-validator/templates/besu-propose-validator.yaml
@@ -0,0 +1,58 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ include "besu-propose-validator.name" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: besu-propose-validator-job
+ app.kubernetes.io/component: propose-validator-job
+ app.kubernetes.io/part-of: {{ include "besu-propose-validator.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+spec:
+ backoffLimit: 3
+ template:
+ metadata:
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: besu-propose-validator-job
+ app.kubernetes.io/component: propose-validator-job
+ app.kubernetes.io/part-of: {{ include "besu-propose-validator.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ restartPolicy: "OnFailure"
+ containers:
+ - name: propose-validator
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ securityContext:
+ runAsUser: 0
+ env:
+ - name: EXISTING_VALIDATOR_URLS
+ value: "{{- .Values.validators.existingValidators | join " " -}}"
+ - name: PROPOSE_VALIDATOR_ADDRS
+ value: "{{- .Values.validators.proposeValidatorsAddr | join " " -}}"
+ - name: CONSENSUS_METHOD
+ value: "{{ .Values.validators.consensusMethod | join " " -}}"
+ command: ["/bin/sh", "-c"]
+ args:
+ - |
+
+ for propose_val_addr in $PROPOSE_VALIDATOR_ADDRS; do
+ for existing_val_url in $EXISTING_VALIDATOR_URLS; do
+ # Send proposal to the existing validator
+ proposal_response=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"$CONSENSUS_METHOD","params":["'"$propose_val_addr"'",{{ .Values.validators.auth }}],"id":1}' "$existing_val_url")
+
+ # Check if proposal was successful or not
+ result_count=$(echo "$proposal_response" | grep -c "result")
+ if [ "$result_count" = 1 ]; then
+ echo "Node proposed successfully."
+ else
+ echo "$proposal_response" | jq -r '.error'
+ fi
+ done
+ done
+ echo "COMPLETED"
diff --git a/platforms/hyperledger-besu/charts/besu-propose-validator/values.yaml b/platforms/hyperledger-besu/charts/besu-propose-validator/values.yaml
new file mode 100644
index 00000000000..6a95f1c0773
--- /dev/null
+++ b/platforms/hyperledger-besu/charts/besu-propose-validator/values.yaml
@@ -0,0 +1,23 @@
+image:
+ repository: ghcr.io/hyperledger/bevel-k8s-hooks
+ tag: qgt-0.2.12
+ pullPolicy: IfNotPresent
+ pullSecret: ""
+
+validators:
+ auth: true # Set to 'true' to vote the candidate in and 'false' to vote them out
+ # List of URLs of the existing validators
+ consensusMethod: # Choose one method from the list
+ # - "ibft_proposeValidatorVote"
+ #- "qbft_proposeValidatorVote"
+ # - "clique_propose"
+ existingValidators:
+ # - "http://"
+ # - "http://"
+ # - "http://"
+ # - "http://"
+ # List of node addresses of the validators that need to be proposed
+ proposeValidatorsAddr:
+ # - "<0xnodeAddress-1>"
+ # - "<0xnodeAddress-2>"
+ # - "<0xnodeAddress-3>"
diff --git a/platforms/hyperledger-besu/charts/besu-tessera-node/README.md b/platforms/hyperledger-besu/charts/besu-tessera-node/README.md
index 9b02022f3f7..3374181fbea 100644
--- a/platforms/hyperledger-besu/charts/besu-tessera-node/README.md
+++ b/platforms/hyperledger-besu/charts/besu-tessera-node/README.md
@@ -14,7 +14,7 @@ helm repo add bevel https://hyperledger.github.io/bevel
helm install my-tessera bevel/besu-tessera-node
```
-## Prerequisitess
+## Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+
@@ -88,7 +88,7 @@ These parameters are refered to as same in each parent or child chart
| `image.mysql.tag` | MySQL image tag | `5.7` |
| `image.hooks.repository` | Quorum/Besu hooks image repository | `ghcr.io/hyperledger/bevel-k8s-hooks` |
| `image.hooks.tag` | Quorum/Besu hooks image tag | `qgt-0.2.12` |
-| `image.pullSecret` | Provide the docker secret name in the namespace | `""` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
| `image.pullPolicy` | Pull policy to be used for the Docker images | `IfNotPresent` |
diff --git a/platforms/hyperledger-besu/charts/besu-tessera-node/requirements.yaml b/platforms/hyperledger-besu/charts/besu-tessera-node/requirements.yaml
index 21dec6373ba..5f3ec035eee 100644
--- a/platforms/hyperledger-besu/charts/besu-tessera-node/requirements.yaml
+++ b/platforms/hyperledger-besu/charts/besu-tessera-node/requirements.yaml
@@ -1,7 +1,7 @@
dependencies:
- name: bevel-storageclass
alias: storage
- repository: "https://hyperledger.github.io/bevel"
+ repository: "file://../../../shared/charts/bevel-storageclass"
tags:
- storage
version: ~1.0.0
diff --git a/platforms/hyperledger-besu/charts/besu-tessera-node/values.yaml b/platforms/hyperledger-besu/charts/besu-tessera-node/values.yaml
index 9176cc76101..c576bd7de5e 100644
--- a/platforms/hyperledger-besu/charts/besu-tessera-node/values.yaml
+++ b/platforms/hyperledger-besu/charts/besu-tessera-node/values.yaml
@@ -50,13 +50,13 @@ image:
#Eg. tessera: quorumengineering/tessera:0.9.2
tessera:
repository: quorumengineering/tessera
- tag: 22.1.7
+ tag: 23.4.0
#Provide the valid image name and version for busybox
busybox: busybox
#Provide the valid image name and version for MySQL. This is used as the DB for TM
mysql:
repository: mysql/mysql-server
- tag: 5.7
+ tag: 8.0.32
hooks:
repository: ghcr.io/hyperledger/bevel-k8s-hooks
tag: qgt-0.2.12
diff --git a/platforms/hyperledger-besu/charts/besu-tlscert-gen/README.md b/platforms/hyperledger-besu/charts/besu-tlscert-gen/README.md
index 50791980175..eebfdf7f89b 100644
--- a/platforms/hyperledger-besu/charts/besu-tlscert-gen/README.md
+++ b/platforms/hyperledger-besu/charts/besu-tlscert-gen/README.md
@@ -14,7 +14,7 @@ helm repo add bevel https://hyperledger.github.io/bevel
helm install my-release bevel/besu-tlscert-gen
```
-## Prerequisitess
+## Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+
@@ -57,9 +57,9 @@ These parameters are refered to as same in each parent or chold chart
| `global.vault.address`| URL of the Vault server. | `""` |
| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
| `global.vault.network` | Network type which will determine the vault policy | `besu` |
-| `global.vault.secretEngine` | Provide the value for vault secret engine name | `secretsv2` |
-| `global.vault.secretPrefix` | Provide the value for vault secret prefix which must start with `data/` | `data/supplychain` |
-| `global.proxy.externalUrlSuffix` | Provide the External URL suffix which will be used as CN to generate certificate | `test.blockchaincloudpoc.com` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.proxy.externalUrlSuffix` | External URL suffix which will be used as CN to generate certificate | `test.blockchaincloudpoc.com` |
### Image
@@ -67,14 +67,14 @@ These parameters are refered to as same in each parent or chold chart
|------------|-----------|---------|
| `image.repository` | Docker repository which will be used for this job | `ghcr.io/hyperledger/bevel-alpine` |
| `image.tag` | Docker image tag which will be used for this job | `latest` |
-| `image.pullSecret` | Provide the docker secret name | `""` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
| `image.pullPolicy` | The pull policy for the image | `IfNotPresent` |
### Settings
| Name | Description | Default Value |
| ------------| -------------- | --------------- |
| `settings.tmTls` | Set value to true when transaction manager like tessera uses tls. This enables TLS for the transaction manager and Besu node. | `True` |
-| `settings.certSubject` | Provide the X.509 subject for root CA | `"CN=DLT Root CA,OU=DLT,O=DLT,L=London,C=GB"` |
+| `settings.certSubject` | The X.509 subject for root CA | `"CN=DLT Root CA,OU=DLT,O=DLT,L=London,C=GB"` |
### Common parameters
diff --git a/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job-cleanup.yaml b/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job-cleanup.yaml
index aec761be4c1..2048640068f 100644
--- a/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job-cleanup.yaml
+++ b/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job-cleanup.yaml
@@ -43,5 +43,7 @@ spec:
- -c
args:
- |
- echo "Deleting tls-certs secret in k8s ..."
- kubectl delete secret --namespace {{ .Release.Namespace }} {{ include "besu-tlscert-gen.name" . }}-tls-certs
+ if kubectl get secret --namespace {{ .Release.Namespace }} {{ include "besu-tlscert-gen.name" . }}-tls-certs &>/dev/null; then
+ echo "Deleting tls-certs secret in k8s ..."
+ kubectl delete secret --namespace {{ .Release.Namespace }} {{ include "besu-tlscert-gen.name" . }}-tls-certs
+ fi
diff --git a/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job.yaml b/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job.yaml
index 66891ba8139..0270ecc814b 100644
--- a/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job.yaml
+++ b/platforms/hyperledger-besu/charts/besu-tlscert-gen/templates/job.yaml
@@ -95,8 +95,7 @@ spec:
cert=$(echo ${VAULT_SECRET} | jq -r '.["ambassadorcrt"]')
# If the cert is null, empty, or contains a parse error, then the certificates do not exist in Vault
- if [ "$cert" == "null" ] || [[ "$cert" = "parse error"* ]] || [ "$cert" = "" ]
- then
+ if [ "$cert" == "null" ] || [[ "$cert" = *"error"* ]] || [ "$cert" = "" ]; then
# Create a file to indicate that the ambassador TLS certificates are absent
echo "Certficates absent in vault. Ignore error warning"
touch ${OUTPUT_PATH}/ambassadortls_absent.txt
@@ -120,7 +119,7 @@ spec:
mountPath: /scripts/bevel-vault.sh
subPath: bevel-vault.sh
containers:
- - name: "generate-certs"
+ - name: "generate-certs"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ $.Values.image.pullPolicy }}
env:
@@ -313,8 +312,7 @@ spec:
# Check if any of the certificate and key fields are missing, empty or having any kind of error
for field in "$CA_PEM" "$CA_KEY" "$AMBASSADORCRT" "$AMBASSADORKEY" "$KEYSTORE" "$PASSWORD" "$KNOWNSERVER"
do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
+ if [ "$field" = "null" ] || [[ "$field" = *"error"* ]] || [ "$field" = "" ]; then
AMBASSADORTLS_CERT_WRITTEN=false
break
else
@@ -334,8 +332,7 @@ spec:
# Check if any of the certificate and key fields are missing, empty or having any kind of error
for field in "$CA_PEM" "$CA_KEY" "$AMBASSADORCRT" "$AMBASSADORKEY"
do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
+ if [ "$field" = "null" ] || [[ "$field" = *"error"* ]] || [ "$field" = "" ]; then
AMBASSADORTLS_CERT_WRITTEN=false
break
else
@@ -348,7 +345,7 @@ spec:
rm payload.json
fi;
# Create tls secret with the certificates
- kubectl get configmap --namespace {{ .Release.Namespace }} {{ include "besu-tlscert-gen.name" . }}-tls-certs
+ kubectl get secret --namespace {{ .Release.Namespace }} {{ include "besu-tlscert-gen.name" . }}-tls-certs
if [ $? -ne 0 ]; then
kubectl create secret tls --namespace {{ .Release.Namespace }} {{ include "besu-tlscert-gen.name" . }}-tls-certs \
--cert=${AMBASSADORTLS_PATH}/certchain.pem \
diff --git a/platforms/hyperledger-besu/configuration/roles/create/crypto/key_generation/tasks/main.yaml b/platforms/hyperledger-besu/configuration/roles/create/crypto/key_generation/tasks/main.yaml
deleted file mode 100644
index 934a4ec1af2..00000000000
--- a/platforms/hyperledger-besu/configuration/roles/create/crypto/key_generation/tasks/main.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-##############################################################################################
-# Copyright Walmart Inc. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-
-# Ensure the directory exists for storing keys
-- name: Ensure directory exists
- file:
- path: "{{ build_path }}/crypto/{{ user }}//{{ org.name }}"
- state: directory
- recurse: yes
-
-# Check if the key is present in Vault
-- name: Check if the {{ user }} key of {{ org.name }} is present in Vault
- shell: |
- # Retrieve the public and private keys from Vault
- vault kv get -field=key_pub {{ vault.secret_path | default('secretsv2') }}/{{ component_ns }}/crypto/{{ user }} > "{{ build_path }}/crypto/{{ user }}/{{ org.name }}/key_pub"
- vault kv get -field=key {{ vault.secret_path | default('secretsv2') }}/{{ component_ns }}/crypto/{{ user }} > "{{ build_path }}/crypto/{{ user }}/{{ org.name }}/key"
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- register: vault_result
- ignore_errors: yes
-
-# Set a flag to generate keys if they are not found in Vault
-- set_fact:
- generate_key: True
- when: vault_result.failed is defined and vault_result.failed == True
-
-# Generate a public key
-- name: Generate {{ user }}'s public key for {{ org.name }}
- shell: |
- # Generate a public key and move it to the specified location
- {{ bin_install_dir }}/besu/besu-{{ network.version }}/besu public-key export-address --to={{ build_path }}/crypto/{{ user }}/{{ org.name }}/key_pub
- mv {{ bin_install_dir }}/besu/key {{ build_path }}/crypto/{{ user }}/{{ org.name }}/key
- register: output
- when: generate_key is defined and generate_key == True
-
-# Store the public and private keys in Vault
-- name: Store the {{ user }}'s public and private keys in Vault
- shell: |
- # Store the public and private keys in Vault
- vault kv put {{ vault.secret_path | default('secretsv2') }}/{{ component_ns }}/crypto/{{ user }} key="$(cat {{ build_path }}/crypto/{{ user }}/{{ org.name }}/key)" key_pub="$(cat {{ build_path }}/crypto/{{ user }}/{{ org.name }}/key_pub)"
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: generate_key is defined and generate_key == True
diff --git a/platforms/hyperledger-besu/configuration/roles/create/crypto/node/tasks/main.yaml b/platforms/hyperledger-besu/configuration/roles/create/crypto/node/tasks/main.yaml
deleted file mode 100644
index dd55ba45357..00000000000
--- a/platforms/hyperledger-besu/configuration/roles/create/crypto/node/tasks/main.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-# Set node_list to empty
-- name: Set node_list to empty
- set_fact:
- node_list: []
-
-# Delete the previously created release file
-- name: Delete release file {{ organisation }}-node-key-mgmt
- file:
- path: "{{ values_dir }}/{{ organisation }}/{{ organisation }}-node-key-mgmt.yaml"
- state: absent
-
-# Git Push : Pushes the above generated files to git directory
-- name: Git Push
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
- vars:
- GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ org.gitops }}"
- msg: "[ci skip] Delete previous node key mgmt files"
-
-# Delete the previously created HelmRelease
-- name: Delete the previous {{ organisation }}-node-key-mgmt HelmRelease
- k8s:
- api_version: "helm.toolkit.fluxcd.io/v2beta1"
- kind: HelmRelease
- name: "{{ organisation }}-node-key-mgmt"
- namespace: "{{ organisation }}-bes"
- state: absent
- kubeconfig: "{{ kubernetes.config_file }}"
- context: "{{ kubernetes.context }}"
-
-# Fetch all node (peers and validators) present in all organizations of the network
-- name: Fetching all nodes of the organisation
- set_fact:
- node_list={{ node_list | default([]) + [ {'name':peer.name} ] }}
- loop: "{{ org.services.peers is defined | ternary(org.services.peers, org.services.validators) }}"
- loop_control:
- loop_var: peer
-
-# Creates node key mgmt value file for each organization
-- name: Create node key mgmt value file for each organization
- include_role:
- name: create/helm_component
- vars:
- name: "{{ org.name | lower }}"
- component_name: "{{ name }}-node-key-mgmt"
- component_ns: "{{ name }}-bes"
- type: "node_key_mgmt"
-
-# Git Push : Pushes the above generated files to git directory
-- name: Git Push
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
- vars:
- GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ org.gitops }}"
- msg: "[ci skip] Pushing node key mgmt files"
diff --git a/platforms/hyperledger-besu/configuration/roles/create/crypto/tessera/tasks/check_vault.yaml b/platforms/hyperledger-besu/configuration/roles/create/crypto/tessera/tasks/check_vault.yaml
deleted file mode 100644
index 04037922a19..00000000000
--- a/platforms/hyperledger-besu/configuration/roles/create/crypto/tessera/tasks/check_vault.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-
-# Check for the crypto material to the vault
-- name: Check the crypto material to Vault
- shell: |
- vault kv get -field=privateKey {{ vault.secret_path | default('secretsv2') }}/{{ component_ns }}/crypto/{{ item.name }}/tm
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- with_items: "{{ peers }}"
- register: vault_result
- ignore_errors: yes
-
-# Set a fact based on vault_result
-- set_fact:
- generate_crypto_tessera: True
- when: vault_result.failed is defined and vault_result.failed == True
diff --git a/platforms/hyperledger-besu/configuration/roles/create/crypto/tessera/tasks/main.yaml b/platforms/hyperledger-besu/configuration/roles/create/crypto/tessera/tasks/main.yaml
deleted file mode 100644
index 1b4ea201415..00000000000
--- a/platforms/hyperledger-besu/configuration/roles/create/crypto/tessera/tasks/main.yaml
+++ /dev/null
@@ -1,66 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-# Check the crypto material in the vault
-- name: Check for the crypto material in the vault
- include_tasks: check_vault.yaml
- vars:
- vault: "{{ org.vault }}"
- peers: "{{ org.services.peers }}"
-
-# Wait for namespace creation for members
-- name: "Wait for namespace creation for members"
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/k8_component"
- vars:
- component_type: "Namespace"
- component_name: "{{ component_ns }}"
- type: "retry"
- when:
- - generate_crypto_tessera is defined
- - generate_crypto_tessera
-
-# Generate Tessera crypto helmrelease file
-- name: "Create tessera crypto file"
- include_role:
- name: create/helm_component
- vars:
- component_type: "crypto"
- type: "besu_crypto_tessera"
- name: "{{ org.name | lower }}"
- component_name: "{{ peer.name }}-tessera-job"
- loop: "{{ org.services.peers }}"
- loop_control:
- loop_var: peer
- when:
- - generate_crypto_tessera is defined
- - generate_crypto_tessera
-
-# Push the created deployment files to repository
-- name: "Push the created deployment files to repository"
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
- vars:
- GIT_DIR: "{{ playbook_dir }}/../../../"
- msg: "[ci skip] Pushing tessera job files for {{ component_ns }}"
- when:
- - generate_crypto_tessera is defined
- - generate_crypto_tessera
-
-# Check if tessera crypto job is completed
-- name: Check if tessera crypto job is completed
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component"
- vars:
- component_name: "{{ peer.name }}-tessera-job"
- component_type: Job
- namespace: "{{ component_ns }}"
- loop: "{{ org.services.peers }}"
- loop_control:
- loop_var: peer
- when:
- - generate_crypto_tessera is defined
- - generate_crypto_tessera
diff --git a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/ambassador_besu.tpl b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/ambassador_besu.tpl
index 2260d16461f..48a6e08e71a 100644
--- a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/ambassador_besu.tpl
+++ b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/ambassador_besu.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/crypto_tessera.tpl b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/crypto_tessera.tpl
index f9621a4b4f8..63273029fa0 100644
--- a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/crypto_tessera.tpl
+++ b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/crypto_tessera.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/member.tpl b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/member.tpl
index e8302c80c6d..83142b52376 100644
--- a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/member.tpl
+++ b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/member.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name | replace('_','-') }}
@@ -60,10 +60,12 @@ spec:
{% endif %}
tessera:
removeKeysOnDelete: true
+{% if org.type == 'member' or org.type is not defined %}
peerNodes:
{% for tm_node in network.config.tm_nodes %}
- url: {{ tm_node | quote }}
{% endfor %}
+{% endif %}
resources:
cpuLimit: 0.25
cpuRequest: 0.05
@@ -105,7 +107,7 @@ spec:
tag: {{ network.version }}
node:
removeKeysOnDelete: false
- isBootnode: {{ peer.bootnode | default(false) }}
+ isBootnode: false
usesBootnodes: false
besu:
identity: {{ peer.subject | quote }}
diff --git a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/node_key_mgmt.tpl b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/node_key_mgmt.tpl
index 9abdd10bafd..32a2a7f6a5e 100644
--- a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/node_key_mgmt.tpl
+++ b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/node_key_mgmt.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/validator.tpl b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/validator.tpl
index 69a4aba7064..d8c40fa8fdb 100644
--- a/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/validator.tpl
+++ b/platforms/hyperledger-besu/configuration/roles/create/helm_component/templates/validator.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name | replace('_','-') }}
diff --git a/platforms/hyperledger-besu/configuration/roles/create/member/tasks/main.yaml b/platforms/hyperledger-besu/configuration/roles/create/member/tasks/main.yaml
index f6f30106268..1f1d609cb3e 100644
--- a/platforms/hyperledger-besu/configuration/roles/create/member/tasks/main.yaml
+++ b/platforms/hyperledger-besu/configuration/roles/create/member/tasks/main.yaml
@@ -10,7 +10,14 @@
name: setup/genesis/secondary
vars:
values_dir: "./build/{{ component_ns }}"
+ when: org.type == 'member'
+# Get the Genesis and staticnodes
+- name: Get genesis and staticnodes
+ include_role:
+ name: get/genesis
+ when: org.type == 'member' and org.services.peers is defined
+
# Creates the Besu node value files for each node of organization
- name: Create value file for Besu node
include_role:
@@ -44,21 +51,3 @@
component_name: "{{ member.name | lower }}"
namespace: "{{ component_ns }}"
when: org.services.peers is defined
-
-# Get the Genesis and staticnodes
-- name: Get genesis and staticnodes
- include_role:
- name: get/genesis
- when: org.services.peers is defined
-
-# Add the enode of new organizations to each of the existing nodes using rpc call only when ambassador is used
-- name: Adding the enode of new peer to all existing peer.
- include_role:
- name: setup/new_member
- loop: "{{ org.services.peers }}"
- loop_control:
- loop_var: peer
- when:
- - org.services.peers is defined
- - network.config.besu_nodes is defined
- - network.env.proxy == 'ambassador'
diff --git a/platforms/hyperledger-besu/configuration/roles/create/validator/tasks/main.yaml b/platforms/hyperledger-besu/configuration/roles/create/validator/tasks/main.yaml
index 45491fa4f6f..aa469e51c69 100644
--- a/platforms/hyperledger-besu/configuration/roles/create/validator/tasks/main.yaml
+++ b/platforms/hyperledger-besu/configuration/roles/create/validator/tasks/main.yaml
@@ -16,7 +16,7 @@
loop_var: peer
when: org.services.validators is defined
-# Git Push : Pushes the above generated files to git directory
+# Git Push : Pushes the above generated files to git
- name: Git Push
include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
diff --git a/platforms/hyperledger-besu/configuration/roles/delete/vault_secrets/tasks/main.yaml b/platforms/hyperledger-besu/configuration/roles/delete/vault_secrets/tasks/main.yaml
index c2111410480..b7968d8d224 100644
--- a/platforms/hyperledger-besu/configuration/roles/delete/vault_secrets/tasks/main.yaml
+++ b/platforms/hyperledger-besu/configuration/roles/delete/vault_secrets/tasks/main.yaml
@@ -19,7 +19,7 @@
state: absent
kubeconfig: "{{ kubernetes.config_file }}"
context: "{{ kubernetes.context }}"
- ignore_errors: yes
+ ignore_errors: true
# Deletes crypto materials
- name: Delete Crypto material
@@ -28,10 +28,10 @@
vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/tessera-{{ peer.name }}-keys
vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/tlscerts
vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/genesis
- loop: "{{ services.peers is defined | ternary( services.peers, services.validators) }}"
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
+ loop: "{{ services.peers is defined | ternary( services.peers, services.validators) }}"
loop_control:
loop_var: peer
- ignore_errors: yes
+ ignore_errors: true
diff --git a/platforms/hyperledger-fabric/charts/README.md b/platforms/hyperledger-fabric/charts/README.md
new file mode 100644
index 00000000000..2138f817aa7
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/README.md
@@ -0,0 +1,257 @@
+[//]: # (##############################################################################################)
+[//]: # (Copyright Accenture. All Rights Reserved.)
+[//]: # (SPDX-License-Identifier: Apache-2.0)
+[//]: # (##############################################################################################)
+
+# Charts for Hyperledger Fabric components
+
+## About
+This folder contains the helm charts which are used for the deployment of the Hyperledger Fabric components. Each helm that you can use has the following keys and you need to set them. The `global.cluster.provider` is used as a key for the various cloud features enabled. Also you only need to specify one cloud provider, **not** both if deploying to cloud. As of writing this doc, AWS and Azure is fully supported.
+
+```yaml
+global:
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure
+ cloudNativeServices: false # future: set to true to use Cloud Native Services
+ kubernetesUrl: "https://yourkubernetes.com" # Provide the k8s URL, ignore if not using Hashicorp Vault
+ vault:
+ type: hashicorp # choose from hashicorp | kubernetes
+ network: fabric # must be fabric for these charts
+ # Following are necessary only when hashicorp vault is used.
+ address: http://vault.url:8200
+ authPath: supplychain
+ secretEngine: secretsv2
+ secretPrefix: "data/supplychain"
+ role: vault-role
+ proxy:
+ provider: haproxy # choose from haproxy | none
+ externalUrlSuffix: test.yourdomain.com
+```
+
+## Usage
+
+### Pre-requisites
+
+- Kubernetes Cluster (either Managed cloud option like EKS or local like minikube)
+- Accessible and unsealed Hahsicorp Vault (if using Vault)
+- Configured Haproxy (if using Haproxy as proxy)
+- Update the dependencies
+ ```
+ helm dependency update fabric-ca-server
+ helm dependency update fabric-orderernode
+ helm dependency update fabric-peernode
+ ```
+
+### _Without Proxy or Vault_
+
+#### Setup Orderers and Peers in an organization
+```bash
+# Install the CA Server
+helm upgrade --install supplychain-ca ./fabric-ca-server --namespace supplychain-net --create-namespace --values ./values/noproxy-and-novault/ca-orderer.yaml
+
+# Install the Orderers after CA server is running
+helm upgrade --install orderer1 ./fabric-orderernode --namespace supplychain-net --values ./values/noproxy-and-novault/orderer.yaml
+helm upgrade --install orderer2 ./fabric-orderernode --namespace supplychain-net --values ./values/noproxy-and-novault/orderer.yaml --set certs.settings.createConfigMaps=false
+helm upgrade --install orderer3 ./fabric-orderernode --namespace supplychain-net --values ./values/noproxy-and-novault/orderer.yaml --set certs.settings.createConfigMaps=false
+```
+
+**Note** The orderers will remain waiting in the `Pending` state for Fabric 2.2.x, until we install the `fabric-genesis` chart.
+
+```bash
+# OPTIONAL: To use a custom peer configuration, copy core.yaml file into ./fabric-peernode/files
+cp /home/bevel/build/peer0-core.yaml ./fabric-peernode/conf/default_core.yaml
+# Install the peers
+helm upgrade --install peer0 ./fabric-peernode --namespace supplychain-net --values ./values/noproxy-and-novault/peer.yaml
+helm upgrade --install peer1 ./fabric-peernode --namespace supplychain-net --values ./values/noproxy-and-novault/peer.yaml --set peer.gossipPeerAddress=peer0.supplychain-net:7051 --set peer.cliEnabled=true
+```
+
+#### Setup Peers in another organization
+
+```bash
+# Install the CA Server
+helm upgrade --install carrier-ca ./fabric-ca-server --namespace carrier-net --create-namespace --values ./values/noproxy-and-novault/ca-peer.yaml
+
+# Get the Orderer tls certificate and place in fabric-peernode/files
+cd ./fabric-peernode/files
+kubectl --namespace supplychain-net get configmap orderer-tls-cacert -o jsonpath='{.data.cacert}' > orderer.crt
+
+# Install the Peers
+cd ../..
+helm upgrade --install peer0 ./fabric-peernode --namespace carrier-net --values ./values/noproxy-and-novault/carrier.yaml
+```
+
+#### Create Genesis file and other channel artifacts
+```bash
+# Obtain certificates and the configuration file of each peer organization, place in fabric-genesis/files
+cd ./fabric-genesis/files
+kubectl --namespace carrier-net get secret admin-msp -o json > carrier.json
+kubectl --namespace carrier-net get configmap peer0-msp-config -o json > carrier-config-file.json
+
+# OPTIONAL: If additional orderer from a different organization is needed in genesis
+kubectl --namespace carrier-net get secret orderer5-tls -o json > orderer5-orderer-tls.json
+
+# Generate the genesis block
+cd ../..
+helm install genesis ./fabric-genesis --namespace supplychain-net --values ./values/noproxy-and-novault/genesis.yaml
+```
+
+#### Create channel for Hyperledger Fabric 2.5.x
+```bash
+# Create channel
+helm install allchannel ./fabric-osnadmin-channel-create --namespace supplychain-net --set global.vault.type=kubernetes
+
+# Join peer to channel and make it an anchorpeer
+helm install peer0-allchannel ./fabric-channel-join --namespace supplychain-net --set global.vault.type=kubernetes
+helm install peer1-allchannel ./fabric-channel-join --namespace supplychain-net --set global.vault.type=kubernetes --set peer.name=peer1 --set peer.address=peer1.supplychain-net:7051
+
+# Join peer from another organization to channel and make it an anchorpeer
+helm install peer0-allchannel ./fabric-channel-join --namespace carrier-net --values ./values/noproxy-and-novault/join-channel.yaml
+```
+**Note** Anchorpeer job is only executed if `peer.type` is set to `anchor`
+
+#### Create channel for Hyperledger Fabric 2.2.x
+
+```bash
+# Obtain the file channel.tx and place it in fabric-channel-create/files
+cd ./fabric-channel-create/files
+kubectl --namespace supplychain-net get configmap allchannel-channeltx -o jsonpath='{.data.allchannel-channeltx_base64}' > channeltx.json
+
+# Install create channel
+cd ../..
+helm install allchannel ./fabric-channel-create --namespace carrier-net --set global.vault.type=kubernetes
+
+# Join peer to channel and make it an anchorpeer. Repeat for each peer organization.
+# Get the file anchors.tx and place it in fabric-channel-join/files
+cd ./fabric-channel-join/files
+kubectl --namespace supplychain-net get configmap allchannel-supplychain-anchortx -o jsonpath='{.data.allchannel-supplychain-anchortx_base64}' > anchortx.json
+
+# Install join channel and anchorpeer
+cd ../..
+helm install peer0-allchannel ./fabric-channel-join --namespace supplychain-net --set global.vault.type=kubernetes --set global.version=2.2.2
+helm install peer1-allchannel ./fabric-channel-join --namespace supplychain-net --set global.vault.type=kubernetes --set global.version=2.2.2 --set peer.name=peer1 --set peer.address=peer1.supplychain-net:7051 --set peer.type=general
+
+# Join peer from another organization to channel and make it an anchorpeer
+cd ./fabric-channel-join/files
+kubectl --namespace supplychain-net get configmap allchannel-carrier-anchortx -o jsonpath='{.data.allchannel-carrier-anchortx_base64}' > anchortx.json
+cd ../..
+helm install peer0-allchannel ./fabric-channel-join --namespace carrier-net --values ./values/noproxy-and-novault/join-channel.yaml
+```
+**Note** Anchorpeer job is only executed if `peer.type` is set to `anchor`
+
+### _With Haproxy Proxy and Vault_
+
+#### Setup Orderers and Peers in an organization
+
+Replace the `"http://vault.url:8200"`, `"https://yourkubernetes.com"` and `"test.yourdomain.com"` in all the files in `./values/proxy-and-vault/` folder and this file.
+
+```bash
+kubectl create namespace supplychain-net
+
+kubectl -n supplychain-net create secret generic roottoken --from-literal=token=
+
+helm upgrade --install supplychain-ca ./fabric-ca-server --namespace supplychain-net --values ./values/proxy-and-vault/ca-orderer.yaml
+
+# Install the Orderers after CA server is running
+helm upgrade --install orderer1 ./fabric-orderernode --namespace supplychain-net --values ./values/proxy-and-vault/orderer.yaml
+helm upgrade --install orderer2 ./fabric-orderernode --namespace supplychain-net --values ./values/proxy-and-vault/orderer.yaml --set certs.settings.createConfigMaps=false
+helm upgrade --install orderer3 ./fabric-orderernode --namespace supplychain-net --values ./values/proxy-and-vault/orderer.yaml --set certs.settings.createConfigMaps=false
+```
+
+**Note** The orderers will remain waiting in the `Pending` state for Fabric 2.2.x, until we install the `fabric-genesis` chart.
+
+```bash
+# OPTIONAL: To use a custom peer configuration, copy core.yaml file into ./fabric-peernode/files
+cp /home/bevel/build/peer0-core.yaml ./fabric-peernode/conf/default_core.yaml
+# Install the peers
+helm upgrade --install peer0 ./fabric-peernode --namespace supplychain-net --values ./values/proxy-and-vault/peer.yaml
+helm upgrade --install peer1 ./fabric-peernode --namespace supplychain-net --values ./values/proxy-and-vault/peer.yaml --set peer.gossipPeerAddress=peer0.supplychain-net.hlf.blockchaincloudpoc-develop.com:443 --set peer.cliEnabled=true
+```
+
+#### Setup Peers in another organization
+
+```bash
+kubectl create namespace carrier-net
+kubectl -n carrier-net create secret generic roottoken --from-literal=token=
+# Install the CA Server
+helm upgrade --install carrier-ca ./fabric-ca-server --namespace carrier-net --values ./values/proxy-and-vault/ca-peer.yaml
+
+# Get the Orderer tls certificate and place in fabric-peernode/files
+cd ./fabric-peernode/files
+kubectl --namespace supplychain-net get configmap orderer-tls-cacert -o jsonpath='{.data.cacert}' > orderer.crt
+
+# Install the Peers
+cd ../..
+helm upgrade --install peer0 ./fabric-peernode --namespace carrier-net --values ./values/proxy-and-vault/carrier.yaml
+```
+
+#### Create Genesis file and other channel artifacts
+```bash
+# Obtain certificates and the configuration file of each peer organization, place in fabric-genesis/files
+cd ./fabric-genesis/files
+kubectl --namespace carrier-net get secret admin-msp -o json > carrier.json
+kubectl --namespace carrier-net get configmap peer0-msp-config -o json > carrier-config-file.json
+
+# OPTIONAL: If additional orderer from a different organization is needed in genesis
+kubectl --namespace carrier-net get secret orderer5-tls -o json > orderer5-orderer-tls.json
+
+# Generate the genesis block
+cd ../..
+helm install genesis ./fabric-genesis --namespace supplychain-net --values ./values/proxy-and-vault/genesis.yaml
+```
+
+#### Create channel for Hyperledger Fabric 2.5.x
+```bash
+# Create channel
+helm install allchannel ./fabric-osnadmin-channel-create --namespace supplychain-net --values ./values/proxy-and-vault/osn-create-channel.yaml
+
+# Join peer to channel and make it an anchorpeer
+helm install peer0-allchannel ./fabric-channel-join --namespace supplychain-net --values ./values/proxy-and-vault/join-channel.yaml
+helm install peer1-allchannel ./fabric-channel-join --namespace supplychain-net --values ./values/proxy-and-vault/join-channel.yaml --set peer.name=peer1 --set peer.address=peer1.supplychain-net.test.yourdomain.com:443
+
+# Join peer from another organization to channel and make it an anchorpeer
+helm install peer0-allchannel ./fabric-channel-join --namespace carrier-net --values ./values/proxy-and-vault/create-channel.yaml --set global.version=2.5.4
+```
+**Note** Anchorpeer job is only executed if `peer.type` is set to `anchor`
+
+#### Create channel for Hyperledger Fabric 2.2.x
+```bash
+# Obtain the file channel.tx and place it in fabric-channel-create/files
+cd ./fabric-channel-create/files
+kubectl --namespace supplychain-net get configmap allchannel-channeltx -o jsonpath='{.data.allchannel-channeltx_base64}' > channeltx.json
+
+# Install create channel
+cd ../..
+helm install allchannel ./fabric-channel-create --namespace carrier-net --values ./values/proxy-and-vault/create-channel.yaml
+
+# Join peer to channel and make it an anchorpeer. Repeat for each peer organization.
+# Get the file anchors.tx and place it in fabric-channel-join/files
+cd ./fabric-channel-join/files
+kubectl --namespace supplychain-net get configmap allchannel-supplychain-anchortx -o jsonpath='{.data.allchannel-supplychain-anchortx_base64}' > anchortx.json
+
+# Install join channel and anchorpeer
+cd ../..
+helm install peer0-allchannel ./fabric-channel-join --namespace supplychain-net --values ./values/proxy-and-vault/join-channel.yaml
+helm install peer1-allchannel ./fabric-channel-join --namespace supplychain-net --values ./values/proxy-and-vault/join-channel.yaml --set peer.name=peer1 --set peer.address=peer1.supplychain-net.test.yourdomain.com:443 --set peer.type=general
+
+# Join peer from another organization to channel and make it an anchorpeer
+cd ./fabric-channel-join/files
+kubectl --namespace supplychain-net get configmap allchannel-carrier-anchortx -o jsonpath='{.data.allchannel-carrier-anchortx_base64}' > anchortx.json
+cd ../..
+helm install peer0-allchannel ./fabric-channel-join --namespace carrier-net --values ./values/proxy-and-vault/create-channel.yaml
+```
+**Note** Anchorpeer job is only executed if `peer.type` is set to `anchor`
+
+### Clean-up
+
+To clean up, just uninstall the helm releases
+```bash
+helm uninstall --namespace supplychain-net peer1-allchannel peer0-allchannel
+helm uninstall --namespace supplychain-net peer0 peer1
+helm uninstall --namespace supplychain-net orderer1 orderer2 orderer3
+helm uninstall --namespace supplychain-net genesis allchannel
+helm uninstall --namespace supplychain-net supplychain-ca
+
+helm uninstall --namespace carrier-net peer0 peer0-allchannel allchannel
+helm uninstall --namespace carrier-net carrier-ca
+```
diff --git a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-anchorpeer/Chart.yaml
deleted file mode 100644
index b59929ffe7f..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/Chart.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Updates the anchorpeer details."
-name: fabric-anchorpeer
-version: 1.0.0
diff --git a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/README.md b/platforms/hyperledger-fabric/charts/fabric-anchorpeer/README.md
deleted file mode 100644
index 4cc51aa258d..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/README.md
+++ /dev/null
@@ -1,199 +0,0 @@
-[//]: # (##############################################################################################)
-[//]: # (Copyright Accenture. All Rights Reserved.)
-[//]: # (SPDX-License-Identifier: Apache-2.0)
-[//]: # (##############################################################################################)
-
-
-# Anchor Peer Hyperledger Fabric Deployment
-
-- [Anchor Peer Hyperledger Fabric Deployment Helm Chart](#anchor-peer-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
-
-
-
-## Anchor Peer Hyperledger Fabric Deployment Helm Chart
----
-This [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-anchorpeer) updates the anchor peers for the Hyperledger Fabric channel.
-
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
-
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-fabric-anchorpeer/
- |- templates/
- |- _helpers.yaml
- |- anchorpeer.yaml
- |- configmap.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `anchorpeer.yaml`: Uses two initContainers to fetch the orderer TLS certificates and the MSP certificates from Vault. The main container then uses the fetched certificates to update the anchor peer for the channel.
-- `configmap.yaml`: Stores configuration data for an anchor peer. The file contains two ConfigMaps, one for the configuration data and one for the artifacts. The configuration ConfigMap contains the key-value pairs that are used to configure the peer, and the artifacts ConfigMap contains the base64-encoded transaction that anchors the peer to the channel.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-anchorpeer/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-## Parameters
----
-
-### Metadata
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------------------------------------------------------| --------------------------------------------------|
-| namespace | Provide the namespace for organization's peer | org1-net |
-| images.fabrictools | Provide the valid image name and version | ghcr.io/hyperledger/bevel-fabric-tools:2.2.2 |
-| images.alpineutils | Provide the valid image name and version to read certificates from vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| labels | Provide the custom labels | "" |
-
-### Peer
-
-| Name | Description | Default Value |
-| --------------| --------------------------------------------------------------------------------------------------------| ------------------------------|
-| name | Provide the name of the peer as per deployment yaml | peer0 |
-| address | Provide the address of the peer which will update the channel about the anchor peer of the organization | peer0.org1-net:7051 |
-| localmspid | Provide the localmspid for organization | org1MSP |
-| loglevel | Provide the loglevel for organization's peer | debug |
-| tlsstatus | Provide the value for tlsstatus to be true or false for organization's peer | true |
-
-### Vault
-
-| Name | Description | Default Value |
-| ---------------------| ----------------------------------------------------------------------------| -----------------------------|
-| role | Provide the vaultrole for an organization | vault-role |
-| address | Provide the vault server address | "" |
-| authpath | Provide the kubernetes auth backed configured in vault for an organization | devorg1-net-auth |
-| adminsecretprefix | Provide the value for vault secretprefix | secretsv2/data/crypto/peerOrganizations/org1-net/users/admin |
-| orderersecretprefix | Provide the value for vault secretprefix | secretsv2/data/data/crypto/peerOrganizations/org1-nets/orderer |
-| serviceaccountname | Provide the serviceaccount name for vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Provide the imagesecretname for vault | "" |
-| tls | Enable or disable TLS for vault communication | "" |
-
-### Channel
-
-| Name | Description | Default Value |
-| ----------| -------------------------------------|---------------|
-| name | Provide the name of the channel | mychannel |
-
-### orderer
-
-| Name | Description | Default Value |
-| -----------| -----------------------------------|----------------------------|
-| address | Provide the address for orderer | orderer1.org1proxy.blockchaincloudpoc.com:443 |
-
-### anchorstx
-
-| Name | Description | Default Value |
-| ---------------| ---------------------------------------------------------| ------------- |
-| anchorstx | Provide the base64 encoded file contents for anchorstx | "" |
-
-
-
-## Deployment
----
-
-To deploy the fabric-anchorpeer Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-anchorpeer/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-anchorpeer
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the fabric-anchorpeer job to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the deployment, we can use the following command:
-```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the Job was created. This command will display information about the Job, including the number of completions and the current status of the Job's pods.
-
-
-
-## Updating the Deployment
----
-
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-anchorpeer/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-anchorpeer
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-anchorpeer node is up to date.
-
-
-## Deletion
----
-
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
-
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Anchor Peer Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-anchorpeer), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
-
-
-## License
-
-This chart is licensed under the Apache v2.0 license.
-
-Copyright © 2023 Accenture
-
-### Attribution
-
-This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
-
-```
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-```
diff --git a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/_helpers.tpl
deleted file mode 100644
index d43c09d8cef..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/_helpers.tpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/anchorpeer.yaml b/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/anchorpeer.yaml
deleted file mode 100644
index 2671a754a77..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/anchorpeer.yaml
+++ /dev/null
@@ -1,181 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: batch/v1
-kind: Job
-metadata:
- name: anchorpeer-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app: {{ .Release.Name }}
- app.kubernetes.io/name: anchorpeer-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
-spec:
- backoffLimit: 6
- template:
- metadata:
- labels:
- app: {{ .Release.Name }}
- app.kubernetes.io/name: anchorpeer-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- spec:
- restartPolicy: "OnFailure"
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
- imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
- {{- end }}
- volumes:
- {{ if .Values.vault.tls }}
- - name: vaultca
- secret:
- secretName: {{ $.Values.vault.tls }}
- items:
- - key: ca.crt.pem
- path: ca-certificates.crt # curl expects certs to be in /etc/ssl/certs/ca-certificates.crt
- {{ end }}
- - name: certificates
- emptyDir:
- medium: Memory
- - name: anchorpeer-artifacts
- configMap:
- name: anchorpeer-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-artifacts
- - name: scripts-volume
- configMap:
- name: bevel-vault-script
- initContainers:
- - name: certificates-init
- image: {{ $.Values.metadata.images.alpineutils }}
- imagePullPolicy: IfNotPresent
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: VAULT_PEER_SECRET_PREFIX
- value: "{{ $.Values.vault.adminsecretprefix }}"
- - name: VAULT_ORDERER_SECRET_PREFIX
- value: "{{ $.Values.vault.orderersecretprefix }}"
- - name: MOUNT_PATH
- value: /secret
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- . /scripts/bevel-vault.sh
-
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
-
- echo "Getting Orderer TLS certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_ORDERER_SECRET_PREFIX}/tls"
-
- TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca.crt"]')
- OUTPUT_PATH="${MOUNT_PATH}/orderer/tls"
- mkdir -p ${OUTPUT_PATH}
- echo "${TLS_CA_CERT}" >> ${OUTPUT_PATH}/ca.crt
-
- echo "Getting MSP certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_PEER_SECRET_PREFIX}/msp"
-
- ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
- CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
- KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
- SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
- TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
-
- OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
- mkdir -p ${OUTPUT_PATH}/admincerts
- mkdir -p ${OUTPUT_PATH}/cacerts
- mkdir -p ${OUTPUT_PATH}/keystore
- mkdir -p ${OUTPUT_PATH}/signcerts
- mkdir -p ${OUTPUT_PATH}/tlscacerts
-
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
- volumeMounts:
- {{ if .Values.vault.tls }}
- - name: vaultca
- mountPath: "/etc/ssl/certs/"
- readOnly: true
- {{ end }}
- - name: certificates
- mountPath: /secret
- - name: scripts-volume
- mountPath: /scripts/bevel-vault.sh
- subPath: bevel-vault.sh
- containers:
- - name: anchorpeer
- image: {{ $.Values.metadata.images.fabrictools }}
- imagePullPolicy: IfNotPresent
- stdin: true
- tty: true
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
-
- version2_5=`echo $NETWORK_VERSION | grep -c 2.5`
-
- if [ $version2_5 = 1 ]
- then
- echo "Fetching the most recent configuration block for the channel"
- peer channel fetch config config_block.pb -o ${ORDERER_URL} -c ${CHANNEL_NAME} --tls --cafile ${ORDERER_CA}
-
- echo "Decoding config block to JSON and isolating config to ${CORE_PEER_LOCALMSPID}config.json"
- configtxlator proto_decode --input config_block.pb --type common.Block --output config_block.json
- jq .data.data[0].payload.data.config config_block.json >"${CORE_PEER_LOCALMSPID}config.json"
-
- PORT="${CORE_PEER_ADDRESS##*:}"
- HOST="${CORE_PEER_ADDRESS%%:*}"
- jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "'$HOST'","port": '$PORT'}]},"version": "0"}}' ${CORE_PEER_LOCALMSPID}config.json > ${CORE_PEER_LOCALMSPID}modified_config.json
-
- configtxlator proto_encode --input "${CORE_PEER_LOCALMSPID}config.json" --type common.Config --output original_config.pb
- configtxlator proto_encode --input "${CORE_PEER_LOCALMSPID}modified_config.json" --type common.Config --output modified_config.pb
- configtxlator compute_update --channel_id "${CHANNEL_NAME}" --original original_config.pb --updated modified_config.pb --output config_update.pb
- configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json
- echo '{"payload":{"header":{"channel_header":{"channel_id":"'$CHANNEL_NAME'", "type":2}},"data":{"config_update":'$(cat config_update.json)'}}}' | jq . >config_update_in_envelope.json
- configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output "${CORE_PEER_LOCALMSPID}anchors.tx"
-
- peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f ${CORE_PEER_LOCALMSPID}anchors.tx --tls --cafile ${ORDERER_CA}
- else
- echo "Updating anchor peer for the channel ${CHANNEL_NAME}"
- tls_status=${CORE_PEER_TLS_ENABLED}
- if [ "$tls_status" = "true" ]
- then
- peer channel fetch 0 ${CHANNEL_NAME}.block -o ${ORDERER_URL} -c ${CHANNEL_NAME} --tls --cafile ${ORDERER_CA}
- else
- peer channel fetch 0 ${CHANNEL_NAME}.block -o ${ORDERER_URL} -c ${CHANNEL_NAME}
- fi
- cat ./channel-artifacts/anchors.tx.base64 | base64 -d > ${CORE_PEER_LOCALMSPID}anchors.tx
- if [ "$tls_status" = "true" ]
- then
- peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f ${CORE_PEER_LOCALMSPID}anchors.tx --tls --cafile ${ORDERER_CA}
- else
- peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f ${CORE_PEER_LOCALMSPID}anchors.tx
- fi
- fi
- workingDir: /opt/gopath/src/github.com/hyperledger/fabric/peer
- envFrom:
- - configMapRef:
- name: anchorpeer-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-config
- volumeMounts:
- - name: certificates
- mountPath: /opt/gopath/src/github.com/hyperledger/fabric/crypto
- readOnly: true
- - name: anchorpeer-artifacts
- mountPath: /opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
- readOnly: true
diff --git a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/configmap.yaml
deleted file mode 100644
index 724c969286c..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/templates/configmap.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: anchorpeer-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-config
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: anchorpeer-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
-data:
- CHANNEL_NAME: {{ $.Values.channel.name }}
- FABRIC_LOGGING_SPEC: {{ $.Values.peer.loglevel }}
- CORE_PEER_ID: {{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}
- CORE_PEER_ADDRESS: {{ $.Values.peer.address }}
- CORE_PEER_LOCALMSPID: {{ $.Values.peer.localmspid }}
- CORE_PEER_TLS_ENABLED: "{{ $.Values.peer.tlsstatus }}"
- CORE_PEER_TLS_ROOTCERT_FILE: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp/tlscacerts/tlsca.crt
- ORDERER_CA: /opt/gopath/src/github.com/hyperledger/fabric/crypto/orderer/tls/ca.crt
- ORDERER_URL: {{ $.Values.orderer.address }}
- CORE_PEER_MSPCONFIGPATH: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp
- NETWORK_VERSION: {{ $.Values.metadata.network.version }}
-
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: anchorpeer-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-artifacts
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: anchorpeer-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-artifacts
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
-data:
- anchors.tx.base64: {{ .Values.anchorstx | quote }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/values.yaml b/platforms/hyperledger-fabric/charts/fabric-anchorpeer/values.yaml
deleted file mode 100644
index 055b0c94dea..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-anchorpeer/values.yaml
+++ /dev/null
@@ -1,83 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: org1-net
- namespace: org1-net
- images:
- #Provide the valid image name and version for fabric tools
- #Eg. fabric-tools: hyperledger/fabrictools:1.4.0
- fabrictools: ghcr.io/hyperledger/bevel-fabric-tools:2.2.2
- #Provide the valid image name and version to read certificates from vault server
- #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name , app.
- #Eg. labels:
- # role: anchorpeer
- labels:
-
-peer:
- #Provide the name of the peer as per deployment yaml.
- #Eg. name: peer0
- name: peer0
- #Provide the address of the peer which will update the channel about the anchor peer of the organization
- #Eg. address: peer0.org1-net:7051
- address: peer0.org1-net:7051
- #Provide the localmspid for organization
- #Eg. localmspid: Org1MSP
- localmspid: org1MSP
- #Provide the loglevel for organization's peer
- #Eg. loglevel: info
- loglevel: debug
- #Provide the value for tlsstatus to be true or false for organization's peer
- #Eg. tlsstatus: true
- tlsstatus: true
-
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: org1-vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: fra-demo-hlkube-cluster-org1
- authpath: devorg1-net-auth
- #Provide the value for vault secretprefix
- #Eg. adminsecretprefix: secretsv2/data/...
- adminsecretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/users/admin
- #Provide the value for vault secretprefix
- #Eg. orderersecretprefix: secretsv2/data/...
- orderersecretprefix: secretsv2/data/data/crypto/peerOrganizations/org1-nets/orderer
- #Provide the serviceaccount name for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Kuberenetes secret for vault ca.cert
- #Enable or disable TLS for vault communication if value present or not
- #Eg. tls: vaultca
- tls:
-
-
-channel:
- #Provide the name of the channel
- #Eg. name: mychannel
- name: mychannel
-
-orderer:
- #Provide the address for orderer
- #Eg. address: orderer1.org1proxy.blockchaincloudpoc.com:443
- address: orderer1.org1proxy.blockchaincloudpoc.com:443
-
-#Provide the base64 encoded file contents for anchorstx
-anchorstx:
diff --git a/platforms/r3-corda/charts/corda-h2/.helmignore b/platforms/hyperledger-fabric/charts/fabric-ca-server/.helmignore
similarity index 92%
rename from platforms/r3-corda/charts/corda-h2/.helmignore
rename to platforms/hyperledger-fabric/charts/fabric-ca-server/.helmignore
index f0c13194444..014fa775608 100644
--- a/platforms/r3-corda/charts/corda-h2/.helmignore
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/.helmignore
@@ -15,7 +15,9 @@
*.bak
*.tmp
*~
+generated_config/
# Various IDEs
.project
.idea/
*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/Chart.yaml
index 05530cbf407..9c53ad9c83a 100644
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/Chart.yaml
@@ -5,7 +5,23 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Deploys a CA server."
name: fabric-ca-server
-version: 1.0.0
+description: "Hyperledger Fabric: Deploys Fabric CA server"
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
+
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/README.md b/platforms/hyperledger-fabric/charts/fabric-ca-server/README.md
index dfd679be803..5e148f73dc6 100644
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/README.md
@@ -3,204 +3,114 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# CA Server Hyperledger Fabric Deploymen
+# fabric-ca-server
-- [CA Server Hyperledger Fabric Deployment Helm Chart](#ca-server-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-ca-server chart deploys a CA server for Hyperledger Fabric blockchain network. If enabled, the keys are then stored on the configured vault and stored as Kubernetes secrets. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## CA Server Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-ca-server) to deploy a CA server.
-
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- HAproxy is required as ingress controller.
-- Helm installed.
-
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install ca bevel/fabric-ca-server
```
-fabric-ca-server/
- |- conf/
- |- fabric-ca-server-config-default.yaml
- |- templates/
- |- _helpers.yaml
- |- configmap.yaml
- |- deployment.yaml
- |- service.yaml
- |- volume.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `fabric-ca-server-config-default.yaml`: Configuration file for the fabric-ca-server command.
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: Store the configuration for the Fabric CA server. The configuration file is stored in the fabric-ca-server-config.yaml file, and it is mounted into the Fabric CA server container. The ConfigMap is optional, and it is only used if the server.configpath value is set. Otherwise, the default configuration for the Fabric CA server will be used.
-- `deployment.yaml`: Deploys CA server Pod, allowing it to handle certificate-related operations within the Hyperledger Fabric blockchain network. To ensure the security and proper configuration of the CA server, the included init-container retrieves essential secrets from a Vault server.
-- `service.yaml`: Expose a Fabric CA server to the outside world either using HaProxy as a reverse proxy engine.
-- `volume.yaml`: Defines a persistent volume that can be used to store the Fabric CA server's database.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-ca-server/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-## Parameters
----
-
-### Metadata
-
-| Name | Description | Default Value |
-| ----------------------| -----------------------------------------------------------------| --------------------------------------------------|
-| namespace | Namespace for CA server | org1-net |
-| images.ca | image name and version for fabric ca | ghcr.io/hyperledger/bevel-fabric-ca:1.4.8 |
-| images.alpineutils | image name and version to read certificates from vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| labels | Provide the custom labels | "" |
-
-
-### Server
-| Name | Description | Default Value |
-| ----------------------| -----------------------------------------------------------------| -------------------------------------------|
-| name | Name for CA server deployment | ca |
-| tlsstatus | Specify if TLS is enabled or disabled for the deployment | true |
-| admin | Admin name for CA server | admin |
-| configpath | Path for Fabric CA Server Config | conf/fabric-ca-server-config-default.yaml |
-
-### Storage
-
-| Name | Description | Default Value |
-| ----------------------| --------------------------------------| ------------- |
-| storageclassname | Storage class name for CA server | aws-storageclass |
-| storagesize | Size of storage for CA server | 512Mi |
-
-### Vault
+## Prerequisites
-| Name | Description | Default Value |
-| ----------------------| --------------------------------------------------------------------| --------------------------------- |
-| address | Vault server address | "" |
-| role | Vault role for deployment | vault-role |
-| authpath | Kubernetes auth backend configured in Vault for CA server | fra-demo-hlkube-cluster-cluster |
-| secretcert | Path of secret certificate configured in Vault for CA server | secretsv2/data/crypto/peerOrganizations/org1-net/ca?ca.org1-net-cert.pem |
-| secretkey | Path of secret key configured in Vault for CA server | secretsv2/data/crypto/peerOrganizations/org1-net/ca?org1-net-CA.key |
-| secretadminpass | Secret path for admin password configured in Vault for CA server | secretsv2/data/credentials/org1-net/ca/org1?user |
-| serviceaccountname | Service account name for Vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Image secret name for Vault | "" |
-| tls | Enable or disable TLS for Vault communication | "" |
-| tlssecret | Kubernetes secret for Vault CA certificate | vaultca |
+- Kubernetes 1.19+
+- Helm 3.2.0+
-### Service
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-| Name | Description | Default Value |
-| --------------------------| ---------------------------------------------------| ---------------|
-| servicetype | Service type for the pod | ClusterIP |
-| ports.tcp.nodeport | TCP node port to be exposed for CA server | 30007 |
-| ports.tcp.clusteripport | TCP cluster IP port to be exposed for CA server | 7054 |
+> **Important**: Also check the dependent charts.
-### Annotations
+## Installing the Chart
-| Name | Description | Default Value |
-| ------------| ---------------------------------------| ------------- |
-| service | Extra annotations for the service | "" |
-| pvc | Extra annotations for the PVC | "" |
+To install the chart with the release name `ca`:
-### Proxy
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install ca bevel/fabric-ca-server
+```
-| Name | Description | Default Value |
-| ----------------------| -------------------------------------------------------------------------|--------------------------------|
-| provider | Proxy/ingress provider. Possible values: "haproxy" or "none" | haproxy |
-| type | Type of the deployment. Possible values: "orderer", "peer", or "test" | test |
-| external_url_suffix | External URL suffix for the organization | org1proxy.blockchaincloudpoc.com |
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
+> **Tip**: List all releases using `helm list`
-
-## Deployment
----
+## Uninstalling the Chart
-To deploy the ca Helm chart, follow these steps:
+To uninstall/delete the `ca` deployment:
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-ca-server/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-ca-server
- ```
-Replace `` with the desired name for the release.
+```bash
+helm uninstall ca
+```
-This will deploy the ca server node to the Kubernetes cluster based on the provided configurations.
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+## Parameters
-a name = "verification">
-## Verification
----
-
-To verify the deployment, we can use the following command:
-```
-$ kubectl get deployments -n
-```
-Replace `` with the actual namespace where the deployment was created. The command will display information about the deployment, including the number of replicas and their current status.
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.cluster.kubernetesUrl` | URL of the Kubernetes Cluster | `""` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.network` | Network type that is being deployed | `fabric` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `false` |
+| `global.proxy.provider` | The proxy or Ingress provider. Can be `none` or `haproxy` | `haproxy` |
+| `global.proxy.externalUrlSuffix` | The External URL suffix at which the Fabric GRPC services will be available | `test.blockchaincloudpoc.com` |
+### Storage
-
-## Updating the Deployment
----
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `storage.size` | Size of the PVC needed for Fabric CA | `512Mi` |
+| `storage.reclaimPolicy` | Reclaim policy for the PVC. Choose from: `Delete` or `Retain` | `Delete` |
+| `storage.volumeBindingMode` | Volume binding mode for the PVC. Choose from: `Immediate` or `WaitForFirstConsumer` | `Immediate` |
+| `storage.allowedTopologies.enabled` | Check [bevel-storageclass](../../../shared/charts/bevel-storageclass/README.md) for details | `false` |
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-ca-server/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-ca-server
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the ca server node is up to date.
+### Image
-
-## Deletion
----
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.ca` | Fabric CA image repository and tag | `ghcr.io/hyperledger/bevel-fabric-ca:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
+### Server
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [CA Server Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-ca-server), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `server.removeCertsOnDelete` | Flag to delete the certificate secrets when uninstalling the release | `true` |
+| `server.tlsStatus` | TLS status of the server | `true` |
+| `server.adminUsername` | CA Admin Username | `admin` |
+| `server.adminPassword` | CA Admin Password | `adminpw` |
+| `server.subject` | CA server root subject | `"/C=GB/ST=London/L=London/O=Orderer"` |
+| `server.configPath` | Local path to the CA server configuration file which will be mounted to the CA Server | `""` |
+| `server.nodePort` | NodePort for the CA Server | `""` |
+| `server.clusterIpPort` | TCP Port for the CA Server | `7054` |
+
+### Labels
+
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `labels.service` | Array of Labels for service object | `[]` |
+| `labels.pvc` | Array of Labels for PVC object | `[]` |
+| `labels.deployment` | Array of Labels for deployment or statefulset object | `[]` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/conf/fabric-ca-server-config-default.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/conf/fabric-ca-server-config-default.yaml
index 0624df3168e..289ec948095 100644
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/conf/fabric-ca-server-config-default.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/conf/fabric-ca-server-config-default.yaml
@@ -136,8 +136,8 @@ registry:
# Contains identity information which is used when LDAP is disabled
# Do not edit this value
identities:
- - name: {{ $.Values.server.admin }}
- pass: {{ $.Values.server.admin }}pw
+ - name: {{ .Values.server.adminUsername }}
+ pass: {{ .Values.server.adminPassword }}
type: client
affiliation: ""
attrs:
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/requirements.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/requirements.yaml
new file mode 100644
index 00000000000..a5b2e417d4d
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/requirements.yaml
@@ -0,0 +1,17 @@
+dependencies:
+ - name: bevel-vault-mgmt
+ repository: "file://../../../shared/charts/bevel-vault-mgmt"
+ tags:
+ - bevel
+ version: ~1.0.0
+ - name: bevel-scripts
+ repository: "file://../../../shared/charts/bevel-scripts"
+ tags:
+ - bevel
+ version: ~1.0.0
+ - name: bevel-storageclass
+ alias: storage
+ repository: "file://../../../shared/charts/bevel-storageclass"
+ tags:
+ - storage
+ version: ~1.0.0
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/_helpers.tpl
index 7bf5f530a8e..26091cea227 100644
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/_helpers.tpl
@@ -1,5 +1,57 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
\ No newline at end of file
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-ca-server.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-ca-server.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-ca-server.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "labels.deployment" -}}
+{{- range $value := .Values.labels.deployment }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.service" -}}
+{{- range $value := .Values.labels.service }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.pvc" -}}
+{{- range $value := .Values.labels.pvc }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create server url depending on proxy
+*/}}
+{{- define "fabric-ca-server.serverURL" -}}
+{{- if eq .Values.global.proxy.provider "none" -}}
+ {{- printf "ca.%s" .Release.Namespace }}
+{{- else -}}
+ {{- printf "ca.%s.%s" .Release.Namespace .Values.global.proxy.externalUrlSuffix }}
+{{- end -}}
+{{- end -}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/ca-job-cleanup.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/ca-job-cleanup.yaml
new file mode 100644
index 00000000000..a4d1654cc1b
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/ca-job-cleanup.yaml
@@ -0,0 +1,50 @@
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ include "fabric-ca-server.name" . }}-cleanup
+ labels:
+ app.kubernetes.io/name: fabric-ca-server-job-cleanup
+ app.kubernetes.io/component: ca-server-job-cleanup
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/managed-by: helm
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-weight: "0"
+ helm.sh/hook: "pre-delete"
+ helm.sh/hook-delete-policy: "hook-succeeded"
+spec:
+ backoffLimit: 3
+ completions: 1
+ template:
+ metadata:
+ labels:
+ app.kubernetes.io/name: fabric-ca-server-job-cleanup
+ app.kubernetes.io/component: ca-server-job-cleanup
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ restartPolicy: "Never"
+ containers:
+ - name: delete-secrets
+ image: {{ .Values.image.alpineUtils }}
+ securityContext:
+ runAsUser: 0
+ imagePullPolicy: IfNotPresent
+ command: ["sh", "-c"]
+ args:
+ - |-
+{{- if .Values.server.removeCertsOnDelete }}
+
+ function deleteSecret {
+ key=$1
+ kubectl get secret ${key} --namespace {{ .Release.Namespace }} -o json > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ kubectl delete secret ${key} --namespace {{ .Release.Namespace }}
+ fi
+ }
+ deleteSecret {{ include "fabric-ca-server.name" . }}-certs
+{{- end}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/configmap.yaml
index 99241a79d24..86f6b7bcfb5 100644
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/configmap.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/configmap.yaml
@@ -4,19 +4,45 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
-{{- if (not (empty .Values.server.configpath)) }}
+{{- if (not (empty .Values.server.configPath)) }}
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ $.Values.server.name }}-config
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-config
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: {{ $.Values.server.name }}-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app.kubernetes.io/name: {{ .Release.Name }}-config
+ app.kubernetes.io/component: fabric-ca-config
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
fabric-ca-server-config.yaml: |
- {{ (tpl (.Files.Get ( printf "%s" $.Values.server.configpath )) . ) | nindent 6 }}
+ {{ (tpl (.Files.Get ( printf "%s" $.Values.server.configPath )) . ) | nindent 6 }}
{{- end }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: openssl-config-file
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/name: openssl-config-file
+ app.kubernetes.io/component: openssl-config
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+data:
+ openssl.conf: |-
+ [req]
+ req_extensions = v3_req
+ distinguished_name = dn
+
+ [dn]
+
+ [v3_req]
+ basicConstraints = critical, CA:TRUE
+ keyUsage = critical,digitalSignature, keyEncipherment, keyCertSign, cRLSign
+ subjectKeyIdentifier = hash
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/deployment.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/deployment.yaml
deleted file mode 100644
index db56dc48de3..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/deployment.yaml
+++ /dev/null
@@ -1,183 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: {{ $.Values.server.name }}
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: {{ $.Values.server.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.deployment.annotations }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
-spec:
- replicas: 1
- selector:
- matchLabels:
- app.kubernetes.io/name: {{ $.Values.server.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- template:
- metadata:
- labels:
- name: {{ $.Values.server.name }}
- app.kubernetes.io/name: {{ $.Values.server.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- spec:
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
- imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
- {{- end }}
- volumes:
- - name: ca-server-db
- persistentVolumeClaim:
- claimName: ca-server-db-pvc
- - name: certificates
- emptyDir:
- medium: Memory
- {{- if (not (empty .Values.server.configpath)) }}
- - name: {{ $.Values.server.name }}-config-volume
- configMap:
- name: {{ $.Values.server.name }}-config
- items:
- - key: fabric-ca-server-config.yaml
- path: fabric-ca-server-config.yaml
- {{- end }}
- {{ if .Values.vault.tls }}
- - name: vaultca
- secret:
- secretName: "{{ .Values.vault.tls }}"
- items:
- - key: ca.crt.pem
- path: ca-certificates.crt
- {{- end }}
- - name: scripts-volume
- configMap:
- name: bevel-vault-script
- initContainers:
- - name: ca-certs-init
- image: {{ $.Values.metadata.images.alpineutils }}
- imagePullPolicy: IfNotPresent
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: MOUNT_PATH
- value: /secret
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- source /scripts/bevel-vault.sh
-
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
-
- SECRET_CERT={{ $.Values.vault.secretcert }}
- vault_secret_key=$(echo ${SECRET_CERT} |awk -F "?" '{print $1}')
- vault_data_key=$(echo ${SECRET_CERT} |awk -F "?" '{print $2}')
-
- # Calling a function to retrieve secrets from Vault only if they exist.
- vaultBevelFunc "readJson" "${vault_secret_key}"
- VALUE_OF_SECRET=$(echo ${VAULT_SECRET} | jq -r ".[\"${vault_data_key}\"]")
- echo "${VALUE_OF_SECRET}" >> ${MOUNT_PATH}/server.crt
-
- SECRET_KEY={{ $.Values.vault.secretkey }}
- vault_secret_key=$(echo ${SECRET_KEY} |awk -F "?" '{print $1}')
- vault_data_key=$(echo ${SECRET_KEY} |awk -F "?" '{print $2}')
-
- # Calling a function to retrieve secrets from Vault only if they exist.
- vaultBevelFunc "readJson" "${vault_secret_key}"
- VALUE_OF_SECRET=$(echo ${VAULT_SECRET} | jq -r ".[\"${vault_data_key}\"]")
- echo "${VALUE_OF_SECRET}" >> ${MOUNT_PATH}/server.key
-
- SECRET_ADMIN_PASS={{ $.Values.vault.secretadminpass }}
- vault_secret_key=$(echo ${SECRET_ADMIN_PASS} |awk -F "?" '{print $1}')
- vault_data_key=$(echo ${SECRET_ADMIN_PASS} |awk -F "?" '{print $2}')
-
- # Calling a function to retrieve secrets from Vault only if they exist.
- vaultBevelFunc "readJson" "${vault_secret_key}"
- VALUE_OF_SECRET=$(echo ${VAULT_SECRET} | jq -r ".[\"${vault_data_key}\"]")
- echo "${VALUE_OF_SECRET}" >> ${MOUNT_PATH}/user_cred
- volumeMounts:
- - name: certificates
- mountPath: /secret
- {{ if .Values.vault.tls }}
- - name: vaultca
- mountPath: "/etc/ssl/certs/"
- readOnly: true
- {{ end }}
- - name: scripts-volume
- mountPath: /scripts/bevel-vault.sh
- subPath: bevel-vault.sh
- containers:
- - name: ca
- image: {{ $.Values.metadata.images.ca }}
- imagePullPolicy: IfNotPresent
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- if [[ -d /custom-config/ ]] && [[ -f /custom-config/fabric-ca-server-config.yaml ]]; then
- cp /custom-config/fabric-ca-server-config.yaml $FABRIC_CA_HOME/fabric-ca-server-config.yaml
- fabric-ca-server start --config $FABRIC_CA_HOME/fabric-ca-server-config.yaml -d
- else
- sleep 1 && fabric-ca-server start -b {{ $.Values.server.admin }}:`cat /etc/hyperledger/fabric-ca-server-config/user_cred` -d
- fi
- ports:
- - containerPort: 7054
- - containerPort: 9443
- env:
- - name: FABRIC_CA_HOME
- value: /etc/hyperledger/fabric-ca-server
- - name: FABRIC_CA_SERVER_CA_NAME
- value: "{{ $.Values.server.name }}.{{ $.Values.metadata.namespace }}"
- - name: FABRIC_CA_SERVER_CA_CERTFILE
- value: /etc/hyperledger/fabric-ca-server-config/server.crt
- - name: FABRIC_CA_SERVER_CA_KEYFILE
- value: /etc/hyperledger/fabric-ca-server-config/server.key
- - name: FABRIC_CA_SERVER_TLS_ENABLED
- value: "{{ $.Values.server.tlsstatus }}"
- - name: FABRIC_CA_SERVER_DEBUG
- value: "true"
- - name: FABRIC_CA_SERVER_TLS_CERTFILE
- value: /etc/hyperledger/fabric-ca-server-config/server.crt
- - name: FABRIC_CA_SERVER_TLS_KEYFILE
- value: /etc/hyperledger/fabric-ca-server-config/server.key
- - name: FABRIC_CA_SERVER_DB_DATASOURCE
- value: /var/hyperledger/fabric-ca-server/db/fabric-ca-server.db
- - name: FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS
- value: 0.0.0.0:9443
- volumeMounts:
- - name: certificates
- mountPath: /etc/hyperledger/fabric-ca-server-config
- readOnly: true
- - name: ca-server-db
- mountPath: /var/hyperledger/fabric-ca-server/db/
- {{- if (not (empty .Values.server.configpath)) }}
- - name: {{ $.Values.server.name }}-config-volume
- mountPath: /custom-config/
- {{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/service.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/service.yaml
index 66dfe4edab4..d249cdfcef2 100644
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/service.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/service.yaml
@@ -7,80 +7,74 @@
apiVersion: v1
kind: Service
metadata:
- name: {{ $.Values.server.name }}
- namespace: {{ $.Values.metadata.namespace }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.service }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
+ name: ca
+ namespace: {{ .Release.Namespace }}
labels:
- run: {{ $.Values.server.name }}
- app.kubernetes.io/name: {{ $.Values.server.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ {{- include "labels.service" . | nindent 4 }}
spec:
- type: {{ $.Values.service.servicetype }}
+ type: ClusterIP
selector:
- name: {{ $.Values.server.name }}
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
ports:
- name: tcp
protocol: TCP
targetPort: 7054
- port: {{ $.Values.service.ports.tcp.clusteripport }}
- {{- if $.Values.service.ports.tcp.nodeport }}
- nodePort: {{ $.Values.service.ports.tcp.nodeport }}
+ port: {{ .Values.server.clusterIpPort }}
+ {{- if .Values.server.nodePort }}
+ nodePort: {{ .Values.server.nodePort }}
{{- end }}
- name: operations
protocol: TCP
targetPort: 9443
port: 9443
-{{- if eq $.Values.proxy.provider "haproxy" }}
+{{- if eq .Values.global.proxy.provider "haproxy" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: {{ $.Values.server.name }}
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
annotations:
- kubernetes.io/ingress.class: "haproxy"
ingress.kubernetes.io/ssl-passthrough: "true"
spec:
+ ingressClassName: "haproxy"
rules:
- - host: ca.{{ $.Values.metadata.namespace }}.{{ $.Values.proxy.external_url_suffix }}
+ - host: ca.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.server.name }}
+ name: ca
port:
- number: {{ $.Values.service.ports.tcp.clusteripport }}
+ number: {{ .Values.server.clusterIpPort }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: {{ $.Values.server.name }}-ops
- namespace: {{ $.Values.metadata.namespace }}
- annotations:
- kubernetes.io/ingress.class: "haproxy"
+ name: {{ .Release.Name }}-ops
+ namespace: {{ .Release.Namespace }}
spec:
+ ingressClassName: "haproxy"
rules:
- - host: ca-ops.{{ $.Values.metadata.namespace }}.{{ $.Values.proxy.external_url_suffix }}
+ - host: ca-ops.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.server.name }}
+ name: ca
port:
number: 9443
{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/statefulset.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/statefulset.yaml
new file mode 100644
index 00000000000..6a507e85596
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/statefulset.yaml
@@ -0,0 +1,292 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: {{ template "fabric-ca-server.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric-ca-statefulset
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ {{- include "labels.deployment" . | nindent 4 }}
+spec:
+ serviceName: {{ .Release.Name }}
+ replicas: 1
+ podManagementPolicy: OrderedReady
+ updateStrategy:
+ type: RollingUpdate
+ selector:
+ matchLabels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric-ca-statefulset
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ template:
+ metadata:
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric-ca-statefulset
+ app.kubernetes.io/part-of: {{ include "fabric-ca-server.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ {{- include "labels.deployment" . | nindent 8 }}
+ spec:
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
+ imagePullSecrets:
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ initContainers:
+ - name: ca-certs-init
+ image: {{ .Values.image.alpineUtils }}
+ imagePullPolicy: IfNotPresent
+ volumeMounts:
+ - name: certificates
+ mountPath: /secret
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ mountPath: "/etc/ssl/certs/"
+ readOnly: true
+ {{ end }}
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
+ - name: openssl-config
+ mountPath: /openssl/openssl.conf
+ subPath: openssl.conf
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
+ {{- end }}
+ env:
+ - name: CA_URL
+ value: {{ include "fabric-ca-server.serverURL" . }}
+ - name: CA_SUBJECT
+ value: "{{ .Values.server.subject }}/CN={{ include "fabric-ca-server.serverURL" . }}"
+ - name: COMPONENT_NAME
+ value: {{ .Release.Namespace }}
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: VAULT_ADDR
+ value: "{{ .Values.global.vault.address }}"
+ - name: VAULT_APP_ROLE
+ value: "{{ .Values.global.vault.role }}"
+ - name: KUBERNETES_AUTH_PATH
+ value: "{{ .Values.global.vault.authPath }}"
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
+ {{- end }}
+ command: ["sh", "-c"]
+ args:
+ - |-
+
+ . /scripts/package-manager.sh
+ # Define the packages to install
+ packages_to_install="jq curl openssl kubectl"
+ install_packages "$packages_to_install"
+
+ formatCertificate () {
+ NAME="${1##*/}"
+ while IFS= read -r line
+ do
+ echo "$line\n"
+ done < ${1} > ${2}/${NAME}.txt
+ }
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . /scripts/bevel-vault.sh
+ echo "Getting vault Token..."
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+ function safeWriteSecret {
+ path=$1
+ key=$2
+ # Check if certs already exist in Vault
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/ca"
+ if [ "$SECRETS_AVAILABLE" == "yes" ]
+ then
+ # Create the Kubernetes Secret with data from Vault
+ echo "Secret found in Vault, only creating k8s secrets"
+ ca_cert=$(echo ${VAULT_SECRET} | jq -r ".[\"rootca_pem\"]")
+ echo "${ca_cert}" > ${path}/server.crt
+
+ ca_key=$(echo ${VAULT_SECRET} | jq -r ".[\"rootca_key\"]")
+ echo "${ca_key}" > ${path}/server.key
+ else
+ echo "Secret to be created on Vault and k8s"
+ # Store the value in Vault
+ FORMAT_CERTIFICATE_PATH="${path}/formatcertificate"
+ mkdir -p ${FORMAT_CERTIFICATE_PATH}
+ formatCertificate "${path}/server.key" "${FORMAT_CERTIFICATE_PATH}"
+ formatCertificate "${path}/server.crt" "${FORMAT_CERTIFICATE_PATH}"
+
+ PEM_CERTIFICATE=$(cat ${FORMAT_CERTIFICATE_PATH}/server.crt.txt)
+ KEY_CERTIFICATE=$(cat ${FORMAT_CERTIFICATE_PATH}/server.key.txt)
+
+ # create a JSON file for the data related to node crypto
+ echo "
+ {
+ \"data\":
+ {
+ \"rootca_pem\": \"${PEM_CERTIFICATE}\",
+ \"rootca_key\": \"${KEY_CERTIFICATE}\"
+ }
+ }" > payload.json
+
+ # Calling a function to write secrets to the vault.
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/ca" 'payload.json'
+ rm payload.json
+
+ fi
+ # Create the Kubernetes Secret using kubectl after secrets ae stored in Vault
+ kubectl create secret tls ${key} --namespace ${COMPONENT_NAME} \
+ --cert=${path}/server.crt \
+ --key=${path}/server.key
+ }
+
+{{- else }}
+
+ function safeWriteSecret {
+ path=$1
+ key=$2
+ # Create the Kubernetes Secret using kubectl
+ kubectl create secret tls ${key} --namespace ${COMPONENT_NAME} \
+ --cert=${path}/server.crt \
+ --key=${path}/server.key
+ }
+{{- end }}
+ kubectl get secret --namespace {{ .Release.Namespace }} {{ include "fabric-ca-server.name" . }}-certs -o json > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "Generating CA certs ..."
+ # this commands generate the CA certificate
+ cd /secret
+ openssl ecparam -name prime256v1 -genkey -noout -out server.key
+ openssl req -x509 -config "/openssl/openssl.conf" -new -nodes -key server.key \
+ -days 1024 -out server.crt -extensions v3_req -subj "${CA_SUBJECT}" -addext "subjectAltName = DNS:${CA_URL}"
+ safeWriteSecret /secret {{ include "fabric-ca-server.name" . }}-certs
+ else
+ echo "CA certs already present."
+ KUBENETES_SECRET=$(kubectl get secret {{ include "fabric-ca-server.name" . }}-certs --namespace ${COMPONENT_NAME} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ echo "Certficates absent in Kubernetes secrets"
+ exit 1
+ else
+ CA_KEY=$(echo "$KUBENETES_SECRET" | jq -r ".data.\"tls.key\"" | base64 -d)
+ CA_CERT=$(echo "$KUBENETES_SECRET" | jq -r ".data.\"tls.crt\"" | base64 -d)
+ echo "${CA_KEY}" > /secret/server.key
+ echo "${CA_CERT}" > /secret/server.crt
+ fi
+ fi
+ containers:
+ - name: ca
+ image: {{ .Values.image.ca }}
+ imagePullPolicy: IfNotPresent
+ command: ["sh", "-c"]
+ args:
+ - |-
+ #!/usr/bin/env sh
+ if [[ -d /custom-config/ ]] && [[ -f /custom-config/fabric-ca-server-config.yaml ]]; then
+ cp /custom-config/fabric-ca-server-config.yaml $FABRIC_CA_HOME/fabric-ca-server-config.yaml
+ fabric-ca-server start --config $FABRIC_CA_HOME/fabric-ca-server-config.yaml -d
+ else
+ sleep 1 && fabric-ca-server start -b {{ .Values.server.adminUsername }}:{{ .Values.server.adminPassword }} -d
+ fi
+ ports:
+ - containerPort: 7054
+ - containerPort: 9443
+ env:
+ - name: FABRIC_CA_HOME
+ value: /etc/hyperledger/fabric-ca-server
+ - name: FABRIC_CA_SERVER_CA_NAME
+ value: "{{ .Release.Name }}.{{ .Release.Namespace }}"
+ - name: FABRIC_CA_SERVER_CA_CERTFILE
+ value: /etc/hyperledger/fabric-ca-server-config/server.crt
+ - name: FABRIC_CA_SERVER_CA_KEYFILE
+ value: /etc/hyperledger/fabric-ca-server-config/server.key
+ - name: FABRIC_CA_SERVER_TLS_ENABLED
+ value: "{{ .Values.server.tlsStatus }}"
+ - name: FABRIC_CA_SERVER_DEBUG
+ value: "true"
+ - name: FABRIC_CA_SERVER_TLS_CERTFILE
+ value: /etc/hyperledger/fabric-ca-server-config/server.crt
+ - name: FABRIC_CA_SERVER_TLS_KEYFILE
+ value: /etc/hyperledger/fabric-ca-server-config/server.key
+ - name: FABRIC_CA_SERVER_DB_DATASOURCE
+ value: /var/hyperledger/fabric-ca-server/db/fabric-ca-server.db
+ - name: FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS
+ value: 0.0.0.0:9443
+ volumeMounts:
+ - name: certificates
+ mountPath: /etc/hyperledger/fabric-ca-server-config
+ readOnly: true
+ - name: ca-server-db-pvc
+ mountPath: /var/hyperledger/fabric-ca-server/db/
+ {{- if (not (empty .Values.server.configPath)) }}
+ - name: {{ .Release.Name }}-config-volume
+ mountPath: /custom-config/
+ {{- end }}
+ volumes:
+ - name: certificates
+ emptyDir:
+ medium: Memory
+ {{- if (not (empty .Values.server.configPath)) }}
+ - name: {{ .Release.Name }}-config-volume
+ configMap:
+ name: {{ .Release.Name }}-config
+ items:
+ - key: fabric-ca-server-config.yaml
+ path: fabric-ca-server-config.yaml
+ {{- end }}
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ secret:
+ secretName: "{{ .Values.global.vault.tls }}"
+ items:
+ - key: ca-crt.pem
+ path: ca-certificates.crt
+ {{- end }}
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ defaultMode: 0777
+ {{- end }}
+ - name: package-manager
+ configMap:
+ name: package-manager
+ defaultMode: 0777
+ - name: openssl-config
+ configMap:
+ name: openssl-config-file
+ defaultMode: 0775
+ items:
+ - key: openssl.conf
+ path: openssl.conf
+ volumeClaimTemplates:
+ - metadata:
+ name: ca-server-db-pvc
+ labels:
+ {{- include "labels.pvc" . | nindent 8 }}
+ spec:
+ accessModes: ["ReadWriteOnce"]
+ storageClassName: storage-{{ .Release.Name }}
+ resources:
+ requests:
+ storage: "{{ .Values.storage.size }}"
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/volume.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/volume.yaml
deleted file mode 100644
index d7aaae803e1..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/templates/volume.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: ca-server-db-pvc
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: ca-server-db-pvc
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.pvc }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
-spec:
- storageClassName: {{ $.Values.storage.storageclassname }}
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: {{ $.Values.storage.storagesize }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-ca-server/values.yaml b/platforms/hyperledger-fabric/charts/fabric-ca-server/values.yaml
index 3d6edb20be4..ade6983421f 100644
--- a/platforms/hyperledger-fabric/charts/fabric-ca-server/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-ca-server/values.yaml
@@ -3,111 +3,100 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+---
+# The following are for overriding global values
+global:
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ #Provide the kubernetes host url
+ #Eg. kubernetesUrl: https://10.3.8.5:8443
+ kubernetesUrl:
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the network type
+ network: fabric
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
+ #Enable or disable TLS for Vault communication
+ #Eg. tls: true
+ tls: false
-metadata:
- #Provide the namespace for CA server
- #Eg. namespace: org1-net
- namespace: org1-net
- images:
- #Provide the valid image name and version for fabric ca
- #Eg. ca: hyperledger/fabric-ca:1.4.8
- ca: ghcr.io/hyperledger/bevel-fabric-ca:1.4.8
- #Provide the valid image name and version to read certificates from vault server
- #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name , run.
- #Eg. labels:
- # role: ca
- labels:
-
-deployment:
- annotations:
-
-server:
- #Provide name for ca server deployment
- #Eg. name: ca
- name: ca
- #Provide the value for tlsstatus to be true or false for deployment
- #Eg. tlsstatus: true
- tlsstatus: true
- #Provide the admin name for CA server
- #Eg. admin: admin
- admin: admin
- # Provide the path for Fabric CA Server Config
- # Eg. configpath: conf/ca-config-default.yaml
- configpath: conf/ca-config-default.yaml
+ proxy:
+ #This will be the proxy/ingress provider. Can have values "haproxy" or "none"
+ #Eg. provider: "haproxy"
+ provider: haproxy
+ #This field specifies the external url for the organization
+ #Eg. externalUrlSuffix: test.blockchaincloudpoc.com
+ externalUrlSuffix: test.blockchaincloudpoc.com
storage:
- #Provide the storageclassname for CA
- #Eg. storageclassname: aws-storageclass
- storageclassname: aws-storageclass
- #Provide the storagesize for CA
- #Eg. storagesize: 512Mi
- storagesize: 512Mi
+ #Provide the size for CA
+ #Eg. size: 512Mi
+ size: 512Mi
+ # NOTE: when you set this to Retain, the volume WILL persist after the chart is delete and you need to manually delete it
+ reclaimPolicy: "Delete" # choose from: Delete | Retain
+ volumeBindingMode: Immediate # choose from: Immediate | WaitForFirstConsumer
+ allowedTopologies:
+ enabled: false
-vault:
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the vaultrole for deployment
- #Eg. vaultrole: vault-role
- role: vault-role
- #Provide the kubernetes auth backend configured in vault for CA server
- #Eg. authpath: fra-demo-hlkube-cluster-cluster
- authpath: devorg1-net-auth
- #Provide the secretcert path configured in vault for CA server
- #Eg. secretcert: secretsv2/data/crypto/Organizations/.../...-cert.pem
- secretcert: secretsv2/data/crypto/peerOrganizations/org1-net/ca?ca.org1-net-cert.pem
- #Provide the secretkey path configured in vault for CA server
- #Eg. secretkey: secretsv2/data/crypto/Organizations/.../...-CA.key
- secretkey: secretsv2/data/crypto/peerOrganizations/org1-net/ca?org1-net-CA.key
- # Provide the secret path for admin password configured in vault for CA server
- # Eg. secretadminpass: secretsv2/data/credentials/.../.../ca/org1?user
- secretadminpass: secretsv2/data/credentials/org1-net/ca/org1?user
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Enable or disable TLS for vault communication
- #Eg. tls: true
- tls:
- #kuberenetes secret for vault ca.cert
- #Eg. tlssecret: vaultca
- tlssecret: vaultca
+image:
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the valid image name and version for fabric ca
+ #Eg. ca: ghcr.io/hyperledger/bevel-fabric-ca:latest
+ ca: ghcr.io/hyperledger/bevel-fabric-ca:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
+server:
+ # Flag to ensure the certificates secrets are removed on helm uninstall
+ removeCertsOnDelete: true
+ #Provide the value for tls setting for CA server
+ #Eg. tlsStatus: true
+ tlsStatus: true
+ #Provide the admin username for CA server
+ #Eg. adminUsername: admin
+ adminUsername: admin
+ #Provide the admin password for CA server
+ adminPassword: adminpw
+ #Provide the subject of the services ca organization's
+ #Eg. subject: "/C=GB/ST=London/L=London/O=Carrier/CN=carrier-net"
+ subject: "/C=GB/ST=London/L=London/O=Orderer"
+ # Provide the path for Fabric CA Server Config
+ # Eg. configPath: conf/ca-config-default.yaml
+ configPath:
+ #Provide tcp node port to be exposed for ca server
+ #Eg. nodePort: 30007
+ nodePort:
+ #Provide tcp cluster IP port to be exposed for ca server
+ #Eg. clusterIpPort: 7054
+ clusterIpPort: 7054
-service:
- #Provide service type for the pod
- #Eg. servicetype: NodePort
- servicetype: ClusterIP
- ports:
- tcp:
- #Provide tcp node port to be exposed for ca server
- #Eg. nodeport: 30007
- nodeport:
- #Provide tcp cluster IP port to be exposed for ca server
- #Eg. clusteripport: 7054
- clusteripport: 7054
-
-annotations:
- # Extra annotations for the service
+# Provide additional labels in array format
+labels:
+ #Eg. service:
+ # - label1: value1
+ # - label2: value2
service: []
- # Extra annotations for the PVC
pvc: []
-
-proxy:
- #This will be the proxy/ingress provider. Can have values "haproxy" or "none"
- #Eg. provider: "haproxy"
- provider: haproxy
- #Type can be "orderer" or "peer"; "test" is defaulted
- #Eg. type: orderer
- type: test
- #This field specifies the external url for the organization
- #Eg. external_url_suffix: org1proxy.blockchaincloudpoc.com
- external_url_suffix: org1proxy.blockchaincloudpoc.com
+ deployment: []
diff --git a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/Chart.yaml
deleted file mode 100644
index 6eac32205fe..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/Chart.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Generates CA Server certs."
-name: fabric-cacerts-gen
-version: 1.0.0
diff --git a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/README.md b/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/README.md
deleted file mode 100644
index 26e99913dc2..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/README.md
+++ /dev/null
@@ -1,174 +0,0 @@
-[//]: # (##############################################################################################)
-[//]: # (Copyright Accenture. All Rights Reserved.)
-[//]: # (SPDX-License-Identifier: Apache-2.0)
-[//]: # (##############################################################################################)
-
-
-# Generate Cacerts Hyperledger Fabric Deployment
-
-- [Generate Cacerts Hyperledger Fabric Deployment Helm Chart](#generate-cacerts-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
-
-
-
-## Generate Cacerts Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-cacerts-gen) to generate CA Server certs.
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
-
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-fabric-cacerts-gen/
- |- templates/
- |- _helpers.yaml
- |- job.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `job.yaml`: The init-check-certificates checks if the certificates are present in the Vault server. If the certificates are not present, the cacerts generates and uploads CA certificates and admin credentials to Vault.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-
-### Metadata
-
-| Name | Description | Default Value |
-| ---------------------| -------------------------------------------------------------------------- | --------------------------------------------------|
-| namespace | Namespace for the organization's peer | org1-net |
-| name | Organization's name | org1 |
-| component_name | Organization's component name | org1-net |
-| images.alpineutils | Valid image name and version to read certificates from the vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| labels | Custom labels for the organization | "" |
-
-### Vault
-
-| Name | Description | Default Value |
-| --------------------------| ------------------------------------------------ | -----------------------------------|
-| role | Vault role for the organization | vault-role |
-| address | Vault server address | "" |
-| authpath | Kubernetes auth backend configured in vault | devorg1-net-auth |
-| secretcryptoprefix | Vault secret prefix for crypto | secrets/secretsv2/data/crypto/ordererOrganizations/org1-net/ca |
-| secretcredentialsprefix | Vault secret prefix for credentials | secrets/secretsv2/data/credentials/org1-net/ca/smari |
-| serviceaccountname | Service account name for vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Image secret name for vault | "" |
-
-### CA
-
-| Name | Description | Default Value |
-| ---------| ------------------------------------------------ | --------------------------------------------------------|
-| subject | Subject of the services CA organization's | /C=GB/ST=London/L=London/O=Orderer/CN=ca.org1-net |
-
-
-
-## Deployment
----
-
-To deploy the fabric-cacerts-gen Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-cacerts-gen
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the fabric-cacerts-gen node to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the deployment, we can use the following command:
-```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the Job was created. This command will display information about the Job, including the number of completions and the current status of the Job's pods.
-
-
-
-## Updating the Deployment
----
-
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-cacerts-gen
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-cacerts-gen node is up to date.
-
-
-
-## Deletion
----
-
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
-
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Generate Cacerts Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-cacerts-gen), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
-
-
-
-## License
-
-This chart is licensed under the Apache v2.0 license.
-
-Copyright © 2023 Accenture
-
-### Attribution
-
-This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
-
-```
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-```
diff --git a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/templates/_helpers.tpl
deleted file mode 100644
index d43c09d8cef..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/templates/_helpers.tpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/templates/job.yaml b/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/templates/job.yaml
deleted file mode 100644
index c758f4e1de2..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/templates/job.yaml
+++ /dev/null
@@ -1,213 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: batch/v1
-kind: Job
-metadata:
- name: "{{ $.Values.metadata.name }}-cacerts-job"
- namespace: "{{ $.Values.metadata.namespace }}"
- labels:
- app: "{{ $.Values.metadata.name }}-cacerts-job"
- app.kubernetes.io/name: "{{ $.Values.metadata.name }}-cacerts-job"
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
-spec:
- backoffLimit: 6
- template:
- metadata:
- labels:
- app: "{{ $.Values.metadata.name }}-cacerts-job"
- app.kubernetes.io/name: "{{ $.Values.metadata.name }}-cacerts-job"
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- spec:
- restartPolicy: "OnFailure"
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
- imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
- {{- end }}
- volumes:
- - name: certcheck
- emptyDir:
- medium: Memory
- - name: scripts-volume
- configMap:
- name: bevel-vault-script
- - name: package-manager
- configMap:
- name: package-manager
- initContainers:
- - name: init-check-certificates
- image: {{ $.Values.metadata.images.alpineutils }}
- imagePullPolicy: IfNotPresent
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_SECRET_CRYPTO_PATH
- value: {{ $.Values.vault.secretcryptoprefix }}
- - name: VAULT_SECRET_CREDENTIALS_PATH
- value: {{ $.Values.vault.secretcredentialsprefix }}
- - name: MOUNT_PATH
- value: "/certcheck"
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- . /scripts/bevel-vault.sh
-
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
-
- mkdir -p ${MOUNT_PATH}
-
- # Calling a function to retrieve secrets from Vault only if they exist.
- vaultBevelFunc "readJson" "${VAULT_SECRET_CRYPTO_PATH}"
-
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault"
- touch ${MOUNT_PATH}/present_cacert.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_cacert.txt
- fi
-
- # Check if CA server admin credentials already present in the vault
- vaultBevelFunc "readJson" "${VAULT_SECRET_CREDENTIALS_PATH}"
-
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault"
- touch ${MOUNT_PATH}/present_creds.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_creds.txt
- fi
-
- echo "Done checking for certificates in vault."
- volumeMounts:
- - name: certcheck
- mountPath: /certcheck
- - name: scripts-volume
- mountPath: /scripts/bevel-vault.sh
- subPath: bevel-vault.sh
- containers:
- - name: "cacerts"
- image: {{ $.Values.metadata.images.alpineutils }}
- imagePullPolicy: IfNotPresent
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_SECRET_CRYPTO_PATH
- value: {{ $.Values.vault.secretcryptoprefix }}
- - name: VAULT_SECRET_CREDENTIALS_PATH
- value: {{ $.Values.vault.secretcredentialsprefix }}
- - name: COMPONENT_NAME
- value: {{ $.Values.metadata.component_name }}
- - name: ORG_NAME
- value: {{ $.Values.metadata.name }}
- - name: CA_SUBJECT
- value: "{{ $.Values.ca.subject }}"
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
- command: ["sh", "-c"]
- args:
- - |-
- . /scripts/bevel-vault.sh
- . /scripts/package-manager.sh
-
- # Define the packages to install
- packages_to_install="jq curl openssl"
- install_packages "$packages_to_install"
-
- if [ -e /certcheck/absent_cacert.txt ]
- then
- # Create openssl.conf file
- echo "[req]
- req_extensions = v3_req
- distinguished_name = dn
-
- [dn]
-
- [v3_req]
- basicConstraints = critical, CA:TRUE
- keyUsage = critical,digitalSignature, keyEncipherment, keyCertSign, cRLSign
- subjectKeyIdentifier = hash
- " > openssl.conf
-
- # this commands generate the CA certificate
- openssl ecparam -name prime256v1 -genkey -noout -out ${COMPONENT_NAME}-CA.key
- openssl req -x509 -config "openssl.conf" -new -nodes -key ${COMPONENT_NAME}-CA.key -days 1024 -out ca.${COMPONENT_NAME}-cert.pem -extensions v3_req -subj "${CA_SUBJECT}"
-
- # This commands put the certificates with correct format for the curl command
- while IFS= read -r line
- do
- echo "$line\n"
- done < ${COMPONENT_NAME}-CA.key > ./cakey_formatted.txt
-
- while IFS= read -r line
- do
- echo "$line\n"
- done < ca.${COMPONENT_NAME}-cert.pem > ./capem_formatted.txt
-
- PEM_CERTIFICATE=$(cat capem_formatted.txt)
- KEY_CERTIFICATE=$(cat cakey_formatted.txt)
-
- echo "
- {
- \"data\":
- {
- \"ca.${COMPONENT_NAME}-cert.pem\": \"${PEM_CERTIFICATE}\",
- \"${COMPONENT_NAME}-CA.key\": \"${KEY_CERTIFICATE}\"
- }
- }" > payload.json
-
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
- # Calling a function to write secrets to the vault.
- vaultBevelFunc 'write' "${VAULT_SECRET_CRYPTO_PATH}" 'payload.json'
- rm payload.json
- fi
-
- if [ -e /certcheck/absent_creds.txt ]
- then
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
- echo "
- {
- \"data\":
- {
- \"user\": \"${ORG_NAME}-adminpw\"
- }
- }" > payload.json
-
- # Calling a function to write a secret to the vault.
- vaultBevelFunc 'write' "${VAULT_SECRET_CREDENTIALS_PATH}" 'payload.json'
- # Calling a function to retrieve secrets from Vault only if they exist.
- vaultBevelFunc "readJson" "${VAULT_SECRET_CREDENTIALS_PATH}"
- fi
- volumeMounts:
- - name: certcheck
- mountPath: /certcheck
- - name: scripts-volume
- mountPath: /scripts/bevel-vault.sh
- subPath: bevel-vault.sh
- - name: package-manager
- mountPath: /scripts/package-manager.sh
- subPath: package-manager.sh
diff --git a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/values.yaml b/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/values.yaml
deleted file mode 100644
index 3fbbe603697..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-cacerts-gen/values.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-metadata:
- #Provide organization's name
- #Eg. namespace: org1
- name: org1
- #Provide organization's component_name
- #Eg. component_name: org1-net
- component_name: org1-net
- #Provide the namespace for organization's peer
- #Eg. namespace: org1-net
- namespace: org1-net
- images:
- #Provide the valid image name and version to read certificates from vault server
- #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name , app.
- #Eg. labels:
- # role: anchorpeer
- labels: anchorpeer
-
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: org1-vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: fra-demo-hlkube-cluster-org1
- authpath: devorg1-net-auth
- # Vault secret prefix for crypto
- secretcryptoprefix: secretsv2/data/crypto/ordererOrganizations/org1-net/ca
- # Vault secret prefix for credentials
- secretcredentialsprefix: secretsv2/data/credentials/org1-net/ca/smari
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Kuberenetes secret for vault ca.cert
- #Enable or disable TLS for vault communication if value present or not
-
-ca:
- #Provide the subject of the services ca organization's
- #Eg. subject: "/C=GB/ST=London/L=London/O=Carrier/CN=org1-net"
- subject: /C=GB/ST=London/L=London/O=Orderer/CN=ca.org1-net
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/.helmignore b/platforms/hyperledger-fabric/charts/fabric-catools/.helmignore
new file mode 100644
index 00000000000..014fa775608
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+generated_config/
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-catools/Chart.yaml
index 6ff272cccab..8a692565134 100644
--- a/platforms/hyperledger-fabric/charts/fabric-catools/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/Chart.yaml
@@ -5,7 +5,22 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Deploys a Fabric CA tools."
name: fabric-catools
-version: 1.0.0
+description: "Hyperledger Fabric: Generates Fabric Certificates and Keys"
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/README.md b/platforms/hyperledger-fabric/charts/fabric-catools/README.md
index 8353542dcba..a77580f726d 100644
--- a/platforms/hyperledger-fabric/charts/fabric-catools/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/README.md
@@ -3,234 +3,117 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# CA Tools Hyperledger Fabric Deployment
+# fabric-catools
-- [CA Tools Hyperledger Fabric Deployment Helm Chart](#ca-tools-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-catools chart creates job(s) to generate the certificates and keys required for Hyperledger Fabric network. If enabled, the keys are then stored on the configured vault and stored as Kubernetes secrets. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## CA Tools Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-catools) to deploy Fabric CA tools.
-
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install catools bevel/fabric-catools
+```
-
## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
+- Kubernetes 1.19+
+- Helm 3.2.0+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
+## Installing the Chart
-```
-fabric-catools/
- |- templates/
- |- _helpers.yaml
- |- configmap.yaml
- |- deployment.yaml
- |- volume.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
+To install the chart with the release name `catools`:
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: Contains definitions for six different configmaps. These configmaps will be used by the main and store-vault containers through volume mounting to support their respective tasks.
-- `deployment.yaml`: The init-container generates the cryptographic material for the Fabric CA server and checks if the cryptographic material already exists in Vault. If it does, the init-container will skip the generation process. The main container runs the Fabric CA server, issues certificates to clients in the organization, and has a liveness probe that checks if the Fabric CA server is running. The store-vault container stores the cryptographic material in Vault, Checks if any certificates have not been stored correctly.
-- `volume.yaml`: Defines 2 persistent volume to store the data.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install catools bevel/fabric-catools
+```
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-catools/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
+> **Tip**: List all releases using `helm list`
-### Metadata
+## Uninstalling the Chart
-| Name | Description | Default Value |
-| ----------------------| --------------------------------------------------| ------------------- |
-| namespace | Namespace for CA deployment | org1-net |
-| name | Name for CA server deployment | ca-tools |
-| component_type | Organization's type (orderer or peer) | orderer |
-| org_name | Organization's name in lowercase | org1 |
-| proxy | Proxy/ingress provider (haproxy or none) | haproxy |
+To uninstall/delete the `catools` deployment:
-### Replica
+```bash
+helm uninstall catools
+```
-| Name | Description | Default Value |
-| ----------------------| --------------------------- | ---------------|
-| replicaCount | Number of replica pods | 1 |
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `false` |
+| `global.proxy.provider` | The proxy or Ingress provider. Can be `none` or `haproxy` | `haproxy` |
+| `global.proxy.externalUrlSuffix` | The External URL suffix at which the Fabric GRPC services will be available | `test.blockchaincloudpoc.com` |
### Image
-| Name | Description | Default Value |
-| --------------| ------------------------------------------------------------------------| ----------------------------------------------------|
-| repository | Image name for the server container | ghcr.io/hyperledger/bevel-fabric-ca-tools:1.2.1 |
-| pullPolicy | Image pull policy | IfNotPresent |
-| alpineutils | Valid image name and version to read certificates from the vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-
-
-### Annotations
-
-| Name | Description | Default Value |
-| ---------------| --------------------------------------|-----------------|
-| pvc | Extra annotations for PVC | "" |
-| deployment | Extra annotations for Deployment | "" |
-
-### Storage
-
-| Name | Description | Default Value |
-| ----------------------| --------------------------- | ------------------- |
-| storageclassname | Storage class name | aws-storageclass |
-| storagesize | Storage size for CA | 512Mi |
-
-### Vault
-
-| Name | Description | Default Value |
-| ----------------------| ------------------------------------------------------------------|-----------------------------------|
-| role | Vault role for an organization | vault-role |
-| address | Vault server address | "" |
-| authpath | Kubernetes auth backend configured in vault for an organization | devorg1-net-auth |
-| secretusers | Path configured in vault for users certificates | secretsv2/data/crypto/ordererOrganizations/org1-net/users |
-| secretorderer | Path configured in vault for orderers | secretsv2/data/crypto/ordererOrganizations/org1-net/orderers |
-| secretpeerorderertls | Path configured in vault for peer orderer TLS | secretsv2/data/crypto/peerOrganizations/org1-net/orderer/tls |
-| secretcert | Path configured in vault for CA server certificate | secretsv2/data/crypto/ordererOrganizations/org1-net/ca?ca.org1-net-cert.pem |
-| secretkey | Path configured in vault for CA server private key | secretsv2/data/crypto/ordererOrganizations/org1-net/ca?org1-net-CA.key |
-| secretconfigfile | Path configured in vault for MSP config.yaml file | secretsv2/data/crypto/ordererOrganizations/org1-net/msp/config |
-| secretcouchdb | Path configured in vault for CouchDB credentials | secretsv2/data/credentials/org1-net/couchdb/org1 |
-| serviceaccountname | Service account name for Vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Image secret name for Vault | "" |
-
-### HealthCheck
-
-| Name | Description | Default Value |
-| ----------------------| --------------------------------------------------------------------------| ---------------|
-| retries | Number of times to retry fetching from/writing to Vault before giving up | 10 |
-| sleepTimeAfterError | Time in seconds to wait after an error occurs when interacting with Vault | 15 |
-
-### Org_data
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------| ----------------|
-| external_url_suffix | External URL of the organization | org1proxy.blockchaincloudpoc.com |
-| component_subject | Organization's subject | "" |
-| cert_subject | Organization's subject | "" |
-| component_country | Organization's country | UK |
-| component_state | Organization's state | London |
-| component_location | Organization's location | London |
-| ca_url | Organization's CA URL | "" |
-
-### Orderers
-
-| Name | Description | Default Value |
-| ---------------| --------------------------------------| ---------------|
-| name | Orderer's name | orderer1 |
-| orderers_info | Orderer's names and CA certificates | "" |
-
-### Peers
-
-| Name | Description | Default Value |
-| --------------| --------------------------- | -----------------|
-| name | Peer's name | peer1 |
-| peer_count | Total number of peers | 4 |
-
-### Users
-
-| Name | Description | Default Value |
-| ----------------------| --------------------------- | ----------------|
-| users_list | Base64 encoded list of users | "" |
-| users_identities | List of user identities | "" |
-
-### Checks
-
-| Name | Description | Default Value |
-| ----------------------| --------------------------- | ------------------- |
-| refresh_cert_value | Refresh user certificates | false |
-| add_peer_value | Add a peer to an existing network | false |
-
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.caTools` | Fabric CA Tools image repository and tag | `ghcr.io/hyperledger/bevel-fabric-ca:latest` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
+| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
-
-## Deployment
----
+### OrgData
-To deploy the fabric-catools Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-catools/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-catools
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the fabric-catools node to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the deployment, we can use the following command:
-```
-$ kubectl get deployments -n
-```
-Replace `` with the actual namespace where the deployment was created. The command will display information about the deployment, including the number of replicas and their current status.
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `orgData.caAddress` | Address of the CA Server without https | `""` |
+| `orgData.caAdminUser` | CA Admin Username | `supplychain-admin` |
+| `orgData.caAdminPassword` | CA Admin Password | `supplychain-adminpw` |
+| `orgData.orgName` | Organization Name | `supplychain` |
+| `orgData.type` | Type of certificate to generate, choosed from `orderer` or `peer` | `orderer` |
+| `orgData.componentSubject` | X.509 subject for the organization | `"O=Orderer,L=51.50/-0.13/London,C=GB"` |
+### Users
-
-## Updating the Deployment
----
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `users.usersList` | Array of Users with their attributes | `- identity: user1`
`attributes:`
`- key: "hf.Revoker"`
`value: "true"` |
+| `users.usersListAnsible` | Base64 encoded list of Users generally passed from Ansible | `""` |
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-catools/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-catools
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-catools node is up to date.
+### Settings
-
-## Deletion
----
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `settings.createConfigMaps` | Flag to create configmaps. Must be set to `false` for additional orderers/peers in the same organization. | `true` |
+| `settings.refreshCertValue` | Flag to refresh User certificates | `false` |
+| `settings.addPeerValue` | Flag to be used when adding a new peer to the organization | `false` |
+| `settings.removeCertsOnDelete` | Flag to delete the user and peer certificates on uninstall | `false` |
+| `settings.removeOrdererTlsOnDelete` | Flag to delete the orderer TLS certificates on uninstall | `false` |
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
+### Labels
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [CA Tools Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-catools), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `labels.service` | Array of Labels for service object | `[]` |
+| `labels.pvc` | Array of Labels for PVC object | `[]` |
+| `labels.deployment` | Array of Labels for deployment or statefulset object | `[]` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-catools/templates/_helpers.tpl
index d43c09d8cef..89092a8c24e 100644
--- a/platforms/hyperledger-fabric/charts/fabric-catools/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/templates/_helpers.tpl
@@ -1,5 +1,54 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-catools.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-catools.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-catools.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "labels.deployment" -}}
+{{- range $value := .Values.labels.deployment }}
+{{ toYaml $value }}
{{- end }}
+{{- end }}
+
+{{- define "labels.service" -}}
+{{- range $value := .Values.labels.service }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.pvc" -}}
+{{- range $value := .Values.labels.pvc }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create server name depending on proxy
+*/}}
+{{- define "fabric-catools.caFileName" -}}
+{{- $serverAddress := .Values.orgData.caAddress | replace "." "-" | replace ":" "-" -}}
+{{- printf "%s.pem" $serverAddress -}}
+{{- end -}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-catools/templates/configmap.yaml
index 40bb8bc304e..12ddce59656 100644
--- a/platforms/hyperledger-fabric/charts/fabric-catools/templates/configmap.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/templates/configmap.yaml
@@ -3,112 +3,104 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
-
+{{- if .Values.settings.createConfigMaps }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: crypto-scripts-cm
- namespace: {{ .Values.metadata.namespace }}
+ namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: crypto-scripts
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
generate-crypto-orderer.sh: |-
#!/bin/bash
-
+ # IMP: Do not add newline before the #!/bin/bash line above as then the shell scripts don't work
set -x
CURRENT_DIR=${PWD}
- FULLY_QUALIFIED_ORG_NAME="{{ .Values.metadata.namespace }}"
- EXTERNAL_URL_SUFFIX="{{ .Values.org_data.external_url_suffix }}"
- ALTERNATIVE_ORG_NAMES=("{{ .Values.org_data.external_url_suffix }}")
- ORG_NAME="{{ .Values.metadata.org_name }}"
- SUBJECT="C={{ .Values.org_data.component_country }},ST={{ .Values.org_data.component_state }},L={{ .Values.org_data.component_location }},O={{ .Values.metadata.org_name }}"
- SUBJECT_PEER="{{ .Values.org_data.component_subject }}"
- CA="{{ .Values.org_data.ca_url }}"
- CA_ADMIN_USER="${ORG_NAME}-admin"
- CA_ADMIN_PASS="${ORG_NAME}-adminpw"
+ FULLY_QUALIFIED_ORG_NAME="{{ .Release.Namespace }}"
+ EXTERNAL_URL_SUFFIX="{{ .Values.global.proxy.externalUrlSuffix }}"
+ SUBJECT="{{ .Values.orgData.componentSubject }}"
+ AFFILIATION="{{ .Values.orgData.orgName }}"
+ CA="{{ .Values.orgData.caAddress }}"
+ CA_ADMIN_USER="{{ .Values.orgData.caAdminUser }}"
+ CA_ADMIN_PASS="{{ .Values.orgData.caAdminPassword }}"
ORG_ADMIN_USER="Admin@${FULLY_QUALIFIED_ORG_NAME}"
ORG_ADMIN_PASS="Admin@${FULLY_QUALIFIED_ORG_NAME}-pw"
ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
-
ROOT_TLS_CERT="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
- CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
- ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
+ CAS_FOLDER="${HOME}/ca-tools/cas/ca"
+ ORG_HOME="${HOME}/ca-tools/org"
## Enroll CA administrator for Org. This user will be used to create other identities
- fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT}"
## Get the CA cert and store in Org MSP folder
fabric-ca-client getcacert -d -u https://${CA} --tls.certfiles ${ROOT_TLS_CERT} -M ${ORG_CYPTO_FOLDER}/msp
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
mkdir ${ORG_CYPTO_FOLDER}/msp/tlscacerts
cp ${ORG_CYPTO_FOLDER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/msp/tlscacerts
- ## Register and enroll admin for Org and populate admincerts for MSP
- fabric-ca-client register -d --id.name ${ORG_ADMIN_USER} --id.secret ${ORG_ADMIN_PASS} --id.type admin --csr.names "${SUBJECT_PEER}" --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.AffiliationMgr=true,hf.GenCRL=true,admin=true:ecert,abac.init=true:ecert" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
-
- fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT_PEER}"
+ if [ ! -e /crypto-config/admin-msp-exists ] || [ ! -e /crypto-config/admin-tls-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # Add affiliation for organisation
+ fabric-ca-client affiliation add ${AFFILIATION} -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
+ ## Register and enroll admin for Org and populate admincerts for MSP
+ fabric-ca-client register -d --id.name ${ORG_ADMIN_USER} --id.secret ${ORG_ADMIN_PASS} --id.type admin --csr.names "${SUBJECT}" --id.affiliation ${AFFILIATION} --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.AffiliationMgr=true,hf.GenCRL=true,admin=true:ecert,abac.init=true:ecert" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
- mkdir -p ${ORG_CYPTO_FOLDER}/msp/admincerts
- cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
+ fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --id.affiliation ${AFFILIATION} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT}"
- mkdir ${ORG_HOME}/admin/msp/admincerts
- cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_HOME}/admin/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
+ mkdir -p ${ORG_CYPTO_FOLDER}/msp/admincerts
+ cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
- mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
- cp -R ${ORG_HOME}/admin/msp ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
+ mkdir ${ORG_HOME}/admin/msp/admincerts
+ cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_HOME}/admin/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
+ mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
+ cp -R ${ORG_HOME}/admin/msp ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
- # Get TLS cert for admin and copy to appropriate location
- fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
+ # Get TLS cert for admin and copy to appropriate location
+ fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
- # Copy the TLS key and cert to the appropriate place
- mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls
- cp ${ORG_HOME}/admin/tls/keystore/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.key
- cp ${ORG_HOME}/admin/tls/signcerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.crt
- cp ${ORG_HOME}/admin/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/ca.crt
+ # Copy the TLS key and cert to the appropriate place
+ mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls
+ cp ${ORG_HOME}/admin/tls/keystore/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.key
+ cp ${ORG_HOME}/admin/tls/signcerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.crt
+ cp ${ORG_HOME}/admin/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/ca.crt
+ fi
cd ${CURRENT_DIR}
orderer-script.sh: |-
#!/bin/bash
-
set -x
CURRENT_DIR=${PWD}
- FULLY_QUALIFIED_ORG_NAME="{{ .Values.metadata.namespace }}"
- EXTERNAL_URL_SUFFIX="{{ .Values.org_data.external_url_suffix }}"
- ALTERNATIVE_ORG_NAMES=("{{ .Values.org_data.external_url_suffix }}")
- ORG_NAME="{{ .Values.metadata.org_name }}"
- SUBJECT="C={{ .Values.org_data.component_country }},ST={{ .Values.org_data.component_state }},L={{ .Values.org_data.component_location }},O={{ .Values.metadata.org_name }}"
- SUBJECT_PEER="{{ .Values.org_data.component_subject }}"
- CA="{{ .Values.org_data.ca_url }}"
- CA_ADMIN_USER="${ORG_NAME}-admin"
- CA_ADMIN_PASS="${ORG_NAME}-adminpw"
+ FULLY_QUALIFIED_ORG_NAME="{{ .Release.Namespace }}"
+ EXTERNAL_URL_SUFFIX="{{ .Values.global.proxy.externalUrlSuffix }}"
+ ALTERNATIVE_ORG_NAMES=("{{ .Release.Namespace }}.svc.cluster.local" "{{ .Values.orgData.orgName }}.net" "{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}")
+ SUBJECT="{{ .Values.orgData.componentSubject }}"
+ CA="{{ .Values.orgData.caAddress }}"
+ CA_ADMIN_USER="{{ .Values.orgData.caAdminUser }}"
+ CA_ADMIN_PASS="{{ .Values.orgData.caAdminPassword }}"
ORDERER_NAME=$1
ORG_ADMIN_USER="Admin@${FULLY_QUALIFIED_ORG_NAME}"
ORG_ADMIN_PASS="Admin@${FULLY_QUALIFIED_ORG_NAME}-pw"
ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
-
ROOT_TLS_CERT="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
- CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
- ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
+ CAS_FOLDER="${HOME}/ca-tools/cas/ca"
+ ORG_HOME="${HOME}/ca-tools/org"
## Register and enroll node and populate its MSP folder
PEER="${ORDERER_NAME}.${FULLY_QUALIFIED_ORG_NAME}"
@@ -123,7 +115,7 @@ data:
fabric-ca-client register -d --id.name ${PEER} --id.secret ${PEER}-pw --id.type orderer --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
# Enroll to get peers TLS cert
- fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/orderers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/orderers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
# Copy the TLS key and cert to the appropriate place
mkdir -p ${ORG_CYPTO_FOLDER}/orderers/${PEER}/tls
@@ -134,110 +126,91 @@ data:
rm -rf ${ORG_HOME}/cas/orderers/tls
# Enroll again to get the peer's enrollment certificate (default profile)
- fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
+ fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
# Create the TLS CA directories of the MSP folder if they don't exist.
mkdir ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/tlscacerts
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
cp ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/tlscacerts
# Copy the peer org's admin cert into target MSP directory
mkdir -p ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/admincerts
cp ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/admincerts
-
cd ${CURRENT_DIR}
generate-crypto-peer.sh: |-
#!/bin/bash
-
set -x
CURRENT_DIR=${PWD}
- FULLY_QUALIFIED_ORG_NAME="{{ .Values.metadata.namespace }}"
- ALTERNATIVE_ORG_NAMES=("{{ .Values.metadata.namespace }}.svc.cluster.local" "{{ .Values.metadata.org_name }}.net" "{{ .Values.metadata.namespace }}.{{ .Values.org_data.external_url_suffix }}")
- ORG_NAME="{{ .Values.metadata.org_name }}"
- EXTERNAL_URL_SUFFIX="{{ .Values.org_data.external_url_suffix }}"
- AFFILIATION="{{ .Values.metadata.org_name }}"
- SUBJECT="C={{ .Values.org_data.component_country }},ST={{ .Values.org_data.component_state }},L={{ .Values.org_data.component_location }},O={{ .Values.metadata.org_name }}"
- SUBJECT_PEER="{{ .Values.org_data.component_subject }}"
- CA="{{ .Values.org_data.ca_url }}"
- CA_ADMIN_USER="${ORG_NAME}-admin"
- CA_ADMIN_PASS="${ORG_NAME}-adminpw"
+ FULLY_QUALIFIED_ORG_NAME="{{ .Release.Namespace }}"
+ ALTERNATIVE_ORG_NAMES=("{{ .Release.Namespace }}.svc.cluster.local" "{{ .Values.orgData.orgName }}.net" "{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}")
+ EXTERNAL_URL_SUFFIX="{{ .Values.global.proxy.externalUrlSuffix }}"
+ AFFILIATION="{{ .Values.orgData.orgName }}"
+ SUBJECT="{{ .Values.orgData.componentSubject }}"
+ CA="{{ .Values.orgData.caAddress }}"
+ CA_ADMIN_USER="{{ .Values.orgData.caAdminUser }}"
+ CA_ADMIN_PASS="{{ .Values.orgData.caAdminPassword }}"
ORG_ADMIN_USER="Admin@${FULLY_QUALIFIED_ORG_NAME}"
ORG_ADMIN_PASS="Admin@${FULLY_QUALIFIED_ORG_NAME}-pw"
ORG_CYPTO_FOLDER="/crypto-config/peerOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
-
ROOT_TLS_CERT="/crypto-config/peerOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
- CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
- ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
-
- NO_OF_PEERS={{ .Values.peer_count }}
+ CAS_FOLDER="${HOME}/ca-tools/cas/ca"
+ ORG_HOME="${HOME}/ca-tools/org"
## Enroll CA administrator for Org. This user will be used to create other identities
- fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT}"
## Get the CA cert and store in Org MSP folder
fabric-ca-client getcacert -d -u https://${CA} --tls.certfiles ${ROOT_TLS_CERT} -M ${ORG_CYPTO_FOLDER}/msp
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
mkdir ${ORG_CYPTO_FOLDER}/msp/tlscacerts
cp ${ORG_CYPTO_FOLDER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/msp/tlscacerts
+ if [ ! -e /crypto-config/admin-msp-exists ] || [ ! -e /crypto-config/admin-tls-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # Add affiliation for organisation
+ fabric-ca-client affiliation add ${AFFILIATION} -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
+ ## Register and enroll admin for Org and populate admincerts for MSP
+ fabric-ca-client register -d --id.name ${ORG_ADMIN_USER} --id.secret ${ORG_ADMIN_PASS} --id.type admin --csr.names "${SUBJECT}" --id.affiliation ${AFFILIATION} --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.AffiliationMgr=true,hf.GenCRL=true,admin=true:ecert,abac.init=true:ecert" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
- # Add affiliation for organisation
- fabric-ca-client affiliation add ${AFFILIATION} -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
- ## Register and enroll admin for Org and populate admincerts for MSP
- fabric-ca-client register -d --id.name ${ORG_ADMIN_USER} --id.secret ${ORG_ADMIN_PASS} --id.type admin --csr.names "${SUBJECT_PEER}" --id.affiliation ${AFFILIATION} --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.AffiliationMgr=true,hf.GenCRL=true,admin=true:ecert,abac.init=true:ecert" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
+ fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --id.affiliation ${AFFILIATION} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT}"
- fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --id.affiliation ${AFFILIATION} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT_PEER}"
+ mkdir -p ${ORG_CYPTO_FOLDER}/msp/admincerts
+ cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
- mkdir -p ${ORG_CYPTO_FOLDER}/msp/admincerts
- cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
+ mkdir ${ORG_HOME}/admin/msp/admincerts
+ cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_HOME}/admin/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
- mkdir ${ORG_HOME}/admin/msp/admincerts
- cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_HOME}/admin/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
+ mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
+ cp -R ${ORG_HOME}/admin/msp ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
- mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
- cp -R ${ORG_HOME}/admin/msp ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
+ # Get TLS cert for admin and copy to appropriate location
+ fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
+ # Copy the TLS key and cert to the appropriate place
+ mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls
+ cp ${ORG_HOME}/admin/tls/keystore/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.key
+ cp ${ORG_HOME}/admin/tls/signcerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.crt
+ cp ${ORG_HOME}/admin/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/ca.crt
fi
-
- # Get TLS cert for admin and copy to appropriate location
- fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
- # Copy the TLS key and cert to the appropriate place
- mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls
- cp ${ORG_HOME}/admin/tls/keystore/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.key
- cp ${ORG_HOME}/admin/tls/signcerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.crt
- cp ${ORG_HOME}/admin/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/ca.crt
-
- ## Register and enroll peers and populate their MSP folder
- COUNTER=0
- while [ ${COUNTER} -lt ${NO_OF_PEERS} ]; do
- PEER="peer${COUNTER}.${FULLY_QUALIFIED_ORG_NAME}"
- CSR_HOSTS=${PEER}
- for i in "${ALTERNATIVE_ORG_NAMES[@]}"
- do
- CSR_HOSTS="${CSR_HOSTS},peer${COUNTER}.${i}"
- done
- echo "Registering and enrolling $PEER with csr hosts ${CSR_HOSTS}"
-
+ ## Register and enroll peer as per argument provided and populate their MSP folder
+ PEER_NAME=$1
+ PEER="${PEER_NAME}.${FULLY_QUALIFIED_ORG_NAME}"
+ CSR_HOSTS=${PEER}
+ for i in "${ALTERNATIVE_ORG_NAMES[@]}"
+ do
+ CSR_HOSTS="${CSR_HOSTS},${PEER_NAME}.${i}"
+ done
+ echo "Registering and enrolling $PEER with csr hosts ${CSR_HOSTS}"
+ if [ ! -e /crypto-config/$PEER_NAME-msp-exists ] || [ ! -e /crypto-config/$PEER_NAME-tls-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
# Register the peer
fabric-ca-client register -d --id.name ${PEER} --id.secret ${PEER}-pw --id.type peer --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
# Enroll to get peers TLS cert
- fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/peers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/peers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
# Copy the TLS key and cert to the appropriate place
mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls
@@ -248,68 +221,53 @@ data:
rm -rf ${ORG_HOME}/cas/peers/tls
# Enroll again to get the peer's enrollment certificate (default profile)
- fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
# Create the TLS CA directories of the MSP folder if they don't exist.
mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
# Copy the peer org's admin cert into target MSP directory
mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
+
cp ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
cp ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
-
- let COUNTER=COUNTER+1
- done
-
+ fi
cd ${CURRENT_DIR}
-
+
generate-crypto-add-peer.sh: |-
#!/bin/bash
-
set -x
CURRENT_DIR=${PWD}
- FULLY_QUALIFIED_ORG_NAME="{{ .Values.metadata.namespace }}"
- ALTERNATIVE_ORG_NAMES=("{{ .Values.metadata.namespace }}.svc.cluster.local" "{{ .Values.metadata.org_name }}.net" "{{ .Values.metadata.namespace }}.{{ .Values.org_data.external_url_suffix }}")
- ORG_NAME="{{ .Values.metadata.org_name }}"
- EXTERNAL_URL_SUFFIX="{{ .Values.org_data.external_url_suffix }}"
- AFFILIATION="{{ .Values.metadata.org_name }}"
- SUBJECT="C={{ .Values.org_data.component_country }},ST={{ .Values.org_data.component_state }},L={{ .Values.org_data.component_location }},O={{ .Values.metadata.org_name }}"
- SUBJECT_PEER="{{ .Values.org_data.component_subject }}"
- CA="{{ .Values.org_data.ca_url }}"
- CA_ADMIN_USER="${ORG_NAME}-admin"
- CA_ADMIN_PASS="${ORG_NAME}-adminpw"
+ FULLY_QUALIFIED_ORG_NAME="{{ .Release.Namespace }}"
+ ALTERNATIVE_ORG_NAMES=("{{ .Release.Namespace }}.svc.cluster.local" "{{ .Values.orgData.orgName }}.net" "{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}")
+ EXTERNAL_URL_SUFFIX="{{ .Values.global.proxy.externalUrlSuffix }}"
+ AFFILIATION="{{ .Values.orgData.orgName }}"
+ SUBJECT="{{ .Values.orgData.componentSubject }}"
+ CA="{{ .Values.orgData.caAddress }}"
+ CA_ADMIN_USER="{{ .Values.orgData.caAdminUser }}"
+ CA_ADMIN_PASS="{{ .Values.orgData.caAdminPassword }}"
ORG_ADMIN_USER="Admin@${FULLY_QUALIFIED_ORG_NAME}"
ORG_ADMIN_PASS="Admin@${FULLY_QUALIFIED_ORG_NAME}-pw"
ORG_CYPTO_FOLDER="/crypto-config/peerOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
-
ROOT_TLS_CERT="/crypto-config/peerOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
- CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
- ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
-
- NO_OF_PEERS={{ .Values.peer_count }}
- NO_OF_NEW_PEERS={{ .Values.new_peer_count }}
+ CAS_FOLDER="${HOME}/ca-tools/cas/ca"
+ ORG_HOME="${HOME}/ca-tools/org"
## Enroll CA administrator for Org. This user will be used to create other identities
- fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT}"
## Get the CA cert and store in Org MSP folder
fabric-ca-client getcacert -d -u https://${CA} --tls.certfiles ${ROOT_TLS_CERT} -M ${ORG_CYPTO_FOLDER}/msp
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
mkdir ${ORG_CYPTO_FOLDER}/msp/tlscacerts
cp ${ORG_CYPTO_FOLDER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/msp/tlscacerts
## Enroll admin for Org and populate admincerts for MSP
- fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --id.affiliation ${AFFILIATION} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --id.affiliation ${AFFILIATION} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT}"
# Copy existing org certs
mkdir -p ${ORG_CYPTO_FOLDER}/msp/admincerts
@@ -321,12 +279,8 @@ data:
mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
cp -R ${ORG_HOME}/admin/msp ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
-
# Get TLS cert for admin and copy to appropriate location
- fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
+ fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
# Copy the TLS key and cert to the appropriate place
mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls
@@ -335,78 +289,67 @@ data:
cp ${ORG_HOME}/admin/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/ca.crt
## Register and enroll peers and populate their MSP folder
- COUNTER=`expr ${NO_OF_PEERS} - ${NO_OF_NEW_PEERS}`
- while [ ${COUNTER} -lt ${NO_OF_PEERS} ]; do
- PEER="peer${COUNTER}.${FULLY_QUALIFIED_ORG_NAME}"
- CSR_HOSTS=${PEER}
- for i in "${ALTERNATIVE_ORG_NAMES[@]}"
- do
- CSR_HOSTS="${CSR_HOSTS},peer${COUNTER}.${i}"
- done
- echo "Registering and enrolling $PEER with csr hosts ${CSR_HOSTS}"
+ PEER_NAME=$1
+ PEER="${PEER_NAME}.${FULLY_QUALIFIED_ORG_NAME}"
+ CSR_HOSTS=${PEER}
+ for i in "${ALTERNATIVE_ORG_NAMES[@]}"
+ do
+ CSR_HOSTS="${CSR_HOSTS},${PEER_NAME}.${i}"
+ done
+ echo "Registering and enrolling $PEER with csr hosts ${CSR_HOSTS}"
- # Register the peer
- fabric-ca-client register -d --id.name ${PEER} --id.secret ${PEER}-pw --id.type peer --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} -u https://${CA}
+ # Register the peer
+ fabric-ca-client register -d --id.name ${PEER} --id.secret ${PEER}-pw --id.type peer --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} -u https://${CA}
- # Enroll to get peers TLS cert
- fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/peers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
+ # Enroll to get peers TLS cert
+ fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/peers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
- # Copy the TLS key and cert to the appropriate place
- mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls
- cp ${ORG_HOME}/cas/peers/tls/keystore/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/server.key
- cp ${ORG_HOME}/cas/peers/tls/signcerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/server.crt
- cp ${ORG_HOME}/cas/peers/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/ca.crt
-
- rm -rf ${ORG_HOME}/cas/peers/tls
-
- # Enroll again to get the peer's enrollment certificate (default profile)
- fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
+ # Copy the TLS key and cert to the appropriate place
+ mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls
+ cp ${ORG_HOME}/cas/peers/tls/keystore/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/server.key
+ cp ${ORG_HOME}/cas/peers/tls/signcerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/server.crt
+ cp ${ORG_HOME}/cas/peers/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/ca.crt
+
+ rm -rf ${ORG_HOME}/cas/peers/tls
+
+ # Enroll again to get the peer's enrollment certificate (default profile)
+ fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT}"
- # Create the TLS CA directories of the MSP folder if they don't exist.
- mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
-
- # Copy the peer org's admin cert into target MSP directory
- mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
- cp ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
- cp ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
-
- let COUNTER=COUNTER+1
- done
+ # Create the TLS CA directories of the MSP folder if they don't exist.
+ mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
+
+ # Copy the peer org's admin cert into target MSP directory
+ mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
+
+ cp ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
+ cp ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
cd ${CURRENT_DIR}
generate-user-crypto.sh: |-
#!/bin/bash
-
set -x
CURRENT_DIR=${PWD}
# Input parameters
- FULLY_QUALIFIED_ORG_NAME="{{ .Values.metadata.namespace }}"
- ORG_NAME="{{ .Values.metadata.org_name }}"
+ FULLY_QUALIFIED_ORG_NAME="{{ .Release.Namespace }}"
TYPE_FOLDER=$1s
USER_IDENTITIES=$2
- AFFILIATION="{{ .Values.metadata.org_name }}"
- SUBJECT="{{ .Values.org_data.component_subject }}"
- CA="{{ .Values.org_data.ca_url }}"
- if [ "$1" != "peer" ]; then
- ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
- ROOT_TLS_CERT="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
- else
- ORG_CYPTO_FOLDER="/crypto-config/$1Organizations/${FULLY_QUALIFIED_ORG_NAME}"
- ROOT_TLS_CERT="/crypto-config/$1Organizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
- fi
- CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
- ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
+ AFFILIATION="{{ .Values.orgData.orgName }}"
+ SUBJECT="{{ .Values.orgData.componentSubject }}"
+ CA="{{ .Values.orgData.caAddress }}"
+
+ ORG_CYPTO_FOLDER="/crypto-config/$1Organizations/${FULLY_QUALIFIED_ORG_NAME}"
+ ROOT_TLS_CERT="/crypto-config/$1Organizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
+
+ CAS_FOLDER="${HOME}/ca-tools/cas/ca"
+ ORG_HOME="${HOME}/ca-tools/org"
## Register and enroll users
CUR_USER=0
TOTAL_USERS=$(echo ${USER_IDENTITIES} | base64 -d | sed -e 's/None/null/g' | tr "'" '"' | jq '. | length')
+
while [ ${CUR_USER} -lt ${TOTAL_USERS} ]; do
-
# Get the user identity
USER=$(echo ${USER_IDENTITIES} | base64 -d | sed -e 's/None/null/g' | tr "'" '"' | jq '.['${CUR_USER}'].identity' | sed -e 's/"//g')
ORG_USER="${USER}@${FULLY_QUALIFIED_ORG_NAME}"
@@ -422,16 +365,12 @@ data:
ATTRS=${ATTRS}","$(echo ${USER_IDENTITIES} | base64 -d | sed -e 's/None/null/g' | tr "'" '"' | jq '.['${CUR_USER}'].attributes['${CUR_ATTRS}'].key' | sed -e 's/"//g')"="$(echo ${USER_IDENTITIES} | base64 -d | sed -e 's/None/null/g' | tr "'" '"' | jq '.['${CUR_USER}'].attributes['${CUR_ATTRS}'].value' | sed -e 's/"//g')":ecert"
CUR_ATTRS=$((CUR_ATTRS + 1))
done
-
- # Checking if the user msp folder exists in the CA server
- if [ ! -d "${ORG_HOME}/client${USER}" ]; then # if user certificates do not exist
-
+
+ #Check if the user certs does not exist
+ if [ ! -e /crypto-config/${USER}-msp-exists ] || [ ! -e /crypto-config/${USER}-tls-exists ]; then
+ # if user certificates do not exist
## Register and enroll User for Org
- if [ "$1" = "peer" ]; then
- fabric-ca-client register -d --id.name ${ORG_USER} --id.secret ${ORG_USERPASS} --id.type client --csr.names "${SUBJECT}" --id.affiliation ${AFFILIATION} --id.attrs "${ATTRS}" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
- else
- fabric-ca-client register -d --id.name ${ORG_USER} --id.secret ${ORG_USERPASS} --id.type client --csr.names "${SUBJECT}" --id.attrs "${ATTRS}" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
- fi
+ fabric-ca-client register -d --id.name ${ORG_USER} --id.secret ${ORG_USERPASS} --id.type client --csr.names "${SUBJECT}" --id.affiliation ${AFFILIATION} --id.attrs "${ATTRS}" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
# Enroll the registered user to generate enrollment certificate
fabric-ca-client enroll -d -u https://${ORG_USER}:${ORG_USERPASS}@${CA} --csr.names "${SUBJECT}" --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/client${USER}
@@ -442,9 +381,6 @@ data:
mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_USER}
cp -R ${ORG_HOME}/client${USER}/msp ${ORG_CYPTO_FOLDER}/users/${ORG_USER}
- if [ "{{ .Values.metadata.proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/users/${ORG_USER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/users/${ORG_USER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
mkdir ${ORG_CYPTO_FOLDER}/users/${ORG_USER}/msp/tlscacerts
cp ${ORG_CYPTO_FOLDER}/users/${ORG_USER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_USER}/msp/tlscacerts
@@ -461,7 +397,7 @@ data:
# Current datetime + 5 minutes | e.g. 20210302182036
CUR_DATETIME=$(date -d "$(echo $(date)' + 5 minutes')" +'%Y%m%d%H%M%S')
-
+ #TODO get ${ORG_HOME}/client${USER}/msp/signcerts/cert.pem from Kubernetes secret or Vault in job.yaml
# Extracting "notAfter" datetime from the existing user certificate | e.g. 20210302182036
CERT_DATETIME=$(date -d "$(echo $(openssl x509 -noout -enddate < ${ORG_HOME}/client${USER}/msp/signcerts/cert.pem) | sed 's/notAfter=//g')" +'%Y%m%d%H%M%S')
@@ -539,12 +475,14 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: orderer-script-store-vault
- namespace: {{ .Values.metadata.namespace }}
+ namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: orderer-script-vault
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
store-vault-orderer.sh: |-
#!/bin/bash
@@ -557,371 +495,230 @@ data:
done < ${1} > ${2}/${NAME}.txt
}
- validateVaultResponse () {
- if echo ${2} | grep "errors" || [ "${2}" = "" ]; then
- echo "ERROR: unable to retrieve ${1}: ${2}"
- exit 1
- fi
- if [ "$3" == "LOOKUPSECRETRESPONSE" ]
- then
- http_code=$(curl -fsS -o /dev/null -w "%{http_code}" \
- --header "X-Vault-Token: ${VAULT_TOKEN}" \
- ${VAULT_ADDR}/v1/${1})
- curl_response=$?
- if test "$http_code" != "200" ; then
- echo "Http response code from Vault - $http_code and curl_response - $curl_response"
- if test "$curl_response" != "0"; then
- echo "Error: curl command failed with error code - $curl_response"
- exit 1
- fi
- fi
- fi
- }
-
- echo "Puting secrets/certificates from Vault server"
- KUBE_SA_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
- VAULT_TOKEN=$(curl -sS --request POST ${VAULT_ADDR}/v1/auth/${KUBERNETES_AUTH_PATH}/login -H "Content-Type: application/json" -d '{"role":"'"${VAULT_APP_ROLE}"'","jwt":"'"${KUBE_SA_TOKEN}"'"}' | jq -r 'if .errors then . else .auth.client_token end')
- validateVaultResponse 'vault login token' "${VAULT_TOKEN}"
-
- FORMAT_CERTIFICATE_PATH="/formatcertificate"
- mkdir -p ${FORMAT_CERTIFICATE_PATH}/tls
- mkdir -p ${FORMAT_CERTIFICATE_PATH}/msp
-
- ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${COMPONENT_NAME}/users/Admin@${COMPONENT_NAME}"
-
- if [ -e /certcheck/present_tls.txt ]; then ADMIN_TLS_CERT_WRITTEN=true; else ADMIN_TLS_CERT_WRITTEN=false; fi
- if [ -e /certcheck/present_msp.txt ]; then ADMIN_MSP_CERT_WRITTEN=true; else ADMIN_MSP_CERT_WRITTEN=false; fi
- COUNTER=1
- while [ "$COUNTER" -le {{ $.Values.healthcheck.retries }} ]
- do
+ function saveAdminSecrets {
+ TLS_KEY=admin-tls
+ MSP_KEY=admin-msp
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . ../bevel-vault.sh
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+
+ FORMAT_CERTIFICATE_PATH="/formatcertificate"
+ mkdir -p ${FORMAT_CERTIFICATE_PATH}/tls
+ mkdir -p ${FORMAT_CERTIFICATE_PATH}/msp
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ formatCertificate "${ORG_CYPTO_FOLDER}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
+ formatCertificate "${ORG_CYPTO_FOLDER}/tls/client.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
+ formatCertificate "${ORG_CYPTO_FOLDER}/tls/client.key" "${FORMAT_CERTIFICATE_PATH}/tls"
- if [ -e /certcheck/absent_tls.txt ] && [ "$ADMIN_TLS_CERT_WRITTEN" = "false" ]
- then
-
- # This commands put the certificates with correct format for the curl command
- formatCertificate "${ORG_CYPTO_FOLDER}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
- formatCertificate "${ORG_CYPTO_FOLDER}/tls/client.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
- formatCertificate "${ORG_CYPTO_FOLDER}/tls/client.key" "${FORMAT_CERTIFICATE_PATH}/tls"
-
- CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/ca.crt.txt)
- CLIENT_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/client.crt.txt)
- CLIENT_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/client.key.txt)
-
- echo "
- {
- \"data\":
- {
- \"ca.crt\": \"${CA_CRT}\",
- \"client.crt\": \"${CLIENT_CRT}\",
- \"client.key\": \"${CLIENT_KEY}\"
- }
- }" > payload.json
-
- # This command copy organization level tls certificates for orgs
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/tls
-
- # Check tls certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/tls | jq -r 'if .errors then . else . end')
- TLS_CA_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["ca.crt"]' 2>&1)
- TLS_CLIENT_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["client.crt"]' 2>&1)
- TLS_CLIENT_KEY=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["client.key"]' 2>&1)
-
- tls_certificate_fields=("$TLS_CA_CERT" "$TLS_CLIENT_CERT" "$TLS_CLIENT_KEY")
-
- for field in "${tls_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- ADMIN_TLS_CERT_WRITTEN=false
- break
- else
- ADMIN_TLS_CERT_WRITTEN=true
- fi
- done
- rm payload.json
+ CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/ca.crt.txt)
+ CLIENT_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/client.crt.txt)
+ CLIENT_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/client.key.txt)
+
+ echo "
+ {
+ \"data\":
+ {
+ \"ca_crt\": \"${CA_CRT}\",
+ \"client_crt\": \"${CLIENT_CRT}\",
+ \"client_key\": \"${CLIENT_KEY}\"
+ }
+ }" > payload.json
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${TLS_KEY}" 'payload.json'
+ rm payload.json
fi
- if [ -e /certcheck/absent_msp.txt ] && [ "$ADMIN_MSP_CERT_WRITTEN" = "false" ]
- then
- # This commands put the certificates with correct format for the curl command
- SK_NAME=$(find ${ORG_CYPTO_FOLDER}/msp/keystore/ -name "*_sk")
-
- formatCertificate "${ORG_CYPTO_FOLDER}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
- formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/msp"
- formatCertificate "${ORG_CYPTO_FOLDER}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
- formatCertificate "${ORG_CYPTO_FOLDER}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ SK_NAME=$(find ${ORG_CYPTO_FOLDER}/msp/keystore/ -name "*_sk")
+ formatCertificate "${ORG_CYPTO_FOLDER}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
+ formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/msp"
+ formatCertificate "${ORG_CYPTO_FOLDER}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
+ formatCertificate "${ORG_CYPTO_FOLDER}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
- ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/Admin@${COMPONENT_NAME}-cert.pem.txt)
- KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/*_sk.txt)
- SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/cert.pem.txt)
- CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/ca.crt.txt)
+ ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/Admin@${COMPONENT_NAME}-cert.pem.txt)
+ KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/*_sk.txt)
+ SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/cert.pem.txt)
+ CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/ca.crt.txt)
- if [ "$PROXY" != "none" ] ; then
+ formatCertificate "${ORG_CYPTO_FOLDER}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/msp"
+ CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/{{ include "fabric-catools.caFileName" . }}.txt)
+
+ echo "
+ {
+ \"data\":
+ {
+ \"admincerts\": \"${ADMINCERTS}\",
+ \"cacerts\": \"${CACERTS}\",
+ \"keystore\": \"${KEYSTORE}\",
+ \"signcerts\": \"${SIGNCERTS}\",
+ \"tlscacerts\": \"${CA_CRT}\"
+ }
+ }" > payload.json
- formatCertificate "${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
-
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${CA_CRT}\"
- }
- }" > payload.json
- fi;
-
- if [ "$PROXY" = "none" ] ; then
-
- formatCertificate "${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/ca-${COMPONENT_NAME}-7054.pem.txt)
-
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${CA_CRT}\"
- }
- }" > payload.json
- fi;
-
- # This command copy organization level msp certificates for orgs
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/msp
-
- # Check msp certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/msp | jq -r 'if .errors then . else . end')
- MSP_ADMINCERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["admincerts"]' 2>&1)
- MSP_CACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["cacerts"]' 2>&1)
- MSP_KEYSTORE=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["keystore"]' 2>&1)
- MSP_SIGNCERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["signcerts"]' 2>&1)
- MSP_TLSCACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["tlscacerts"]' 2>&1)
-
- msp_certificate_fields=("$MSP_ADMINCERT" "$MSP_CACERTS" "$MSP_KEYSTORE" "$MSP_SIGNCERTS" "$MSP_TLSCACERTS")
-
- for field in "${msp_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- ADMIN_MSP_CERT_WRITTEN=false
- break
- else
- ADMIN_MSP_CERT_WRITTEN=true
- fi
- done
- rm payload.json
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${MSP_KEY}" 'payload.json'
+ rm payload.json
fi
-
- if [ "$ADMIN_TLS_CERT_WRITTEN" = "true" ] && [ "$ADMIN_MSP_CERT_WRITTEN" = "true" ]
- then
- echo "Admin certificates are successfully stored in vault"
- break
- else
- echo "Admin certificates are not ready, sleeping for {{ $.Values.healthcheck.sleepTimeAfterError }}"
- sleep {{ $.Values.healthcheck.sleepTimeAfterError }}
- COUNTER=`expr "$COUNTER" + 1`
+{{- end }} # end Vault if condition
+ # Files are stored as K8s secrets; add more conditions here for cloud KMS
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # Check if secret exists
+ kubectl get secret --namespace ${COMPONENT_NAME} ${TLS_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${TLS_KEY}
+ fi
+ kubectl create secret generic ${TLS_KEY} --namespace ${COMPONENT_NAME} --from-file=cacrt=${ORG_CYPTO_FOLDER}/tls/ca.crt \
+ --from-file=clientcrt=${ORG_CYPTO_FOLDER}/tls/client.crt \
+ --from-file=clientkey=${ORG_CYPTO_FOLDER}/tls/client.key
fi
- done
-
- if [ "$COUNTER" -gt {{ $.Values.healthcheck.retries }} ]
- then
- echo "Retry attempted `expr $COUNTER - 1` times, Admin certificates have not been saved."
- touch ${MOUNT_PATH}/certs_not_found.txt
- exit 1
- fi;
+
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ SK_NAME=$(find ${ORG_CYPTO_FOLDER}/msp/keystore/ -name "*_sk")
+ kubectl get secret --namespace ${COMPONENT_NAME} ${MSP_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${MSP_KEY}
+ fi
+ kubectl create secret generic ${MSP_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=admincerts=${ORG_CYPTO_FOLDER}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem \
+ --from-file=cacerts=${ORG_CYPTO_FOLDER}/msp/cacerts/{{ include "fabric-catools.caFileName" . }} \
+ --from-file=keystore=${SK_NAME} \
+ --from-file=signcerts=${ORG_CYPTO_FOLDER}/msp/signcerts/cert.pem \
+ --from-file=tlscacerts=${ORG_CYPTO_FOLDER}/tls/ca.crt
+ fi
+ echo "Orderer Admin certificates are successfully stored."
+ }
- ORG_CYPTO_ORDERER_FOLDER="/crypto-config/ordererOrganizations/${COMPONENT_NAME}/orderers"
- list=$(echo "$ORDERERS_NAMES" | tr "-" "\n")
- for ORDERER_NAME in $list
- do
- COUNTER=1
- if [ -e /certcheck/present_tls_${ORDERER_NAME}.txt ]; then ORDERER_TLS_CERT_WRITTEN=true; else ORDERER_TLS_CERT_WRITTEN=false; fi
- if [ -e /certcheck/present_msp_${ORDERER_NAME}.txt ]; then ORDERER_MSP_CERT_WRITTEN=true; else ORDERER_MSP_CERT_WRITTEN=false; fi
+ function saveOrdererSecrets {
+ ORDERER_NAME=$1
+ TLS_KEY=$1-tls
+ MSP_KEY=$1-msp
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . ../bevel-vault.sh
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+ FORMAT_CERTIFICATE_PATH="/formatcertificate"
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cacerts
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/tlscacerts
- while [ "$COUNTER" -le {{ $.Values.healthcheck.retries }} ]
- do
- if [ -e /certcheck/absent_tls_${ORDERER_NAME}.txt ] && [ "$ORDERER_TLS_CERT_WRITTEN" = "false" ]; then
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls"
+ formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/server.crt" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls"
+ formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/server.key" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls"
+
+ CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls/ca.crt.txt)
+ SERVER_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls/server.crt.txt)
+ SERVER_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls/server.key.txt)
+
+ echo "
+ {
+ \"data\":
+ {
+ \"ca_crt\": \"${CA_CRT}\",
+ \"server_crt\": \"${SERVER_CRT}\",
+ \"server_key\": \"${SERVER_KEY}\"
+ }
+ }" > payload.json
- # This commands put the certificates with correct format for the curl command
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls"
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/server.crt" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls"
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/server.key" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls"
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/orderers/${TLS_KEY}" 'payload.json'
+ rm payload.json
+ fi
+
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ SK_NAME=$(find ${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
+ formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp"
+ formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp"
+ formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp"
+
+ ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/Admin@${COMPONENT_NAME}-cert.pem.txt)
+ KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/*_sk.txt)
+ SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cert.pem.txt)
- CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls/ca.crt.txt)
- SERVER_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls/server.crt.txt)
- SERVER_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/tls/server.key.txt)
+ formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cacerts"
+ formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/tlscacerts"
+ CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}.txt)
+ TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}.txt)
- echo "
+ echo "
{
\"data\":
{
- \"ca.crt\": \"${CA_CRT}\",
- \"server.crt\": \"${SERVER_CRT}\",
- \"server.key\": \"${SERVER_KEY}\"
+ \"admincerts\": \"${ADMINCERTS}\",
+ \"cacerts\": \"${CACERTS}\",
+ \"keystore\": \"${KEYSTORE}\",
+ \"signcerts\": \"${SIGNCERTS}\",
+ \"tlscacerts\": \"${TLSCERTS}\"
}
}" > payload.json
- # This command copy the crypto material for orderer (tls)
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_ORDERER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls
-
- # Check tls certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_ORDERER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls | jq -r 'if .errors then . else . end')
- TLS_CA_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["ca.crt"]' 2>&1)
- TLS_SERVER_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["server.crt"]' 2>&1)
- TLS_SERVER_KEY=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["server.key"]' 2>&1)
-
- tls_certificate_fields=("$TLS_CA_CERT" "$TLS_SERVER_CERT" "$TLS_SERVER_KEY")
-
- for field in "${tls_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- ORDERER_TLS_CERT_WRITTEN=false
- break
- else
- ORDERER_TLS_CERT_WRITTEN=true
- fi
- done
- rm payload.json
- fi;
-
- if [ -e /certcheck/absent_msp_${ORDERER_NAME}.txt ] && [ "$ORDERER_MSP_CERT_WRITTEN" = "false" ]; then
- # This commands put the certificates with correct format for the curl command
- SK_NAME=$(find ${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
-
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp"
- formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp"
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp"
-
- ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/Admin@${COMPONENT_NAME}-cert.pem.txt)
- KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/*_sk.txt)
- SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cert.pem.txt)
-
- if [ "$PROXY" != "none" ] ; then
-
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cacerts"
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/tlscacerts"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
- TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
-
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${TLSCERTS}\"
- }
- }" > payload.json
-
- fi;
-
- if [ "$PROXY" = "none" ] ; then
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cacerts"
- formatCertificate "${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/tlscacerts"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem.txt)
- TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${ORDERER_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-7054.pem.txt)
-
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${TLSCERTS}\"
- }
- }" > payload.json
-
- fi;
-
- # This command copy the msp certificates to the Vault
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_ORDERER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp
-
- # Check msp certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_ORDERER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp | jq -r 'if .errors then . else . end')
- MSP_ADMINCERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["admincerts"]' 2>&1)
- MSP_CACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["cacerts"]' 2>&1)
- MSP_KEYSTORE=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["keystore"]' 2>&1)
- MSP_SIGNCERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["signcerts"]' 2>&1)
- MSP_TLSCACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["tlscacerts"]' 2>&1)
-
- msp_certificate_fields=("$MSP_ADMINCERT" "$MSP_CACERTS" "$MSP_KEYSTORE" "$MSP_SIGNCERTS" "$MSP_TLSCACERTS")
-
- for field in "${msp_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- ORDERER_MSP_CERT_WRITTEN=false
- break
- else
- ORDERER_MSP_CERT_WRITTEN=true
- fi
- done
- rm payload.json
- fi;
-
- if [ "$ORDERER_TLS_CERT_WRITTEN" = "true" ] && [ "$ORDERER_MSP_CERT_WRITTEN" = "true" ]
- then
- echo "${ORDERER_NAME} certificates are successfully stored in vault"
- break
- else
- echo "${ORDERER_NAME} certificates are not ready, sleeping for {{ $.Values.healthcheck.sleepTimeAfterError }}"
- sleep {{ $.Values.healthcheck.sleepTimeAfterError }}
- COUNTER=`expr "$COUNTER" + 1`
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/orderers/${MSP_KEY}" 'payload.json'
+ rm payload.json
+ fi
+{{- end }} # End Vault if condition
+ # Files are stored as K8s secrets; add more conditions here for cloud KMS
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # Check if secret exists
+ kubectl get secret --namespace ${COMPONENT_NAME} ${TLS_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${TLS_KEY}
fi
- done
-
- if [ "$COUNTER" -gt {{ $.Values.healthcheck.retries }} ]
- then
- echo "Retry attempted `expr $COUNTER - 1` times, Orderers certificates have not been saved."
- touch ${MOUNT_PATH}/certs_not_found.txt
- exit 1
- fi;
- done
+ kubectl create secret generic ${TLS_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=cacrt=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/ca.crt \
+ --from-file=servercrt=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/server.crt \
+ --from-file=serverkey=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/server.key
+ fi
+
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ SK_NAME=$(find ${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
+ kubectl get secret --namespace ${COMPONENT_NAME} ${MSP_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${MSP_KEY}
+ fi
+ kubectl create secret generic ${MSP_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=admincerts=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem \
+ --from-file=cacerts=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }} \
+ --from-file=keystore=${SK_NAME} \
+ --from-file=signcerts=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/signcerts/cert.pem \
+ --from-file=tlscacerts=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}
+ fi
+ echo "$ORDERER_NAME Client certificates are successfully stored."
+ }
+
+ function safeOrderererTlsConfigmap {
+ ORDERER_NAME=$1
+ kubectl get configmap --namespace {{ .Release.Namespace }} orderer-tls-cacert
+ if [ $? -ne 0 ]; then
+ kubectl create configmap --namespace {{ .Release.Namespace }} orderer-tls-cacert --from-file=cacert=${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/tls/ca.crt
+ fi
+ }
+
+ ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${COMPONENT_NAME}/users/Admin@${COMPONENT_NAME}"
+ ORG_CYPTO_ORDERER_FOLDER="/crypto-config/ordererOrganizations/${COMPONENT_NAME}/orderers"
+
+ saveAdminSecrets
+ ORDERER=$1
+ saveOrdererSecrets $ORDERER
+ safeOrderererTlsConfigmap $ORDERER
---
apiVersion: v1
kind: ConfigMap
metadata:
name: peer-script-store-vault
- namespace: {{ .Values.metadata.namespace }}
+ namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: peer-script-vault
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
store-vault-peer.sh: |-
#!/bin/bash
@@ -933,47 +730,18 @@ data:
echo "$line\n"
done < ${1} > ${2}/${NAME}.txt
}
-
- validateVaultResponse () {
- if echo ${2} | grep "errors" || [ "${2}" = "" ]; then
- echo "ERROR: unable to retrieve ${1}: ${2}"
- exit 1
- fi
- if [ "$3" == "LOOKUPSECRETRESPONSE" ]
- then
- http_code=$(curl -fsS -o /dev/null -w "%{http_code}" \
- --header "X-Vault-Token: ${VAULT_TOKEN}" \
- ${VAULT_ADDR}/v1/${1})
- curl_response=$?
- if test "$http_code" != "200" ; then
- echo "Http response code from Vault - $http_code and curl_response - $curl_response"
- if test "$curl_response" != "0"; then
- echo "Error: curl command failed with error code - $curl_response"
- exit 1
- fi
- fi
- fi
- }
-
- echo "Puting secrets/certificates from Vault server"
- KUBE_SA_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
- VAULT_TOKEN=$(curl -sS --request POST ${VAULT_ADDR}/v1/auth/${KUBERNETES_AUTH_PATH}/login -H "Content-Type: application/json" -d '{"role":"'"${VAULT_APP_ROLE}"'","jwt":"'"${KUBE_SA_TOKEN}"'"}' | jq -r 'if .errors then . else .auth.client_token end')
- validateVaultResponse 'vault login token' "${VAULT_TOKEN}"
-
- FORMAT_CERTIFICATE_PATH="/formatcertificate"
- mkdir -p ${FORMAT_CERTIFICATE_PATH}/tls
- mkdir -p ${FORMAT_CERTIFICATE_PATH}/msp
-
- ORG_CYPTO_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/users/Admin@${COMPONENT_NAME}"
-
- if [ -e /certcheck/present_tls.txt ]; then ADMIN_TLS_CERT_WRITTEN=true; else ADMIN_TLS_CERT_WRITTEN=false; fi
- if [ -e /certcheck/present_msp.txt ]; then ADMIN_MSP_CERT_WRITTEN=true; else ADMIN_MSP_CERT_WRITTEN=false; fi
- COUNTER=1
- while [ "$COUNTER" -le {{ $.Values.healthcheck.retries }} ]
- do
-
- if ([ -e /certcheck/absent_tls.txt ] && [ "$ADMIN_TLS_CERT_WRITTEN" = "false" ]) || [ "$REFRESH_CERTS" == 'true' ]; then
-
+ function saveAdminSecrets {
+ TLS_KEY=admin-tls
+ MSP_KEY=admin-msp
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . ../bevel-vault.sh
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+ FORMAT_CERTIFICATE_PATH="/formatcertificate"
+ mkdir -p ${FORMAT_CERTIFICATE_PATH}/tls
+ mkdir -p ${FORMAT_CERTIFICATE_PATH}/msp
+
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
# This commands put the certificates with correct format for the curl command
formatCertificate "${ORG_CYPTO_FOLDER}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
formatCertificate "${ORG_CYPTO_FOLDER}/tls/client.crt" "${FORMAT_CERTIFICATE_PATH}/tls"
@@ -984,49 +752,22 @@ data:
CLIENT_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/client.key.txt)
echo "
- {
- \"data\":
- {
- \"ca.crt\": \"${CA_CRT}\",
- \"client.crt\": \"${CLIENT_CRT}\",
- \"client.key\": \"${CLIENT_KEY}\"
- }
- }" > payload.json
-
- # This command copy organization level tls certificates for orgs
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/tls
-
- # Check tls certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/tls | jq -r 'if .errors then . else . end')
- TLS_CA_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["ca.crt"]' 2>&1)
- TLS_CLIENT_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["client.crt"]' 2>&1)
- TLS_CLIENT_KEY=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["client.key"]' 2>&1)
-
- tls_certificate_fields=("$TLS_CA_CERT" "$TLS_CLIENT_CERT" "$TLS_CLIENT_KEY")
-
- for field in "${tls_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- ADMIN_TLS_CERT_WRITTEN=false
- break
- else
- ADMIN_TLS_CERT_WRITTEN=true
- fi
- done
+ {
+ \"data\":
+ {
+ \"ca_crt\": \"${CA_CRT}\",
+ \"client_crt\": \"${CLIENT_CRT}\",
+ \"client_key\": \"${CLIENT_KEY}\"
+ }
+ }" > payload.json
+
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${TLS_KEY}" 'payload.json'
rm payload.json
- fi;
-
- if ([ -e /certcheck/absent_msp.txt ] && [ "$ADMIN_MSP_CERT_WRITTEN" = "false" ]) || [ "$REFRESH_CERTS" == 'true' ]; then
+ fi
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
# This commands put the certificates with correct format for the curl command
SK_NAME=$(find ${ORG_CYPTO_FOLDER}/msp/keystore/ -name "*_sk")
-
formatCertificate "${ORG_CYPTO_FOLDER}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/msp"
formatCertificate "${ORG_CYPTO_FOLDER}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
@@ -1037,426 +778,172 @@ data:
SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/cert.pem.txt)
CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/tls/ca.crt.txt)
- if [ "$PROXY" != "none" ] ; then
-
- formatCertificate "${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
-
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${CA_CRT}\"
- }
- }" > payload.json
-
- fi;
-
- if [ "$PROXY" = "none" ] ; then
-
- formatCertificate "${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/msp"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/ca-${COMPONENT_NAME}-7054.pem.txt)
-
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${CA_CRT}\"
- }
- }" > payload.json
- fi;
-
- # This command copy organization level msp certificates for orgs
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/msp
-
- # Check msp certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/admin/msp | jq -r 'if .errors then . else . end')
- MSP_ADMINCERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["admincerts"]' 2>&1)
- MSP_CACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["cacerts"]' 2>&1)
- MSP_KEYSTORE=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["keystore"]' 2>&1)
- MSP_SIGNCERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["signcerts"]' 2>&1)
- MSP_TLSCACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["tlscacerts"]' 2>&1)
-
- msp_certificate_fields=("$MSP_ADMINCERT" "$MSP_CACERTS" "$MSP_KEYSTORE" "$MSP_SIGNCERTS" "$MSP_TLSCACERTS")
-
- for field in "${msp_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- ADMIN_MSP_CERT_WRITTEN=false
- break
- else
- ADMIN_MSP_CERT_WRITTEN=true
- fi
- done
-
+ formatCertificate "${ORG_CYPTO_FOLDER}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/msp"
+ CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/msp/{{ include "fabric-catools.caFileName" . }}.txt)
+
+ echo "
+ {
+ \"data\":
+ {
+ \"admincerts\": \"${ADMINCERTS}\",
+ \"cacerts\": \"${CACERTS}\",
+ \"keystore\": \"${KEYSTORE}\",
+ \"signcerts\": \"${SIGNCERTS}\",
+ \"tlscacerts\": \"${CA_CRT}\"
+ }
+ }" > payload.json
+
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${MSP_KEY}" 'payload.json'
rm payload.json
- fi;
-
- if [ "$ADMIN_TLS_CERT_WRITTEN" = "true" ] && [ "$ADMIN_MSP_CERT_WRITTEN" = "true" ]
- then
- echo "Admin certificates are successfully stored in vault"
- break
- else
- echo "Admin certificates are not ready, sleeping for {{ $.Values.healthcheck.sleepTimeAfterError }}"
- sleep {{ $.Values.healthcheck.sleepTimeAfterError }}
- COUNTER=`expr "$COUNTER" + 1`
fi
- done
-
- if [ "$COUNTER" -gt {{ $.Values.healthcheck.retries }} ]
- then
- echo "Retry attempted `expr $COUNTER - 1` times, Admin certificates have not been saved."
- touch ${MOUNT_PATH}/certs_not_found.txt
- exit 1
- fi;
+{{- end }} # End Vault if condition
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # Check if secret exists
+ kubectl get secret --namespace ${COMPONENT_NAME} ${TLS_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${TLS_KEY}
+ fi
+ kubectl create secret generic ${TLS_KEY} --namespace ${COMPONENT_NAME} --from-file=cacrt=${ORG_CYPTO_FOLDER}/tls/ca.crt \
+ --from-file=clientcrt=${ORG_CYPTO_FOLDER}/tls/client.crt \
+ --from-file=clientkey=${ORG_CYPTO_FOLDER}/tls/client.key
+ fi
- ORG_CYPTO_PEER_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/peers"
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ SK_NAME=$(find ${ORG_CYPTO_FOLDER}/msp/keystore/ -name "*_sk")
+ kubectl get secret --namespace ${COMPONENT_NAME} ${MSP_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${MSP_KEY}
+ fi
+ kubectl create secret generic ${MSP_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=admincerts=${ORG_CYPTO_FOLDER}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem \
+ --from-file=cacerts=${ORG_CYPTO_FOLDER}/msp/cacerts/{{ include "fabric-catools.caFileName" . }} \
+ --from-file=keystore=${SK_NAME} \
+ --from-file=signcerts=${ORG_CYPTO_FOLDER}/msp/signcerts/cert.pem \
+ --from-file=tlscacerts=${ORG_CYPTO_FOLDER}/tls/ca.crt
+ fi
- list=$(echo "$PEERS_NAMES" | tr "-" "\n")
- for PEER in $list
- do
- SAVE=false
- STATUS="${PEER##*,}"
- if [ "$STATUS" = "new" ] || [ "$STATUS" = "" ]; then
- PEER_NAME="${PEER%%,*}"
- SAVE=true
- else
- continue
- fi;
-
- if [ -e /certcheck/present_tls_${PEER_NAME}.txt ]; then PEER_TLS_CERT_WRITTEN=true; else PEER_TLS_CERT_WRITTEN=false; fi
- if [ -e /certcheck/present_msp_${PEER_NAME}.txt ]; then PEER_MSP_CERT_WRITTEN=true; else PEER_MSP_CERT_WRITTEN=false; fi
+ echo "Peer Admin certificates are successfully stored."
+ }
+ function savePeerSecrets {
+ PEER_NAME=$1
+ TLS_KEY=$1-tls
+ MSP_KEY=$1-msp
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . ../bevel-vault.sh
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+ FORMAT_CERTIFICATE_PATH="/formatcertificate"
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cacerts
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/tlscacerts
- while [ "$COUNTER" -le {{ $.Values.healthcheck.retries }} ]
- do
- if ([ -e /certcheck/absent_tls_${PEER_NAME}.txt ] && [ "$PEER_TLS_CERT_WRITTEN" = "false" ] && [ "$SAVE" == 'true' ]) || [ "$REFRESH_CERTS" == 'true' ]; then
-
- # This commands put the certificates with correct format for the curl command
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls"
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/server.crt" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls"
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/server.key" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls"
-
- CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls/ca.crt.txt)
- SERVER_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls/server.crt.txt)
- SERVER_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls/server.key.txt)
-
- echo "
- {
- \"data\":
- {
- \"ca.crt\": \"${CA_CRT}\",
- \"server.crt\": \"${SERVER_CRT}\",
- \"server.key\": \"${SERVER_KEY}\"
- }
- }" > payload.json
-
- # This command copy the crypto material for peers (tls)
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_PEER}/${PEER_NAME}.${COMPONENT_NAME}/tls
-
- # Check tls certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_PEER}/${PEER_NAME}.${COMPONENT_NAME}/tls | jq -r 'if .errors then . else . end')
- TLS_CA_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["ca.crt"]' 2>&1)
- TLS_SERVER_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["server.crt"]' 2>&1)
- TLS_SERVER_KEY=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["server.key"]' 2>&1)
-
- tls_certificate_fields=("$TLS_CA_CERT" "$TLS_SERVER_CERT" "$TLS_SERVER_KEY")
-
- for field in "${tls_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- PEER_TLS_CERT_WRITTEN=false
- break
- else
- PEER_TLS_CERT_WRITTEN=true
- fi
- done
- rm payload.json
- fi;
-
- if ([ -e /certcheck/absent_msp_${PEER_NAME}.txt ] && [ "$PEER_MSP_CERT_WRITTEN" = "false" ] && [ "$SAVE" == 'true' ]) || [ "$REFRESH_CERTS" == 'true' ]; then
-
- # This commands put the certificates with correct format for the curl command
- SK_NAME=$(find ${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
-
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp"
- formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp"
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp"
-
- ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/Admin@${COMPONENT_NAME}-cert.pem.txt)
- KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/*_sk.txt)
- SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cert.pem.txt)
-
- if [ "$PROXY" != "none" ] ; then
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls"
+ formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/server.crt" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls"
+ formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/server.key" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls"
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cacerts"
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/tlscacerts"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
- TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
+ CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls/ca.crt.txt)
+ SERVER_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls/server.crt.txt)
+ SERVER_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/tls/server.key.txt)
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${TLSCERTS}\"
- }
- }" > payload.json
-
- fi;
-
- if [ "$PROXY" = "none" ] ; then
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cacerts"
- formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/tlscacerts"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem.txt)
- TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-7054.pem.txt)
-
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${TLSCERTS}\"
- }
- }" > payload.json
-
- fi;
-
- # This command copy the msp certificates to the Vault
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_PEER}/${PEER_NAME}.${COMPONENT_NAME}/msp
-
- # Check msp certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_PEER}/${PEER_NAME}.${COMPONENT_NAME}/msp | jq -r 'if .errors then . else . end')
- MSP_ADMINCERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["admincerts"]' 2>&1)
- MSP_CACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["cacerts"]' 2>&1)
- MSP_KEYSTORE=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["keystore"]' 2>&1)
- MSP_SIGNCERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["signcerts"]' 2>&1)
- MSP_TLSCACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["tlscacerts"]' 2>&1)
-
- msp_certificate_fields=("$MSP_ADMINCERT" "$MSP_CACERTS" "$MSP_KEYSTORE" "$MSP_SIGNCERTS" "$MSP_TLSCACERTS")
-
- for field in "${msp_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- PEER_MSP_CERT_WRITTEN=false
- break
- else
- PEER_MSP_CERT_WRITTEN=true
- fi
- done
- rm payload.json
- fi;
-
- if [ "$PEER_TLS_CERT_WRITTEN" = "true" ] && [ "$PEER_MSP_CERT_WRITTEN" = "true" ]
- then
- echo "${PEER_NAME} certificates are successfully stored in vault"
- break
- else
- echo "${PEER_NAME} certificates are not ready, sleeping for {{ $.Values.healthcheck.sleepTimeAfterError }}"
- sleep {{ $.Values.healthcheck.sleepTimeAfterError }}
- COUNTER=`expr "$COUNTER" + 1`
- fi
- done
+ echo "
+ {
+ \"data\":
+ {
+ \"ca_crt\": \"${CA_CRT}\",
+ \"server_crt\": \"${SERVER_CRT}\",
+ \"server_key\": \"${SERVER_KEY}\"
+ }
+ }" > payload.json
- if [ "$COUNTER" -gt {{ $.Values.healthcheck.retries }} ]
- then
- echo "Retry attempted `expr $COUNTER - 1` times, peers certificates have not been saved."
- touch ${MOUNT_PATH}/certs_not_found.txt
- exit 1
- fi;
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/peers/${TLS_KEY}" 'payload.json'
+ rm payload.json
+ fi
- done
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ SK_NAME=$(find ${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
+ formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp"
+ formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp"
+ formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp"
- COUNTER=1
- if [ -e /certcheck/present_config_file.txt ]; then CONFIG_FILE_WRITTEN=true; else CONFIG_FILE_WRITTEN=false; fi
- COUCHDB_WRITTEN=false
- while [ "$COUNTER" -le {{ $.Values.healthcheck.retries }} ]
- do
- if [ -e /certcheck/absent_config_file.txt ] && [ "$CONFIG_FILE_WRITTEN" = "false" ]; then
+ ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/Admin@${COMPONENT_NAME}-cert.pem.txt)
+ KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/*_sk.txt)
+ SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cert.pem.txt)
- # This commands put the config file with correct format for the curl command
- mkdir -p ${FORMAT_CERTIFICATE_PATH}/msp_config_file
- formatCertificate "/crypto-config/peerOrganizations/${COMPONENT_NAME}/msp/config.yaml" "${FORMAT_CERTIFICATE_PATH}/msp_config_file"
- MSP_CONFIG_FILE=$(cat ${FORMAT_CERTIFICATE_PATH}/msp_config_file/config.yaml.txt)
+ formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cacerts"
+ formatCertificate "${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/tlscacerts"
+ CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}.txt)
+ TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${PEER_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}.txt)
echo "
+ {
+ \"data\":
{
- \"data\":
- {
- \"configfile\": \"${MSP_CONFIG_FILE}\"
- }
- }" > payload.json
-
- # This command write the msp config file to Vault
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_CONFIG_FILE}
-
- # Check msp config file
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_CONFIG_FILE} | jq -r 'if .errors then . else . end')
- CONFIG_FILE=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["configfile"]' 2>&1)
-
- if [ "$CONFIG_FILE" = "null" ] || [[ "$CONFIG_FILE" = "parse error"* ]] || [ "$CONFIG_FILE" = "" ]
- then
- CONFIG_FILE_WRITTEN=false
- else
- CONFIG_FILE_WRITTEN=true
- fi
+ \"admincerts\": \"${ADMINCERTS}\",
+ \"cacerts\": \"${CACERTS}\",
+ \"keystore\": \"${KEYSTORE}\",
+ \"signcerts\": \"${SIGNCERTS}\",
+ \"tlscacerts\": \"${TLSCERTS}\"
+ }
+ }" > payload.json
+
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/peers/${MSP_KEY}" 'payload.json'
rm payload.json
- fi;
-
- if [ "$COUCHDB_WRITTEN" = "false" ]; then
-
- # This command writes the couchdb credentials for each organization to the vault
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d '{ "data": {"user":"admin123"}}' \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_COUCHDB}
-
- # Check couchdb credentials
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_COUCHDB} | jq -r 'if .errors then . else . end')
- USER=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["user"]' 2>&1)
-
- if [ "$USER" = "null" ] || [[ "$USER" = "parse error"* ]] || [ "$USER" = "" ]
- then
- COUCHDB_WRITTEN=false
- else
- COUCHDB_WRITTEN=true
- fi
- fi;
-
- if [ "$CONFIG_FILE_WRITTEN" = "true" ] && [ "$COUCHDB_WRITTEN" = "true" ]
- then
- echo "MSP config file and couchdb credentials are successfully stored in vault"
- break
- else
- echo "MSP config file or couchdb credentials are not ready, sleeping for {{ $.Values.healthcheck.sleepTimeAfterError }}"
- sleep {{ $.Values.healthcheck.sleepTimeAfterError }}
- COUNTER=`expr "$COUNTER" + 1`
fi
- done
-
- if [ "$COUNTER" -gt {{ $.Values.healthcheck.retries }} ]
- then
- echo "Retry attempted `expr $COUNTER - 1` times, cryto materials have not been saved."
- touch ${MOUNT_PATH}/certs_not_found.txt
- exit 1
- fi;
-
- list=$(echo "$ORDERERS_NAMES" | tr "-" "\n")
- for ORDERER in $list
- do
- COUNTER=1
- if [ -e /certcheck/present_orderer_tls_cert.txt ]; then ORDERER_TLS_WRITTEN=true; else ORDERER_TLS_WRITTEN=false; fi
- while [ "$COUNTER" -le {{ $.Values.healthcheck.retries }} ]
- do
- if [ -e /certcheck/absent_orderer_tls_cert.txt ] && [ "$ORDERER_TLS_WRITTEN" = "false" ]; then
- cat /tlscerts/${ORDERER}.crt | base64 -d > ${ORDERER}.formatted
- # formatting is needed because bas64 encoding removed the newlines, so they need to be added again
- while read line || [ -n "$line" ];
- do
- echo "$line\n";
- done < ${ORDERER}.formatted > ${ORDERER}.final
- ORDERER_TLS=$(cat ${ORDERER}.final)
- echo "
- {
- \"data\":
- {
- \"ca.crt\": \"${ORDERER_TLS}\"
- }
- }" > payload.json
-
- # This command writes organization level certificates for orderers to vault
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_PEER_ORDERER_TLS}
-
- # Check orderer certs
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_PEER_ORDERER_TLS} | jq -r 'if .errors then . else . end')
- CA_CRT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["ca.crt"]' 2>&1)
-
- if [ "$CA_CRT" = "null" ] || [[ "$CA_CRT" = "parse error"* ]] || [ "$CA_CRT" = "" ]
- then
- ORDERER_TLS_WRITTEN=false
- else
- ORDERER_TLS_WRITTEN=true
- fi
- rm payload.json
+{{- end }} # End Vault if condition
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # Check if secret exists
+ kubectl get secret --namespace ${COMPONENT_NAME} ${TLS_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${TLS_KEY}
fi
+ kubectl create secret generic ${TLS_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=cacrt=${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/ca.crt \
+ --from-file=servercrt=${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/server.crt \
+ --from-file=serverkey=${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/tls/server.key
+ fi
- if [ "$ORDERER_TLS_WRITTEN" = "true" ]
- then
- echo "${ORDERER} tls certificate are successfully stored in vault"
- break
- else
- echo "${ORDERER} tls certificate are not ready, sleeping for {{ $.Values.healthcheck.sleepTimeAfterError }}"
- sleep {{ $.Values.healthcheck.sleepTimeAfterError }}
- COUNTER=`expr "$COUNTER" + 1`
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ SK_NAME=$(find ${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
+ kubectl get secret --namespace ${COMPONENT_NAME} ${MSP_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${MSP_KEY}
fi
- done
+ kubectl create secret generic ${MSP_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=admincerts=${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem \
+ --from-file=cacerts=${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }} \
+ --from-file=keystore=${SK_NAME} \
+ --from-file=signcerts=${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/signcerts/cert.pem \
+ --from-file=tlscacerts=${ORG_CYPTO_PEER_FOLDER}/${PEER_NAME}.${COMPONENT_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}
+ fi
+ echo "${PEER_NAME} Client certificates are successfully stored."
+ }
- if [ "$COUNTER" -gt {{ $.Values.healthcheck.retries }} ]
- then
- echo "Retry attempted `expr $COUNTER - 1` times, orderer tls have not been saved."
- touch ${MOUNT_PATH}/certs_not_found.txt
- exit 1
- fi;
- done
+ ORG_CYPTO_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/users/Admin@${COMPONENT_NAME}"
+ ORG_CYPTO_PEER_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/peers"
+ saveAdminSecrets
+ savePeerSecrets $1
---
apiVersion: v1
kind: ConfigMap
metadata:
name: users-script-store-vault
- namespace: {{ .Values.metadata.namespace }}
+ namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: users-script-vault
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
store-vault-users.sh: |-
#!/bin/bash
@@ -1468,259 +955,114 @@ data:
echo "$line\n"
done < ${1} > ${2}/${NAME}.txt
}
-
- validateVaultResponse () {
- if echo ${2} | grep "errors" || [ "${2}" = "" ]; then
- echo "ERROR: unable to retrieve ${1}: ${2}"
- exit 1
- fi
- if [ "$3" == "LOOKUPSECRETRESPONSE" ]
- then
- http_code=$(curl -fsS -o /dev/null -w "%{http_code}" \
- --header "X-Vault-Token: ${VAULT_TOKEN}" \
- ${VAULT_ADDR}/v1/${1})
- curl_response=$?
- if test "$http_code" != "200" ; then
- echo "Http response code from Vault - $http_code and curl_response - $curl_response"
- if test "$curl_response" != "0"; then
- echo "Error: curl command failed with error code - $curl_response"
- exit 1
- fi
- fi
- fi
- }
-
- echo "Puting secrets/certificates from Vault server"
- KUBE_SA_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
- VAULT_TOKEN=$(curl -sS --request POST ${VAULT_ADDR}/v1/auth/${KUBERNETES_AUTH_PATH}/login -H "Content-Type: application/json" -d '{"role":"'"${VAULT_APP_ROLE}"'","jwt":"'"${KUBE_SA_TOKEN}"'"}' | jq -r 'if .errors then . else .auth.client_token end')
- validateVaultResponse 'vault login token' "${VAULT_TOKEN}"
-
- FORMAT_CERTIFICATE_PATH="/formatcertificate"
- ORG_CYPTO_USERS_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/users"
+ function saveUserSecrets {
+ USER=$1
+ TLS_KEY=$1-tls
+ MSP_KEY=$1-msp
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . ../bevel-vault.sh
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
- list=$(echo "$USERS_IDENTITIES" | tr "-" "\n")
- for USER in $list
- do
- if [ -e /certcheck/present_tls_${USER}.txt ]; then USER_TLS_CERT_WRITTEN=true; else USER_TLS_CERT_WRITTEN=false; fi
- if [ -e /certcheck/present_msp_${USER}.txt ]; then USER_MSP_CERT_WRITTEN=true; else USER_MSP_CERT_WRITTEN=false; fi
-
+ FORMAT_CERTIFICATE_PATH="/formatcertificate"
+ ORG_CYPTO_USERS_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/users"
+
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${USER}/tls
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${USER}/msp
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cacerts
mkdir -p ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/tlscacerts
- COUNTER=1
- while [ "$COUNTER" -le {{ $.Values.healthcheck.retries }} ]
- do
- if ([ -e /certcheck/absent_tls_${USER}.txt ] && [ "$USER_TLS_CERT_WRITTEN" = "false" ]) || [ "$REFRESH_CERTS" == 'true' ]; then
-
- # This commands put the certificates with correct format for the curl command
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/${USER}/tls"
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/client.crt" "${FORMAT_CERTIFICATE_PATH}/${USER}/tls"
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/client.key" "${FORMAT_CERTIFICATE_PATH}/${USER}/tls"
-
- CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/tls/ca.crt.txt)
- CLIENT_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/tls/client.crt.txt)
- CLIENT_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/tls/client.key.txt)
-
- echo "
- {
- \"data\":
- {
- \"ca.crt\": \"${CA_CRT}\",
- \"client.crt\": \"${CLIENT_CRT}\",
- \"client.key\": \"${CLIENT_KEY}\"
- }
- }" > payload.json
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/ca.crt" "${FORMAT_CERTIFICATE_PATH}/${USER}/tls"
+ formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/client.crt" "${FORMAT_CERTIFICATE_PATH}/${USER}/tls"
+ formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/client.key" "${FORMAT_CERTIFICATE_PATH}/${USER}/tls"
- # This command copy the crypto material for users (tls)
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/${USER}/tls
-
- # Check tls certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/${USER}/tls | jq -r 'if .errors then . else . end')
- TLS_CA_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["ca.crt"]' 2>&1)
- TLS_CLIENT_CERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["client.crt"]' 2>&1)
- TLS_CLIENT_KEY=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["client.key"]' 2>&1)
-
- tls_certificate_fields=("$TLS_CA_CERT" "$TLS_CLIENT_CERT" "$TLS_CLIENT_KEY")
-
- for field in "${tls_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- USER_TLS_CERT_WRITTEN=false
- break
- else
- USER_TLS_CERT_WRITTEN=true
- fi
- done
- rm payload.json
- fi;
+ CA_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/tls/ca.crt.txt)
+ CLIENT_CRT=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/tls/client.crt.txt)
+ CLIENT_KEY=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/tls/client.key.txt)
- if ([ -e /certcheck/absent_msp_${USER}.txt ] && [ "$USER_MSP_CERT_WRITTEN" = "false" ]) || [ "$REFRESH_CERTS" == 'true' ]; then
+ echo "
+ {
+ \"data\":
+ {
+ \"ca_crt\": \"${CA_CRT}\",
+ \"client_crt\": \"${CLIENT_CRT}\",
+ \"client_key\": \"${CLIENT_KEY}\"
+ }
+ }" > payload.json
+
+ # This command copy the crypto material for users (tls)
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${TLS_KEY}" 'payload.json'
+ rm payload.json
+ fi
- # This commands put the certificates with correct format for the curl command
- SK_NAME=$(find ${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # This commands put the certificates with correct format for the curl command
+ SK_NAME=$(find ${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
+ formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/admincerts/${USER}@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp"
+ formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp"
+ formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp"
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/admincerts/${USER}@${COMPONENT_NAME}-cert.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp"
- formatCertificate "${SK_NAME}" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp"
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/signcerts/cert.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp"
+ ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/${USER}@${COMPONENT_NAME}-cert.pem.txt)
+ KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/*_sk.txt)
+ SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cert.pem.txt)
- ADMINCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/${USER}@${COMPONENT_NAME}-cert.pem.txt)
- KEYSTORE=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/*_sk.txt)
- SIGNCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cert.pem.txt)
-
- if [ "$PROXY" != "none" ] ; then
+ formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cacerts"
+ formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp/tlscacerts"
+ CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cacerts/{{ include "fabric-catools.caFileName" . }}.txt)
+ # En el rol lo copia directamente del tls
+ TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}.txt)
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cacerts"
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp/tlscacerts"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
- # En el rol lo copia directamente del tls
- TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/tlscacerts/ca-${COMPONENT_NAME}-${EXTERNAL_URL_SUFFIX}.pem.txt)
+ echo "
+ {
+ \"data\":
+ {
+ \"admincerts\": \"${ADMINCERTS}\",
+ \"cacerts\": \"${CACERTS}\",
+ \"keystore\": \"${KEYSTORE}\",
+ \"signcerts\": \"${SIGNCERTS}\",
+ \"tlscacerts\": \"${TLSCERTS}\"
+ }
+ }" > payload.json
+
+ #This command copy the msp certificates to the Vault
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${MSP_KEY}" 'payload.json'
+ rm payload.json
+ fi
+{{- end }}
+ # Check if secret exists
+ if [ ! -e /crypto-config/${TLS_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ kubectl get secret --namespace ${COMPONENT_NAME} ${TLS_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${TLS_KEY}
+ fi
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${TLSCERTS}\"
- }
- }" > payload.json
-
- fi;
-
- if [ "$PROXY" = "none" ] ; then
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cacerts"
- formatCertificate "${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/tlscacerts/ca-${COMPONENT_NAME}-7054.pem" "${FORMAT_CERTIFICATE_PATH}/${USER}/msp/tlscacerts"
- CACERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/cacerts/ca-${COMPONENT_NAME}-7054.pem.txt)
- TLSCERTS=$(cat ${FORMAT_CERTIFICATE_PATH}/${USER}/msp/tlscacerts/ca-${COMPONENT_NAME}-7054.pem.txt)
+ kubectl create secret generic ${TLS_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=cacrt=${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/ca.crt \
+ --from-file=clientcrt=${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/client.crt \
+ --from-file=clientkey=${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/tls/client.key
+ fi
- echo "
- {
- \"data\":
- {
- \"admincerts\": \"${ADMINCERTS}\",
- \"cacerts\": \"${CACERTS}\",
- \"keystore\": \"${KEYSTORE}\",
- \"signcerts\": \"${SIGNCERTS}\",
- \"tlscacerts\": \"${TLSCERTS}\"
- }
- }" > payload.json
-
- fi;
-
- # This command copy the msp certificates to the Vault
- curl \
- -H "X-Vault-Token: ${VAULT_TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d @payload.json \
- ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/${USER}/msp
-
- # Check msp certificates
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" ${VAULT_ADDR}/v1/${VAULT_SECRET_USERS}/${USER}/msp | jq -r 'if .errors then . else . end')
- MSP_ADMINCERT=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["admincerts"]' 2>&1)
- MSP_CACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["cacerts"]' 2>&1)
- MSP_KEYSTORE=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["keystore"]' 2>&1)
- MSP_SIGNCERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["signcerts"]' 2>&1)
- MSP_TLSCACERTS=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["tlscacerts"]' 2>&1)
-
- msp_certificate_fields=("$MSP_ADMINCERT" "$MSP_CACERTS" "$MSP_KEYSTORE" "$MSP_SIGNCERTS" "$MSP_TLSCACERTS")
-
- for field in "${msp_certificate_fields[@]}"
- do
- if [ "$field" = "null" ] || [[ "$field" = "parse error"* ]] || [ "$field" = "" ]
- then
- USER_MSP_CERT_WRITTEN=false
- break
- else
- USER_MSP_CERT_WRITTEN=true
- fi
- done
- rm payload.json
- fi;
-
- if [ "$USER_TLS_CERT_WRITTEN" = "true" ] && [ "$USER_MSP_CERT_WRITTEN" = "true" ]
- then
- echo "${USER} certificates are successfully stored in vault"
- break
- else
- echo "${USER} certificates are not ready, sleeping for {{ $.Values.healthcheck.sleepTimeAfterError }}"
- sleep {{ $.Values.healthcheck.sleepTimeAfterError }}
- COUNTER=`expr "$COUNTER" + 1`
+ if [ ! -e /crypto-config/${MSP_KEY}-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ SK_NAME=$(find ${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
+ kubectl get secret --namespace ${COMPONENT_NAME} ${MSP_KEY} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Delete the secret if exists
+ kubectl delete secret --namespace ${COMPONENT_NAME} ${MSP_KEY}
fi
- done;
+ kubectl create secret generic ${MSP_KEY} --namespace ${COMPONENT_NAME} \
+ --from-file=admincerts=${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/admincerts/${USER}@${COMPONENT_NAME}-cert.pem \
+ --from-file=cacerts=${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/cacerts/{{ include "fabric-catools.caFileName" . }} \
+ --from-file=keystore=${SK_NAME} \
+ --from-file=signcerts=${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/signcerts/cert.pem \
+ --from-file=tlscacerts=${ORG_CYPTO_USERS_FOLDER}/${USER}@${COMPONENT_NAME}/msp/tlscacerts/{{ include "fabric-catools.caFileName" . }}
+ fi
+ echo "${USER} certificates are successfully stored."
+ }
- if [ "$COUNTER" -gt {{ $.Values.healthcheck.retries }} ]
- then
- echo "Retry attempted `expr $COUNTER - 1` times, users certificates have not been saved."
- touch ${MOUNT_PATH}/certs_not_found.txt
- exit 1
- fi;
- done;
+ ORG_CYPTO_USERS_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/users"
+ saveUserSecrets $1
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: msp-config-file
- namespace: {{ .Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: msp-config-file
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
-data:
- no-none-config.yaml: |-
- NodeOUs:
- Enable: true
- ClientOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-{{ .Values.org_data.external_url_suffix }}.pem
- OrganizationalUnitIdentifier: client
- PeerOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-{{ .Values.org_data.external_url_suffix }}.pem
- OrganizationalUnitIdentifier: peer
- AdminOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-{{ .Values.org_data.external_url_suffix }}.pem
- OrganizationalUnitIdentifier: admin
- OrdererOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-{{ .Values.org_data.external_url_suffix }}.pem
- OrganizationalUnitIdentifier: orderer
- none-config.yaml: |-
- NodeOUs:
- Enable: true
- ClientOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-7054.pem
- OrganizationalUnitIdentifier: client
- PeerOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-7054.pem
- OrganizationalUnitIdentifier: peer
- AdminOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-7054.pem
- OrganizationalUnitIdentifier: admin
- OrdererOUIdentifier:
- Certificate: cacerts/ca-{{ .Values.metadata.namespace }}-7054.pem
- OrganizationalUnitIdentifier: orderer
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: tls-cert
- namespace: {{ .Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: tls-cert
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
-data:
- {{- range $orderers := $.Values.orderers_info }}
- {{ $orderers.name }}.crt: {{ $orderers.path | quote }}
- {{- end }}
+{{- end }} # End createConfigMaps condition
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/templates/deployment.yaml b/platforms/hyperledger-fabric/charts/fabric-catools/templates/deployment.yaml
deleted file mode 100644
index 0ba1a2f0c7c..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-catools/templates/deployment.yaml
+++ /dev/null
@@ -1,605 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: {{ .Values.metadata.name }}
- namespace: {{ .Values.metadata.namespace }}
- labels:
- app: {{ .Release.Name }}
- app.kubernetes.io/name: {{ .Values.metadata.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.deployment }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
-spec:
- replicas: {{ .Values.replicaCount }}
- selector:
- matchLabels:
- name: {{ .Values.metadata.name }}
- template:
- metadata:
- labels:
- name: {{ .Values.metadata.name }}
- spec:
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
- imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
- {{- end }}
- volumes:
- - name: ca-tools-pv
- persistentVolumeClaim:
- claimName: ca-tools-pvc
- - name: ca-tools-crypto-pv
- persistentVolumeClaim:
- claimName: ca-tools-crypto-pvc
- - name: certcheck
- emptyDir:
- medium: Memory
- - name: generate-crypto
- configMap:
- name: crypto-scripts-cm
- defaultMode: 0775
- items:
- - key: generate-crypto-orderer.sh
- path: generate-crypto-orderer.sh
- - name: generate-orderer-crypto
- configMap:
- name: crypto-scripts-cm
- defaultMode: 0775
- items:
- - key: orderer-script.sh
- path: orderer-script.sh
- - name: generate-crypto-peer
- configMap:
- name: crypto-scripts-cm
- defaultMode: 0775
- items:
- - key: generate-crypto-peer.sh
- path: generate-crypto-peer.sh
- - name: generate-crypto-add-peer
- configMap:
- name: crypto-scripts-cm
- defaultMode: 0775
- items:
- - key: generate-crypto-add-peer.sh
- path: generate-crypto-add-peer.sh
- - name: generate-user-crypto
- configMap:
- name: crypto-scripts-cm
- defaultMode: 0775
- items:
- - key: generate-user-crypto.sh
- path: generate-user-crypto.sh
- - name: store-vault-orderer
- configMap:
- name: orderer-script-store-vault
- defaultMode: 0775
- items:
- - key: store-vault-orderer.sh
- path: store-vault-orderer.sh
- - name: store-vault-peer
- configMap:
- name: peer-script-store-vault
- defaultMode: 0775
- items:
- - key: store-vault-peer.sh
- path: store-vault-peer.sh
- - name: store-vault-users
- configMap:
- name: users-script-store-vault
- defaultMode: 0775
- items:
- - key: store-vault-users.sh
- path: store-vault-users.sh
- - name: none-config
- configMap:
- name: msp-config-file
- defaultMode: 0775
- items:
- - key: none-config.yaml
- path: none-config.yaml
- - name: no-none-config
- configMap:
- name: msp-config-file
- defaultMode: 0775
- items:
- - key: no-none-config.yaml
- path: no-none-config.yaml
- {{- if eq $.Values.metadata.component_type "peer" }}
- {{- range $orderers := $.Values.orderers_info }}
- - name: {{ $orderers.name }}-tls-cert
- configMap:
- name: tls-cert
- defaultMode: 0775
- items:
- - key: {{ $orderers.name }}.crt
- path: {{ $orderers.name }}.crt
- {{- end }}
- {{- end }}
- - name: scripts-volume
- configMap:
- name: bevel-vault-script
- - name: package-manager
- configMap:
- name: package-manager
- initContainers:
- - name: init-check-certificates
- image: {{ $.Values.image.alpineutils }}
- imagePullPolicy: IfNotPresent
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_SECRET_USERS
- value: {{ $.Values.vault.secretusers }}
- - name: VAULT_SECRET_ORDERER
- value: {{ $.Values.vault.secretorderer }}
- - name: VAULT_SECRET_PEER
- value: {{ $.Values.vault.secretpeer }}
- - name: VAULT_SECRET_CONFIG_FILE
- value: {{ $.Values.vault.secretconfigfile }}
- - name: VAULT_SECRET_PEER_ORDERER_TLS
- value: {{ $.Values.vault.secretpeerorderertls }}
- - name: COMPONENT_TYPE
- value: {{ $.Values.metadata.component_type }}
- - name: COMPONENT_NAME
- value: {{ $.Values.metadata.namespace }}
- - name: ORG_NAME_EXT
- value: {{ $.Values.metadata.org_name }}
- - name: PROXY
- value: {{ .Values.metadata.proxy }}
- - name: ORDERERS_NAMES
- value: "{{ $.Values.orderers.name }}"
- - name: PEERS_NAMES
- value: "{{ $.Values.peers.name }}"
- - name: USERS_IDENTITIES
- value: {{ $.Values.users.users_identities }}
- - name: MOUNT_PATH
- value: "/certcheck"
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- . /scripts/bevel-vault.sh
-
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
-
- mkdir -p ${MOUNT_PATH}
- OUTPUT_PATH="/crypto-config/${COMPONENT_TYPE}Organizations/${COMPONENT_NAME}"
- mkdir -p ${OUTPUT_PATH}/ca
- mkdir -p /root/ca-tools/${ORG_NAME_EXT}
-
- SECRET_CERT={{ $.Values.vault.secretcert }}
- vault_secret_key=$(echo ${SECRET_CERT} |awk -F "?" '{print $1}')
- vault_data_key=$(echo ${SECRET_CERT} |awk -F "?" '{print $2}')
-
- # Get ca cert
- vaultBevelFunc "readJson" "${vault_secret_key}"
- VALUE_OF_SECRET=$(echo ${VAULT_SECRET} | jq -r ".[\"${vault_data_key}\"]")
- echo "${VALUE_OF_SECRET}" > ${OUTPUT_PATH}/ca/ca.${COMPONENT_NAME}-cert.pem
-
- SECRET_KEY={{ $.Values.vault.secretkey }}
- vault_secret_key=$(echo ${SECRET_KEY} |awk -F "?" '{print $1}')
- vault_data_key=$(echo ${SECRET_KEY} |awk -F "?" '{print $2}')
-
- # Get ca key
- vaultBevelFunc "readJson" "${vault_secret_key}"
- VALUE_OF_SECRET=$(echo ${VAULT_SECRET} | jq -r ".[\"${vault_data_key}\"]")
- echo "${VALUE_OF_SECRET}" > ${OUTPUT_PATH}/ca/${COMPONENT_NAME}-CA.key
-
- # Check if admin msp already created
- vaultBevelFunc "readJson" "${VAULT_SECRET_USERS}/admin/msp"
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault"
- touch ${MOUNT_PATH}/present_msp.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_msp.txt
- fi
-
- # Check if admin tls already created
- vaultBevelFunc "readJson" "${VAULT_SECRET_USERS}/admin/tls"
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault"
- touch ${MOUNT_PATH}/present_tls.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_tls.txt
- fi
-
- if [ "$COMPONENT_TYPE" = "orderer" ]; then
- SERVICES_NAMES=$ORDERERS_NAMES;
- fi;
-
- if [ "$COMPONENT_TYPE" = "peer" ]; then
- SERVICES_NAMES=$PEERS_NAMES;
- fi;
-
- list=$(echo "$SERVICES_NAMES" | tr "-" "\n")
- for SERVICE in $list
- do
- # Check if orderer/peer msp already created
- if [ "$COMPONENT_TYPE" = "peer" ]; then
- SERVICE_NAME="${SERVICE%%,*}"
- vaultBevelFunc "readJson" "${VAULT_SECRET_PEER}/${SERVICE_NAME}.${COMPONENT_NAME}/msp"
- fi;
-
- if [ "$COMPONENT_TYPE" = "orderer" ]; then
- SERVICE_NAME="${SERVICE}"
- vaultBevelFunc "readJson" "${VAULT_SECRET_ORDERER}/${SERVICE_NAME}.${COMPONENT_NAME}/msp"
- fi;
-
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault"
- touch ${MOUNT_PATH}/present_msp_${SERVICE_NAME}.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_msp_${SERVICE_NAME}.txt
- fi
-
- # Check if orderer/peer msp already created
- if [ "$COMPONENT_TYPE" = "peer" ]; then
- SERVICE_NAME="${SERVICE%%,*}"
- vaultBevelFunc "readJson" "${VAULT_SECRET_PEER}/${SERVICE_NAME}.${COMPONENT_NAME}/tls"
- fi;
-
- if [ "$COMPONENT_TYPE" = "orderer" ]; then
- SERVICE_NAME="${SERVICE}"
- vaultBevelFunc "readJson" "${VAULT_SECRET_ORDERER}/${SERVICE_NAME}.${COMPONENT_NAME}/tls"
- fi;
-
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault"
- touch ${MOUNT_PATH}/present_tls_${SERVICE_NAME}.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_tls_${SERVICE_NAME}.txt
- fi
- done
-
- if [ $COMPONENT_TYPE == 'peer' ];
- then
- # Check if msp config file already created
- vaultBevelFunc "readJson" "${VAULT_SECRET_CONFIG_FILE}"
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault."
- touch ${MOUNT_PATH}/present_config_file.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_config_file.txt
- fi
-
- # Check if msp config file already created
- vaultBevelFunc "readJson" "${VAULT_SECRET_PEER_ORDERER_TLS}"
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault."
- touch ${MOUNT_PATH}/present_orderer_tls_cert.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_orderer_tls_cert.txt
- fi
- fi;
-
- if [ "$USERS_IDENTITIES" ]
- then
- identities_list=$(echo "$USERS_IDENTITIES" | tr "-" "\n")
- for user_identity in $identities_list
- do
- # Check if users msp already created
- vaultBevelFunc "readJson" "${VAULT_SECRET_USERS}/${user_identity}/msp"
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault."
- touch ${MOUNT_PATH}/present_msp_${user_identity}.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_msp_${user_identity}.txt
- fi
-
- # Check if users tls already created
- vaultBevelFunc "readJson" "${VAULT_SECRET_USERS}/${user_identity}/tls"
- if [ "$SECRETS_AVAILABLE" == "yes" ]
- then
- echo "Certificates present in vault"
- touch ${MOUNT_PATH}/present_tls_${user_identity}.txt
- else
- echo "Certficates absent in vault. Ignore error warning."
- touch ${MOUNT_PATH}/absent_tls_${user_identity}.txt
- fi
- done
- fi
- volumeMounts:
- - name: ca-tools-pv
- mountPath: /root/ca-tools
- - name: ca-tools-crypto-pv
- mountPath: /crypto-config
- - name: certcheck
- mountPath: /certcheck
- - name: scripts-volume
- mountPath: /scripts/bevel-vault.sh
- subPath: bevel-vault.sh
- containers:
- - name: {{ .Values.metadata.name }}
- image: "{{ .Values.image.catools }}"
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- env:
- - name: COMPONENT_TYPE
- value: {{ $.Values.metadata.component_type }}
- - name: COMPONENT_NAME
- value: {{ $.Values.metadata.namespace }}
- - name: ORG_NAME_EXT
- value: {{ $.Values.metadata.org_name }}
- - name: REFRESH_CERTS
- value: "{{ $.Values.checks.refresh_cert_value }}"
- - name: REFRESH_USER_CERTS
- value: "{{ $.Values.checks.refresh_user_cert_value }}"
- - name: ADD_PEER
- value: "{{ $.Values.checks.add_peer_value }}"
- - name: ORDERERS_NAMES
- value: "{{ $.Values.orderers.name }}"
- - name: PEERS_NAMES
- value: "{{ $.Values.peers.name }}"
- - name: USERS
- value: {{ $.Values.users.users_list }}
- - name: USERS_IDENTITIES
- value: {{ $.Values.users.users_identities }}
- - name: SUBJECT
- value: {{ .Values.org_data.component_subject }}
- - name: CERT_SUBJECT
- value: {{ .Values.org_data.cert_subject }}
- - name: CA_URL
- value: {{ .Values.org_data.ca_url }}
- - name: EXTERNAL_URL_SUFFIX
- value: {{ .Values.org_data.external_url_suffix }}
- - name: PROXY
- value: {{ .Values.metadata.proxy }}
- - name: MOUNT_PATH
- value: "/certcheck"
- command: ["sh", "-c"]
- args:
- - |-
-
- if [ "$COMPONENT_TYPE" = "orderer" ]; then
- if [ -e ${MOUNT_PATH}/absent_msp.txt ]; then
- ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${COMPONENT_NAME}/users/Admin@${COMPONENT_NAME}"
- ORG_CYPTO_ORDERER_FOLDER="/crypto-config/ordererOrganizations/${COMPONENT_NAME}/orderers"
-
- SK_NAME=$(find ${ORG_CYPTO_FOLDER}/msp/keystore/ -name "*_sk")
- if [ -n "$SK_NAME" ]; then
- rm ${ORG_CYPTO_FOLDER}/msp/keystore/*_sk
- rm /root/ca-tools/${ORG_NAME_EXT}/admin/msp/keystore/*_sk
- rm /root/ca-tools/${ORG_NAME_EXT}/admin/tls/keystore/*_sk
- fi;
-
- # Generate crypto material for organization orderers (admin)
- cd /root/ca-tools/${ORG_NAME_EXT}
- ./generate-crypto-orderer.sh
- fi;
-
- # Generate crypto material for organization orderers (for each orderer)
- orderers=$(echo "$ORDERERS_NAMES" | tr "-" "\n")
- for ORDERER_NAME in $orderers
- do
- if [ -e ${MOUNT_PATH}/absent_msp_${ORDERER_NAME}.txt ]; then
- echo "need to execute scripts for ${ORDERER_NAME} "
-
- SK_NAME=$(find ${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/keystore/ -name "*_sk")
- if [ -n "$SK_NAME" ]; then
- rm ${ORG_CYPTO_ORDERER_FOLDER}/${ORDERER_NAME}.${COMPONENT_NAME}/msp/keystore/*_sk
- rm /root/ca-tools/${ORG_NAME_EXT}/cas/orderers/msp/keystore/*_sk
- rm /root/ca-tools/${ORG_NAME_EXT}/cas/orderers/tls/keystore/*_sk
- fi;
- cd /root/ca-tools/${ORG_NAME_EXT}
- ./orderer-script.sh ${ORDERER_NAME}
- fi;
- done
- fi;
-
- if [ "$COMPONENT_TYPE" = "peer" ]; then
-
- list=$(echo "$PEERS_NAMES" | tr "-" "\n")
- for PEER in $list
- do
- PEER_NAME="${PEER%%,*}"
-
- if [ -e ${MOUNT_PATH}/absent_msp.txt ] || [ -e ${MOUNT_PATH}/absent_msp_${PEER_NAME}.txt ] || [ "$REFRESH_CERTS" = "true" ]; then
-
- ORG_CYPTO_FOLDER="/crypto-config/peerOrganizations/${COMPONENT_NAME}/users/Admin@${COMPONENT_NAME}"
-
- SK_NAME=$(find ${ORG_CYPTO_FOLDER}/msp/keystore/ -name "*_sk")
- if [ -n "$SK_NAME" ]; then
- rm ${ORG_CYPTO_FOLDER}/msp/keystore/*_sk
- rm /root/ca-tools/${ORG_NAME_EXT}/admin/msp/keystore/*_sk
- rm /root/ca-tools/${ORG_NAME_EXT}/admin/tls/keystore/*_sk
- fi;
-
- # Generate crypto material for organization peers
- cd /root/ca-tools/${ORG_NAME_EXT}
- if [ "$ADD_PEER" = "false" ]; then
- ./generate-crypto-peer.sh
- break
- else
- ./generate-crypto-add-peer.sh
- break
- fi;
- fi;
- done
-
- # Generate crypto material for users
- list=$(echo "$USERS_IDENTITIES" | tr "-" "\n")
- for USER in $list
- do
- if ([ "$USERS" ] && [ -e ${MOUNT_PATH}/absent_msp_${USER}.txt ]) || [ "$REFRESH_CERTS" = "true" || [ "$REFRESH_USER_CERTS" = "true" ]
- then
- cd /root/ca-tools/${ORG_NAME_EXT}
- ./generate-user-crypto.sh peer ${USERS}
- break
- fi;
- done
- fi;
-
- # this command creates the indicator of the completion of scripts
- touch ${MOUNT_PATH}/flag_finish.txt
- tail -f /dev/null
- volumeMounts:
- - name: ca-tools-pv
- mountPath: /root/ca-tools
- - name: ca-tools-crypto-pv
- mountPath: /crypto-config
- - name: certcheck
- mountPath: /certcheck
- - name: generate-crypto
- mountPath: /root/ca-tools/{{ $.Values.metadata.org_name }}/generate-crypto-orderer.sh
- subPath: generate-crypto-orderer.sh
- - name: generate-orderer-crypto
- mountPath: /root/ca-tools/{{ $.Values.metadata.org_name }}/orderer-script.sh
- subPath: orderer-script.sh
- - name: generate-crypto-peer
- mountPath: /root/ca-tools/{{ $.Values.metadata.org_name }}/generate-crypto-peer.sh
- subPath: generate-crypto-peer.sh
- - name: generate-crypto-add-peer
- mountPath: /root/ca-tools/{{ $.Values.metadata.org_name }}/generate-crypto-add-peer.sh
- subPath: generate-crypto-add-peer.sh
- - name: generate-user-crypto
- mountPath: /root/ca-tools/{{ $.Values.metadata.org_name }}/generate-user-crypto.sh
- subPath: generate-user-crypto.sh
- - name: store-vault
- image: {{ $.Values.image.alpineutils }}
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_SECRET_USERS
- value: {{ $.Values.vault.secretusers }}
- - name: VAULT_SECRET_ORDERER
- value: {{ $.Values.vault.secretorderer }}
- - name: VAULT_SECRET_PEER
- value: {{ $.Values.vault.secretpeer }}
- - name: VAULT_SECRET_PEER_ORDERER_TLS
- value: {{ $.Values.vault.secretpeerorderertls }}
- - name: VAULT_SECRET_CONFIG_FILE
- value: {{ $.Values.vault.secretconfigfile }}
- - name: VAULT_SECRET_COUCHDB
- value: {{ $.Values.vault.secretcouchdb }}
- - name: COMPONENT_TYPE
- value: {{ $.Values.metadata.component_type }}
- - name: COMPONENT_NAME
- value: {{ $.Values.metadata.namespace }}
- - name: REFRESH_CERTS
- value: "{{ $.Values.checks.refresh_cert_value }}"
- - name: PROXY
- value: {{ .Values.metadata.proxy }}
- - name: EXTERNAL_URL_SUFFIX
- value: {{ .Values.org_data.external_url_suffix }}
- - name: ORDERERS_NAMES
- value: "{{ $.Values.orderers.name }}"
- - name: PEERS_NAMES
- value: "{{ $.Values.peers.name }}"
- - name: USERS_IDENTITIES
- value: {{ $.Values.users.users_identities }}
- - name: MOUNT_PATH
- value: "/certcheck"
- command: ["sh", "-c"]
- args:
- - |-
- . /scripts/package-manager.sh
- # Define the packages to install
- packages_to_install="jq curl bash"
- install_packages "$packages_to_install"
-
- while ! [ -f ${MOUNT_PATH}/flag_finish.txt ]
- do
- echo 'Waiting for completion of scripts'
- sleep 2s
- done
-
- if [ -e /${MOUNT_PATH}/flag_finish.txt ]; then
- if [ "$COMPONENT_TYPE" = "orderer" ]; then
- # Generate crypto material for organization orderers
- cd /scripts/orderer
- ./store-vault-orderer.sh
- fi;
-
- if [ "$COMPONENT_TYPE" = "peer" ]; then
- # Generate crypto material for organization peers
- cd /scripts/peer
- ./store-vault-peer.sh
- if [ "$USERS_IDENTITIES" ]
- then
- cd /scripts/peer
- ./store-vault-users.sh
- fi;
- fi;
- fi;
-
- # Raises an error if any certificate has not been stored correctly
- if [ -e /certcheck/certs_not_found.txt ]; then
- exit 1
- fi
- tail -f /dev/null
- volumeMounts:
- - name: ca-tools-pv
- mountPath: /root/ca-tools
- - name: ca-tools-crypto-pv
- mountPath: /crypto-config
- - name: certcheck
- mountPath: /certcheck
- - name: store-vault-orderer
- mountPath: /scripts/orderer/store-vault-orderer.sh
- subPath: store-vault-orderer.sh
- - name: store-vault-peer
- mountPath: /scripts/peer/store-vault-peer.sh
- subPath: store-vault-peer.sh
- - name: store-vault-users
- mountPath: /scripts/peer/store-vault-users.sh
- subPath: store-vault-users.sh
- {{ if and (eq $.Values.metadata.component_type "peer") (ne $.Values.metadata.proxy "none") }}
- - name: no-none-config
- mountPath: /crypto-config/peerOrganizations/{{ $.Values.metadata.namespace }}/msp/config.yaml
- subPath: no-none-config.yaml
- {{ end }}
- {{ if and (eq $.Values.metadata.component_type "peer") (eq $.Values.metadata.proxy "none") }}
- - name: none-config
- mountPath: /crypto-config/peerOrganizations/{{ $.Values.metadata.namespace }}/msp/config.yaml
- subPath: none-config.yaml
- {{ end }}
- {{- if eq $.Values.metadata.component_type "peer" }}
- {{- range $orderers := $.Values.orderers_info }}
- - name: {{ $orderers.name }}-tls-cert
- mountPath: /tlscerts/{{ $orderers.name }}.crt
- subPath: {{ $orderers.name }}.crt
- {{- end }}
- {{- end }}
- - name: package-manager
- mountPath: /scripts/package-manager.sh
- subPath: package-manager.sh
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/templates/job-cleanup.yaml b/platforms/hyperledger-fabric/charts/fabric-catools/templates/job-cleanup.yaml
new file mode 100644
index 00000000000..4689847725b
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/templates/job-cleanup.yaml
@@ -0,0 +1,75 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ .Release.Name }}-certs-cleanup
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/name: {{ include "fabric-catools.name" . }}-cleanup
+ app.kubernetes.io/component: ca-tools
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ annotations:
+ helm.sh/hook-weight: "0"
+ helm.sh/hook: "pre-delete"
+ helm.sh/hook-delete-policy: "hook-succeeded"
+spec:
+ backoffLimit: 3
+ completions: 1
+ template:
+ metadata:
+ labels:
+ app.kubernetes.io/name: {{ include "fabric-catools.name" . }}-cleanup
+ app.kubernetes.io/component: ca-tools
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ restartPolicy: "Never"
+ {{- if .Values.image.pullSecret }}
+ imagePullSecrets:
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ containers:
+ - name: delete-secrets
+ image: {{ .Values.image.alpineUtils }}
+ securityContext:
+ runAsUser: 0
+ imagePullPolicy: IfNotPresent
+ command: ["sh", "-c"]
+ args:
+ - |
+
+{{- if .Values.settings.removeCertsOnDelete }}
+ function deleteSecret {
+ key=$1
+ kubectl get secret ${key} --namespace {{ .Release.Namespace }} -o json > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ kubectl delete secret ${key} --namespace {{ .Release.Namespace }}
+ fi
+ }
+
+ deleteSecret admin-tls
+ deleteSecret admin-msp
+ deleteSecret {{ .Release.Name }}-msp
+ deleteSecret {{ .Release.Name }}-tls
+ {{- range .Values.users.usersList }}
+ deleteSecret {{ .identity }}-msp
+ deleteSecret {{ .identity }}-tls
+ {{ end }}
+{{- end}}
+{{- if .Values.settings.removeOrdererTlsOnDelete }}
+ if kubectl get configmap --namespace {{ .Release.Namespace }} orderer-tls-cacert &> /dev/null; then
+ echo "Deleting orderer-tls-cacert configmap in k8s ..."
+ kubectl delete configmap --namespace {{ .Release.Namespace }} orderer-tls-cacert
+ fi
+{{- end}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/templates/job.yaml b/platforms/hyperledger-fabric/charts/fabric-catools/templates/job.yaml
new file mode 100644
index 00000000000..87ee6cffb76
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/templates/job.yaml
@@ -0,0 +1,292 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ .Release.Name }}-certs-job
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-delete-policy: "before-hook-creation"
+ labels:
+ app.kubernetes.io/name: {{ include "fabric-catools.name" . }}-job
+ app.kubernetes.io/component: ca-tools
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+spec:
+ backoffLimit: 6
+ template:
+ metadata:
+ labels:
+ app.kubernetes.io/name: {{ include "fabric-catools.name" . }}
+ app.kubernetes.io/component: ca-tools
+ app.kubernetes.io/part-of: {{ include "fabric-catools.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ restartPolicy: OnFailure
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
+ imagePullSecrets:
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ volumes:
+ - name: certificates
+ emptyDir:
+ medium: Memory
+ - name: generate-crypto
+ configMap:
+ name: crypto-scripts-cm
+ defaultMode: 0775
+ items:
+ - key: generate-crypto-orderer.sh
+ path: generate-crypto-orderer.sh
+ - name: generate-orderer-crypto
+ configMap:
+ name: crypto-scripts-cm
+ defaultMode: 0775
+ items:
+ - key: orderer-script.sh
+ path: orderer-script.sh
+ - name: generate-crypto-peer
+ configMap:
+ name: crypto-scripts-cm
+ defaultMode: 0775
+ items:
+ - key: generate-crypto-peer.sh
+ path: generate-crypto-peer.sh
+ - name: generate-crypto-add-peer
+ configMap:
+ name: crypto-scripts-cm
+ defaultMode: 0775
+ items:
+ - key: generate-crypto-add-peer.sh
+ path: generate-crypto-add-peer.sh
+ - name: generate-user-crypto
+ configMap:
+ name: crypto-scripts-cm
+ defaultMode: 0775
+ items:
+ - key: generate-user-crypto.sh
+ path: generate-user-crypto.sh
+ - name: store-vault-orderer
+ configMap:
+ name: orderer-script-store-vault
+ defaultMode: 0775
+ items:
+ - key: store-vault-orderer.sh
+ path: store-vault-orderer.sh
+ - name: store-vault-peer
+ configMap:
+ name: peer-script-store-vault
+ defaultMode: 0775
+ items:
+ - key: store-vault-peer.sh
+ path: store-vault-peer.sh
+ - name: store-vault-users
+ configMap:
+ name: users-script-store-vault
+ defaultMode: 0775
+ items:
+ - key: store-vault-users.sh
+ path: store-vault-users.sh
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ - name: package-manager
+ configMap:
+ name: package-manager
+ containers:
+ - name: generate-certs
+ image: "{{ .Values.image.caTools }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ env:
+ - name: COMPONENT_TYPE
+ value: {{ .Values.orgData.type }}
+ - name: COMPONENT_NAME
+ value: {{ .Release.Namespace }}
+ - name: ADD_PEER
+ value: "{{ .Values.settings.addPeerValue }}"
+ - name: USERS
+ value: {{ .Values.users.usersList | toJson | b64enc }}
+ - name: REFRESH_CERT_VALUE
+ value: "{{ .Values.settings.refreshCertValue }}"
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: VAULT_ADDR
+ value: {{ .Values.global.vault.address }}
+ - name: VAULT_APP_ROLE
+ value: {{ .Values.global.vault.role }}
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ .Values.global.vault.authPath }}
+ - name: VAULT_TYPE
+ value: {{ .Values.global.vault.type }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ {{- end }}
+ command: ["sh", "-c"]
+ args:
+ - |
+
+ . /scripts/package-manager.sh
+ # Define the packages to install
+ packages_to_install="jq curl"
+ install_packages "$packages_to_install"
+ # Download kubectl binary
+ curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.27.0/bin/linux/amd64/kubectl;
+ chmod u+x kubectl && mv kubectl /usr/local/bin/kubectl;
+
+{{- if (eq .Values.global.vault.type "hashicorp") }}
+ . /scripts/bevel-vault.sh
+ echo "Getting vault Token..."
+ vaultBevelFunc "init"
+{{- end }}
+ OUTPUT_PATH="/crypto-config/${COMPONENT_TYPE}Organizations/${COMPONENT_NAME}"
+ mkdir -p ${OUTPUT_PATH}/ca
+ mkdir -p ${OUTPUT_PATH}/msp/admincerts
+ # Get the CA cert from Kubernetes secret
+ kubectl get secret --namespace {{ .Release.Namespace }} fabric-ca-server-certs >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ LOOKUP_SECRET_RESPONSE=$(kubectl get secret -n {{ .Release.Namespace }} fabric-ca-server-certs -o jsonpath='{.data}');
+ echo "${LOOKUP_SECRET_RESPONSE}" | jq -j ".\"tls.crt\"" | base64 -d > ${OUTPUT_PATH}/ca/ca.${COMPONENT_NAME}-cert.pem;
+ else
+{{- if (eq .Values.global.vault.type "hashicorp") }}
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/ca"
+ if [ "$SECRETS_AVAILABLE" = "yes" ]; then
+ # Get ca cert
+ ca_cert=$(echo ${VAULT_SECRET} | jq -r ".rootca_pem")
+ echo "${ca_cert}" > ${OUTPUT_PATH}/ca/ca.${COMPONENT_NAME}-cert.pem
+ ca_key=$(echo ${VAULT_SECRET} | jq -r ".rootca_key")
+ echo "${ca_key}" > ${OUTPUT_PATH}/ca/ca.${COMPONENT_NAME}.key
+ # Also create the k8s secret
+ kubectl create secret tls ${key} --namespace ${COMPONENT_NAME} \
+ --cert=${OUTPUT_PATH}/ca/ca.${COMPONENT_NAME}-cert.pem \
+ --key=${OUTPUT_PATH}/ca/ca.${COMPONENT_NAME}.key
+ else
+ echo "CA certs not found in Vault"
+ exit 1
+ fi;
+{{- else }}
+ echo "CA certs not found in Kubernetes secret"
+ exit 1
+{{- end }}
+ fi
+ echo "CA certificate saved locally."
+ checkSecrets() {
+ type=$1
+ key=$2
+ kubectl get secret --namespace {{ .Release.Namespace }} ${key} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Secret found
+ touch /crypto-config/${key}-exists
+ if [ $key = "admin-msp" ]; then
+ # Get the admin cert if admin-msp already exists
+ LOOKUP_SECRET_RESPONSE=$(kubectl get secret --namespace {{ .Release.Namespace }} ${key} -o jsonpath='{.data}');
+ echo "${LOOKUP_SECRET_RESPONSE}" | jq -j ".\"admincerts\"" | base64 -d > ${OUTPUT_PATH}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem;
+ fi
+ else
+{{- if (eq .Values.global.vault.type "hashicorp") }}
+ #Read if secret exists in Vault
+ vaultBevelFunc 'readJson' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/${type}/${key}"
+ if [ "$SECRETS_AVAILABLE" = "yes" ]; then
+ touch /crypto-config/${key}-exists
+ #TODO Maybe create the K8s secrets from Vault secrets here if needed
+ fi;
+{{- else }}
+ echo "Secret $key does not exist."
+{{- end }}
+ fi
+ }
+
+ # Check if secrets already exist
+ checkSecrets users admin-msp
+ checkSecrets users admin-tls
+ checkSecrets ${COMPONENT_TYPE}s {{ .Release.Name }}-msp
+ checkSecrets ${COMPONENT_TYPE}s {{ .Release.Name }}-tls
+
+ echo "Starting certificate generation."
+ if [ "$COMPONENT_TYPE" = "orderer" ]; then
+ # Generate crypto material for organization orderers (admin)
+ cd /root/ca-tools/org
+ ./generate-crypto-orderer.sh
+
+ if [ ! -e /crypto-config/{{ .Release.Name }}-msp-exists ] || [ ! -e /crypto-config/{{ .Release.Name }}-tls-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ # Generate crypto material for organization orderer
+ echo "Need to execute scripts for orderer {{ .Release.Name }}"
+ cd /root/ca-tools/org
+ ./orderer-script.sh {{ .Release.Name }}
+ fi
+
+ # Save the generated certificates
+ cd /scripts/orderer
+ ./store-vault-orderer.sh {{ .Release.Name }}
+ fi
+
+ if [ "$COMPONENT_TYPE" = "peer" ]; then
+ # Generate crypto material for organization peer (admin)
+ cd /root/ca-tools/org
+ if [ "$ADD_PEER" = "false" ]; then
+ ./generate-crypto-peer.sh {{ .Release.Name }}
+ else
+ if [ ! -e /crypto-config/{{ .Release.Name }}-msp-exists ] || [ ! -e /crypto-config/{{ .Release.Name }}-tls-exists ] || [ "$REFRESH_CERT_VALUE" = "true" ]; then
+ ./generate-crypto-add-peer.sh {{ .Release.Name }}
+ fi
+ fi;
+ {{- range .Values.users.usersList }}
+ checkSecrets users {{ .identity }}-msp
+ checkSecrets users {{ .identity }}-tls
+ {{ end }}
+ cd /root/ca-tools/org
+ ./generate-user-crypto.sh peer ${USERS}
+
+ # Save the generated certificates for peers and users
+ cd /scripts/peer
+ ./store-vault-peer.sh {{ .Release.Name }}
+ cd /scripts/peer
+ {{- range .Values.users.usersList }}
+ ./store-vault-users.sh {{ .identity }}
+ {{ end }}
+ fi;
+ # this command creates the indicator of the completion of scripts
+ echo "Certificate generation complete."
+ volumeMounts:
+ - name: certificates
+ mountPath: /crypto-config
+ - name: generate-crypto
+ mountPath: /root/ca-tools/org/generate-crypto-orderer.sh
+ subPath: generate-crypto-orderer.sh
+ - name: generate-orderer-crypto
+ mountPath: /root/ca-tools/org/orderer-script.sh
+ subPath: orderer-script.sh
+ - name: generate-crypto-peer
+ mountPath: /root/ca-tools/org/generate-crypto-peer.sh
+ subPath: generate-crypto-peer.sh
+ - name: generate-crypto-add-peer
+ mountPath: /root/ca-tools/org/generate-crypto-add-peer.sh
+ subPath: generate-crypto-add-peer.sh
+ - name: generate-user-crypto
+ mountPath: /root/ca-tools/org/generate-user-crypto.sh
+ subPath: generate-user-crypto.sh
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
+ - name: store-vault-orderer
+ mountPath: /scripts/orderer/store-vault-orderer.sh
+ subPath: store-vault-orderer.sh
+ - name: store-vault-peer
+ mountPath: /scripts/peer/store-vault-peer.sh
+ subPath: store-vault-peer.sh
+ - name: store-vault-users
+ mountPath: /scripts/peer/store-vault-users.sh
+ subPath: store-vault-users.sh
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/templates/volume.yaml b/platforms/hyperledger-fabric/charts/fabric-catools/templates/volume.yaml
deleted file mode 100644
index 0fc3023e7de..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-catools/templates/volume.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: ca-tools-crypto-pvc
- namespace: {{ $.Values.metadata.namespace }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.pvc }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
-spec:
- storageClassName: {{ $.Values.storage.storageclassname }}
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: {{ $.Values.storage.storagesize }}
-
----
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: ca-tools-pvc
- namespace: {{ $.Values.metadata.namespace }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.pvc }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
-spec:
- storageClassName: {{ $.Values.storage.storageclassname }}
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: {{ $.Values.storage.storagesize }}
-
diff --git a/platforms/hyperledger-fabric/charts/fabric-catools/values.yaml b/platforms/hyperledger-fabric/charts/fabric-catools/values.yaml
index 97135404c83..3486449ec78 100644
--- a/platforms/hyperledger-fabric/charts/fabric-catools/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-catools/values.yaml
@@ -3,143 +3,111 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
+global:
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: supplychain-vault-role
+ role: vault-role
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
-metadata:
- #Provide the namespace for CA deployment
- #Eg. namespace: org1-net
- namespace: org1-net
- #Provide name for ca server deployment
- #Eg. name: ca-tools
- name: ca-tools
- #Provide organization's type (orderer or peer)
- #Eg. component_type: orderer
- component_type: orderer
- #Provide organization's name in lowercases
- #Eg. org_name: org1
- org_name: org1
- #This will be the proxy/ingress provider. Can have values "haproxy" or "none"
- #Eg. provider: "haproxy"
- proxy: haproxy
-# Provide the number of replica pods
-replicaCount: 1
+ proxy:
+ #This will be the proxy/ingress provider. Can have values "haproxy" or "none"
+ #Eg. provider: "haproxy"
+ provider: haproxy
+ #This field specifies the external url for the organization
+ #Eg. externalUrlSuffix: test.blockchaincloudpoc.com
+ externalUrlSuffix: test.blockchaincloudpoc.com
image:
#Provide the image name for the server container
- #Eg. image: hyperledger/fabric-ca-tools
- repository: ghcr.io/hyperledger/bevel-fabric-ca-tools:1.2.1
- # Provide image pull policy
- pullPolicy: IfNotPresent
+ #Eg. caTools: hyperledger/fabric-ca-tools:latest
+ caTools: ghcr.io/hyperledger/bevel-fabric-ca:latest
#Provide the valid image name and version to read certificates from vault server
#Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
-
-annotations:
- #Extra annotations
- pvc: {}
- deployment: {}
-
-storage:
- #Provide the storageclassname for
- #Eg. storageclassname: aws-storageclass
- storageclassname: aws-storageclass
- #Provide the storagesize for CA
- #Eg. storagesize: 512Mi
- storagesize: 512Mi
-
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: devorg1-net-auth
- authpath: devorg1-net-auth
- #Provide the path configured in vault for users certficates
- #Eg. secretmsp: secretsv2/data/crypto/ordererOrganizations/..../users
- secretusers: secretsv2/data/crypto/ordererOrganizations/org1-net/users
- #Provide the path configured in vault for orderers
- #Eg. secrettls: secretsv2/data/crypto/Organizations/.../.../orderers
- secretorderer: secretsv2/data/crypto/ordererOrganizations/org1-net/orderers
- #Provide the path configured in vault for orderers
- #Eg. secretpeerorderertls: secretsv2/data/crypto/Organizations/.../.../orderer/tls
- secretpeerorderertls: secretsv2/data/crypto/peerOrganizations/org1-net/orderer/tls
- #Provide the secretcert path configured in vault for CA server
- #Eg. secretcert: secretsv2/data/crypto/Organizations/.../...-cert.pem
- secretcert: secretsv2/data/crypto/ordererOrganizations/org1-net/ca?ca.org1-net-cert.pem
- #Provide the secretkey path configured in vault for CA server
- #Eg. secretkey: secretsv2/data/crypto/Organizations/.../...-CA.key
- secretkey: secretsv2/data/crypto/ordererOrganizations/org1-net/ca?org1-net-CA.key
- #Provide the path configured in vault for MSP config.yaml file
- #Eg. secretconfigfile: secretsv2/data/crypto/Organizations/.../config
- secretconfigfile: secretsv2/data/crypto/ordererOrganizations/org1-net/msp/config
- #Provide the path configured in vault for couchdb credentials
- #Eg. secretconfigfile: secretsv2/data/credentials/.../couchdb/org1
- secretcouchdb: secretsv2/data/credentials/org1-net/couchdb/org1
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Kuberenetes secret for vault ca.cert
-
-healthcheck:
- # The amount of times to retry fetching from/writing to Vault before giving up.
- # Eg. retries: 10
- retries: 10
- # The amount of time in seconds to wait after an error occurs when fetching from/writing to Vault.
- # Eg. sleepTimeAfterError: 15
- sleepTimeAfterError: 15
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
+ # Provide image pull policy
+ pullPolicy: IfNotPresent
-org_data:
- #External URL of the organization
- #Eg. external_url_suffix: org1.blockchaincloudpoc.com
- external_url_suffix: org1proxy.blockchaincloudpoc.com
- #Provide organization's subject
- #Eg. "O=Orderer,L=51.50/-0.13/London,C=GB"
- component_subject:
+orgData:
+ #Provide the CA URL for the organization without https
+ #Eg. caAddress: ca.example.com
+ caAddress: ""
+ #Provide the CA Admin User for the organization
+ #Eg. caAdminUser: admin
+ caAdminUser: supplychain-admin
+ #Provide the CA Admin Password for the organization
+ #Eg. caAdminPassword: adminpw
+ caAdminPassword: supplychain-adminpw
+ #Provide organization's name in lowercases
+ #Eg. orgName: supplychain
+ orgName: supplychain
+ #Provide organization's type (orderer or peer)
+ #Eg. type: orderer
+ type: orderer
#Provide organization's subject
- #Eg. "O=Orderer,L=51.50/-0.13/London,C=GB"
- cert_subject:
- #Provide organization's country
- #Eg. UK
- component_country: UK
- #Provide organization's state
- #Eg. London
- component_state: London
- #Provide organization's location
- #Eg. Lodon
- component_location: Lodon
- #Provide organization's ca_url
- #Eg. "ca.supplychain-net.org1.blockchaincloudpoc.com"
- ca_url:
-
-#Provide orderer's names
-orderers:
- name: orderer1
-#Provide orderer's names and ca certificates
-orderers_info: {}
-#Provide peer's names
-peers:
- name: peer1
-#Provide the total number of peers
-peer_count: 4
+ #Eg. componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+ componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
users:
- #Base64 encoded list of users
- #Eg. IC0gdXNlcjoKICAgICAgICAgIGlkZW50aXR5OiB1c2VyMQogICAgICAgICAgYXR0cmlidXRlczoKICAgICAgICAgICAgLSBrZXk6IGtleTEKICAgICAgIgICAgICAgIC0ga2V5OiBrZXkyCiAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlMgogICAgICAgIC0gdXNlcjoKICAgICAgICAgIGlkZW50aXR5OiB1c2VyMgogICAgICAgICAgYXR0cmlidXRlczoKICAgICAgICAgICAgLSBrZXk6IGtleTEKICAgICAgICAgICAgICB2YWx1ZTogdmFsdWUxCiAgICAgICAgICAgIC0ga2V5OiBrZXkzCiAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlMw==
- users_list:
- #Provides a list of user identities
- #Eg. "user1-user2-user3"
- users_identities:
-checks:
- #Provides the need to refresh user certificates
- refresh_cert_value: false
- refresh_user_cert_value: false
- #Add a peer to an existing network
- add_peer_value: False
+ # Generating User Certificates with custom attributes using Fabric CA in Bevel for Peer Organizations
+ # Eg.
+ # usersList:
+ # - user:
+ # identity: user1
+ # attributes:
+ # - key: "hf.Revoker"
+ # value: "true"
+ # - user:
+ # identity: user2
+ # attributes:
+ # - key: "hf.Revoker"
+ # value: "true"
+ usersList:
+ # - identity: user1
+ # attributes:
+ # - key: "hf.Revoker"
+ # value: "true"
+ # - identity: user2
+ # attributes:
+ # - key: "hf.Revoker"
+ # value: "true"
+ #Base64 encoded list of users
+ #Eg. usersListAnsible: IC0gdXNlcjoKICAgICAgICAgIGlkZW50aXR5OiB1c2VyMQogICAgICAgICAgYXR0cmlidXRlczoKICAgICAgICAgICAgLSBrZXk6IGtleTEKICAgICAgIgICAgICAgIC0ga2V5OiBrZXkyCiAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlMgogICAgICAgIC0gdXNlcjoKICAgICAgICAgIGlkZW50aXR5OiB1c2VyMgogICAgICAgICAgYXR0cmlidXRlczoKICAgICAgICAgICAgLSBrZXk6IGtleTEKICAgICAgICAgICAgICB2YWx1ZTogdmFsdWUxCiAgICAgICAgICAgIC0ga2V5OiBrZXkzCiAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlMw==
+ usersListAnsible:
+
+settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: true
+ #Flag to refresh user certificates
+ refreshCertValue: false
+ #Flag to add a peer to an existing network
+ addPeerValue: false
+ #Flag to remove certificates on uninstall
+ removeCertsOnDelete: false
+ #Flag to remove orderer certificates on uninstall
+ removeOrdererTlsOnDelete: false
+
+labels:
+ service: []
+ pvc: []
+ deployment: []
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-create/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-create/Chart.yaml
index 228c9310b9b..46a9ce16dd2 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-create/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-create/Chart.yaml
@@ -5,7 +5,22 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Creates channel."
name: fabric-channel-create
-version: 1.0.0
+description: "Hyperledger Fabric: Creates channel"
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-create/README.md b/platforms/hyperledger-fabric/charts/fabric-channel-create/README.md
index 9a5cdd7cf27..fa2153fa56c 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-create/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-create/README.md
@@ -3,189 +3,98 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# Create Channel Hyperledger Fabric Deployment
+# fabric-channel-create
-- [Create Channel Hyperledger Fabric Deployment Helm Chart](#create-channel-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-channel-create chart deploys a Kubernetes job to create a channel. This chart should be executed after the [fabric-genesis](../fabric-genesis/README.md) chart and the channeltx should be present in `files`. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## Create Channel Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-channel-create) to create a channel.
-
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install allchannel bevel/fabric-channel-create
+```
-
## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
+- Kubernetes 1.19+
+- Helm 3.2.0+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
+Also, [fabric-genesis](../fabric-genesis/README.md) chart should be installed. Then you can get the channeltx with following commands:
+```bash
+cd ./fabric-channel-create/files
+kubectl --namespace supplychain-net get configmap allchannel-channeltx -o jsonpath='{.data.allchannel-channeltx_base64}' > channeltx.json
```
-fabric-channel-create/
- |- templates/
- |- _helpers.yaml
- |- configmap.yaml
- |- create_channel.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: Store configuration data that can be consumed by containers. The first ConfigMap stores various configuration data as key-value pairs and the second ConfigMap stores the base64-encoded content of the channel configuration file (channel.tx.base64).
-- `create_channel.yaml`: The certificates-init fetches TLS certificates from a Vault server and stores them in a local directory. The createchannel fetches the channel configuration file from a local directory and checks to see if the channel already exists. If the channel does not exist, the createchannel creates the channel.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-channel-create/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-### Metadata
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------------------------------------------|---------------------------------------------------|
-| namespace | Provide the namespace for organization's peer | org1-net |
-| images.fabrictools | Valid image name and version for fabric tools | ghcr.io/hyperledger/bevel-fabric-tools:2.2.2 |
-| images.alpineutils | Valid image name and version to read certificates from vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| labels | Custom labels (other than specified) | "" |
-
-
-### Deployment
-
-| Name | Description | Default Value |
-| ------------ | ------------------------------------------- | -------------- |
-| annotations | Deployment annotations | "" |
-
-### Peer
-
-| Name | Description | Default Value |
-| --------------| ----------------------------------------------| ------------------------------|
-| name | Name of the peer as per deployment yaml | peer0 |
-| address | Address of the peer and grpc cluster IP port | peer0.org1-net:7051 |
-| localmspid | Local MSP ID for organization | Org1MSP |
-| loglevel | Log level for organization's peer | debug |
-| tlsstatus | True or False for organization's peer | true |
-
-### Vault
-
-| Name | Description | Default Value |
-| ------------------- | --------------------------------------------------------------------| ------------------------------|
-| role | Vault role for the organization | vault-role |
-| address | Vault server address | "" |
-| authpath | Kubernetes auth backend configured in vault for the organization | devorg1-net-auth |
-| adminsecretprefix | Vault secret prefix for admin | secretsv2/data/crypto/peerOrganizations/org1-net/users/admin |
-| orderersecretprefix | Vault secret prefix for orderer | secretsv2/data/crypto/peerOrganizations/org1-net/orderer |
-| serviceaccountname | Service account name for vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Image secret name for vault | "" |
-| tls | Vault ca.cert Kubernetes secret | "" |
-
-### Channel
-| Name | Description | Default Value |
-| ------ | --------------------------------- | -------------- |
-| name | Name of the channel | mychannel |
+## Installing the Chart
-### Orderer
+To install the chart with the release name `allchannel`:
-| Name | Description | Default Value |
-| ------- | ----------------------------| --------------------------|
-| address | Address for the orderer | orderer1.org1proxy.blockchaincloudpoc.com:443 |
-
-### Other
-
-| Name | Description | Default Value |
-| ---------- | ---------------------------------------------| --------------- |
-| channeltx | Base64 encoded file contents for channeltx | "" |
-
-
-
-## Deployment
----
-
-To deploy the fabric-channel-create Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-channel-create/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-channel-create
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the fabric-channel-create node to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the deployment, we can use the following command:
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install allchannel bevel/fabric-channel-create
```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the Job was created. This command will display information about the Job, including the number of completions and the current status of the Job's pods.
-
-
-## Updating the Deployment
----
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-channel-create/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-channel-create
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-channel-create node is up to date.
+> **Tip**: List all releases using `helm list`
+## Uninstalling the Chart
-
-## Deletion
----
+To uninstall/delete the `allchannel` deployment:
-To delete the deployment and associated resources, run the following Helm command:
+```bash
+helm uninstall allchannel
```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.version` | Fabric Version. This chart is only used for `2.2.x` | `2.2.2` |
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.network` | Network type that is being deployed | `fabric` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `carrier` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/carrier` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `false` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.fabricTools` | Fabric Tools image repository | `ghcr.io/hyperledger/bevel-fabric-tools` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Create Channel Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-channel-create), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+### Peer
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `peer.name` | Name of the Peer that is creating the channel | `peer0` |
+| `peer.address` | Peer Internal or External Address with port | `peer0.carrier-net:7051` |
+| `peer.localMspId` | Peer MSP ID | `carrierMSP` |
+| `peer.logLevel` | Peer Log Level | `debug` |
+| `peer.tlsStatus` | TLS status of the peer | `true` |
+| `peer.ordererAddress` | Orderer Internal or External Address with port for Peer to connect | `orderer1.supplychain-net:7050` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-create/files/readme.txt b/platforms/hyperledger-fabric/charts/fabric-channel-create/files/readme.txt
new file mode 100644
index 00000000000..bf16a121ea7
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-create/files/readme.txt
@@ -0,0 +1 @@
+This is a dummy file. Place the channeltx_base64 file in this directory..
\ No newline at end of file
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/_helpers.tpl
index 7bf5f530a8e..4b4d123f9eb 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/_helpers.tpl
@@ -1,5 +1,46 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
\ No newline at end of file
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-channel-create.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-channel-create.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-channel-create.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create orderer tls configmap name depending on Configmap existance
+*/}}
+{{- define "fabric-channel-create.orderercrt" -}}
+{{- $secret := lookup "v1" "ConfigMap" .Release.Namespace "orderer-tls-cacert" -}}
+{{- if $secret -}}
+{{/*
+ Use this configmap
+*/}}
+{{- printf "orderer-tls-cacert" -}}
+{{- else -}}
+{{/*
+ Use the release configmap
+*/}}
+{{- printf "%s-orderer-tls-cacert" $.Values.peer.name -}}
+{{- end -}}
+{{- end -}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/configmap.yaml
index d6d00bafeee..39a6c936fe9 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/configmap.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/configmap.yaml
@@ -7,43 +7,42 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ $.Values.channel.name }}-config
- namespace: {{ $.Values.metadata.namespace }}
- {{- if $.Values.deployment.annotations }}
- annotations:
-{{ toYaml $.Values.deployment.annotations | nindent 8 }}
- {{- end }}
+ name: {{ .Release.Name }}-config
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: {{ $.Values.channel.name }}-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}-config
+ app.kubernetes.io/component: configmap
+ app.kubernetes.io/part-of: {{ include "fabric-channel-create.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
- CHANNEL_NAME: {{ $.Values.channel.name }}
- FABRIC_LOGGING_SPEC: {{ $.Values.peer.loglevel }}
- CORE_PEER_ID: {{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}
- CORE_PEER_ADDRESS: {{ $.Values.peer.address }}
- CORE_PEER_LOCALMSPID: {{ $.Values.peer.localmspid }}
- CORE_PEER_TLS_ENABLED: "{{ $.Values.peer.tlsstatus }}"
+ CHANNEL_NAME: {{ .Release.Name }}
+ FABRIC_LOGGING_SPEC: {{ .Values.peer.logLevel }}
+ CORE_PEER_ID: {{ .Values.peer.name }}.{{ .Release.Namespace }}
+ CORE_PEER_ADDRESS: {{ .Values.peer.address }}
+ CORE_PEER_LOCALMSPID: {{ .Values.peer.localMspId }}
+ CORE_PEER_TLS_ENABLED: "{{ $.Values.peer.tlsStatus }}"
CORE_PEER_TLS_ROOTCERT_FILE: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp/tlscacerts/tlsca.crt
- ORDERER_CA: /opt/gopath/src/github.com/hyperledger/fabric/crypto/orderer/tls/ca.crt
- ORDERER_URL: {{ $.Values.orderer.address }}
+ ORDERER_CA: /opt/gopath/src/github.com/hyperledger/fabric/orderer/tls/orderer.crt
+ ORDERER_URL: {{ .Values.peer.ordererAddress }}
CORE_PEER_MSPCONFIGPATH: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp
- NETWORK_VERSION: {{ $.Values.metadata.network.version }}
-
+ NETWORK_VERSION: {{ .Values.global.version }}
---
apiVersion: v1
kind: ConfigMap
metadata:
- name: channel-artifacts-{{ $.Values.channel.name }}
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-channel-artifacts
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: channel-artifacts-{{ $.Values.channel.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}-channel-artifacts
+ app.kubernetes.io/component: channel-artifacts
+ app.kubernetes.io/part-of: {{ include "fabric-channel-create.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
- channel.tx.base64: {{ .Values.channeltx | quote }}
-
\ No newline at end of file
+ channeltx_base64: |-
+ {{ .Files.Get "files/channeltx.json" | nindent 8 }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/create_channel.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/create_channel.yaml
index 6c214670fb6..8c1f25d07bc 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/create_channel.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-create/templates/create_channel.yaml
@@ -7,98 +7,125 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: createchannel-{{ $.Values.channel.name }}
- namespace: {{ $.Values.metadata.namespace }}
- {{- if $.Values.deployment.annotations }}
- annotations:
-{{ toYaml $.Values.deployment.annotations | nindent 8 }}
- {{- end }}
+ name: createchannel-{{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
labels:
- app: createchannel-{{ $.Values.channel.name }}
- app.kubernetes.io/name: createchannel-{{ $.Values.channel.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: createchannel-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-channel-create-job
+ app.kubernetes.io/part-of: {{ include "fabric-channel-create.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
backoffLimit: 6
template:
metadata:
labels:
- app: createchannel-{{ $.Values.channel.name }}
- app.kubernetes.io/name: createchannel-{{ $.Values.channel.name }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: createchannel-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-channel-create-job
+ app.kubernetes.io/part-of: {{ include "fabric-channel-create.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
restartPolicy: "OnFailure"
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
+ - name: {{ .Values.image.pullSecret }}
{{- end }}
volumes:
- {{ if .Values.vault.tls }}
+ {{ if .Values.global.vault.tls }}
- name: vaultca
secret:
- secretName: {{ $.Values.vault.tls }}
+ secretName: {{ .Values.global.vault.tls }}
items:
- key: ca.crt.pem
path: ca-certificates.crt
{{ end }}
- - name: channel-artifacts-{{ $.Values.channel.name }}
+ - name: {{ .Release.Name }}-channel-artifacts
configMap:
- name: channel-artifacts-{{ $.Values.channel.name }}
+ name: {{ .Release.Name }}-channel-artifacts
- name: certificates
emptyDir:
medium: Memory
- name: scripts-volume
configMap:
name: bevel-vault-script
+ - name: orderer-tls-cacert
+ configMap:
+ name: {{ include "fabric-channel-create.orderercrt" . }}
+ defaultMode: 0775
+ items:
+ - key: cacert
+ path: orderer.crt
initContainers:
- name: certificates-init
- image: {{ $.Values.metadata.images.alpineutils }}
+ image: {{ .Values.image.alpineUtils }}
imagePullPolicy: IfNotPresent
env:
- name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
+ value: {{ .Values.global.vault.address }}
- name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: VAULT_PEER_SECRET_PREFIX
- value: "{{ $.Values.vault.adminsecretprefix }}"
- - name: VAULT_ORDERER_SECRET_PREFIX
- value: "{{ $.Values.vault.orderersecretprefix }}"
+ value: {{ .Values.global.vault.role }}
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ .Values.global.vault.authPath }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
- name: MOUNT_PATH
value: /secret
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
command: ["sh", "-c"]
args:
- |-
#!/usr/bin/env sh
- . /scripts/bevel-vault.sh
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . /scripts/bevel-vault.sh
vaultBevelFunc "init"
- echo "Getting Orderer TLS certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_ORDERER_SECRET_PREFIX}/tls"
- TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca.crt"]')
+ function getAdminMspSecret {
+ KEY=$1
+
+ echo "Getting MSP certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${KEY}"
- OUTPUT_PATH="${MOUNT_PATH}/orderer/tls"
- mkdir -p ${OUTPUT_PATH}
- echo "${TLS_CA_CERT}" >> ${OUTPUT_PATH}/ca.crt
+ ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
+ CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
+ KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
+ SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
+ TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
- ###############################################################################
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ }
- echo "Getting MSP certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_PEER_SECRET_PREFIX}/msp"
+{{- else }}
+ function getAdminMspSecret {
+ KEY=$1
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
- ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
- CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
- KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
- SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
- TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+ ADMINCERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacerts' | base64 -d)
+ KEYSTORE=$(echo ${KUBENETES_SECRET} | jq -r '.data.keystore' | base64 -d)
+ SIGNCERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.signcerts' | base64 -d)
+ TLSCACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.tlscacerts' | base64 -d)
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ }
+{{- end }}
OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
mkdir -p ${OUTPUT_PATH}/admincerts
@@ -106,14 +133,9 @@ spec:
mkdir -p ${OUTPUT_PATH}/keystore
mkdir -p ${OUTPUT_PATH}/signcerts
mkdir -p ${OUTPUT_PATH}/tlscacerts
-
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ getAdminMspSecret admin-msp
volumeMounts:
- {{ if .Values.vault.tls }}
+ {{ if .Values.global.vault.tls }}
- name: vaultca
mountPath: "/etc/ssl/certs/"
readOnly: true
@@ -125,7 +147,7 @@ spec:
subPath: bevel-vault.sh
containers:
- name: createchannel
- image: {{ $.Values.metadata.images.fabrictools }}
+ image: {{ .Values.image.fabricTools }}:{{ .Values.global.version }}
imagePullPolicy: IfNotPresent
stdin: true
tty: true
@@ -133,47 +155,39 @@ spec:
args:
- |-
#!/usr/bin/env sh
- cat ./channel-artifacts/channel.tx.base64 | base64 -d > channel.tx
+ cat ./channel-artifacts/channeltx_base64 | base64 -d > channel.tx
+
echo "Fetch block to see if channel has already been created..."
tls_status=${CORE_PEER_TLS_ENABLED}
if [ "$tls_status" = "true" ]
then
peer channel fetch 0 -c ${CHANNEL_NAME} --tls --cafile ${ORDERER_CA} -o ${ORDERER_URL} /tmp/${CHANNEL_NAME}.block
else
- peer channel fetch 0 -c ${CHANNEL_NAME} -o ${ORDERER_URL} /tmp/${CHANNEL_NAME}.block
+ peer channel fetch 0 -c ${CHANNEL_NAME} -o ${ORDERER_URL} /tmp/${CHANNEL_NAME}.block
fi
-
if [ -f /tmp/${CHANNEL_NAME}.block ]
then
echo "Channel ${CHANNEL_NAME} is already created."
else
echo "Creating Channel ${CHANNEL_NAME}"
- version1_4=`echo $NETWORK_VERSION | grep -c 1.4`
if [ "$tls_status" = "true" ]
then
- if [ $version1_4 = 1 ]
- then
- peer channel create -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f channel.tx --tls ${CORE_PEER_TLS_ENABLED} --cafile ${ORDERER_CA}
- else
- peer channel create -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f channel.tx --tls ${CORE_PEER_TLS_ENABLED} --cafile ${ORDERER_CA} --outputBlock /tmp/${CHANNEL_NAME}.block
- fi
+ peer channel create -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f channel.tx --tls ${CORE_PEER_TLS_ENABLED} --cafile ${ORDERER_CA} --outputBlock /tmp/${CHANNEL_NAME}.block
else
- if [ $version1_4 = 1 ]
- then
- peer channel create -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f channel.tx
- else
- peer channel create -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f channel.tx --outputBlock /tmp/${CHANNEL_NAME}.block
- fi
+ peer channel create -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f channel.tx --outputBlock /tmp/${CHANNEL_NAME}.block
fi
fi
workingDir: /opt/gopath/src/github.com/hyperledger/fabric/peer
envFrom:
- configMapRef:
- name: {{ $.Values.channel.name }}-config
+ name: {{ .Release.Name }}-config
volumeMounts:
- name: certificates
mountPath: /opt/gopath/src/github.com/hyperledger/fabric/crypto
readOnly: true
- - name: channel-artifacts-{{ $.Values.channel.name }}
+ - name: {{ .Release.Name }}-channel-artifacts
mountPath: /opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
readOnly: true
+ - name: orderer-tls-cacert
+ mountPath: /opt/gopath/src/github.com/hyperledger/fabric/orderer/tls/orderer.crt
+ subPath: orderer.crt
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-create/values.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-create/values.yaml
index d52002dffd1..0a6da1ff8aa 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-create/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-create/values.yaml
@@ -3,85 +3,69 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+---
+# The following are for overriding global values
+global:
+ # HLF Network Version
+ #Eg. version: 2.2.2
+ version: 2.2.2
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the network type
+ network: fabric
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: carrier
+ authPath: carrier
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/carrier"
+ #Enable or disable TLS for vault communication
+ #Eg. tls: true
+ tls:
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: org1-net
- namespace: org1-net
- images:
- #Provide the valid image name and version for fabric tools
- #Eg. fabrictools: hyperledger/fabric-tools:1.4.0
- fabrictools: ghcr.io/hyperledger/bevel-fabric-tools:2.2.2
- #Provide the valid image name and version to read certificates from vault server
- #Eg. alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name , app.
- #Eg. labels:
- # role: create_channel
- labels:
-
-deployment:
- annotations:
-
+image:
+ #Provide the valid image name and version for fabric tools
+ #Eg. fabricTools: hyperledger/fabrictools
+ fabricTools: ghcr.io/hyperledger/bevel-fabric-tools
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg. alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
peer:
#Provide the name of the peer as per deployment yaml.
#Eg. name: peer0
name: peer0
#Provide the address of the peer who creates the channel and port to be mentioned is grpc cluster IP port
- #Eg. address: peer0.org1-net:7051
- address: peer0.org1-net:7051
- #Provide the localmspid for organization
- #Eg. localmspid: Org1MSP
- localmspid: Org1MSP
- #Provide the loglevel for organization's peer
- #Eg. loglevel: info
- loglevel: debug
- #Provide the value for tlsstatus to be true or false for organization's peer
- #Eg. tlsstatus: true
- tlsstatus: true
-
-
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: org1-vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: devorg1-net-auth1
- authpath: devorg1-net-auth
- #Provide the value for vault secretprefix
- #Eg. adminsecretprefix: secretsv2/data/crypto/peerOrganizations/.../users/admin
- adminsecretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/users/admin
- #Provide the value for vault secretprefix
- #Eg. orderersecretprefix: secretsv2/data/crypto/peerOrganizations/.../orderer
- orderersecretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/orderer
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Kuberenetes secret for vault ca.cert
- #Enable or disable TLS for vault communication if value present or not
- #Eg. tls: vaultca
- tls:
-
-channel:
- #Provide the name of the channel
- #Eg. name: mychannel
- name: mychannel
-
-orderer:
+ #Eg. address: peer0.carrier-net:7051
+ address: peer0.carrier-net:7051
+ #Provide the localMspId for organization
+ #Eg. localMspId: carrierMSP
+ localMspId: carrierMSP
+ #Provide the logLevel for organization's peer
+ #Eg. logLevel: info
+ logLevel: debug
+ #Provide the value for tlsStatus to be true or false for organization's peer
+ #Eg. tlsStatus: true
+ tlsStatus: true
#Provide the address for orderer
- #Eg. address: orderer.fratest-com:7050
- address: orderer1.org1proxy.blockchaincloudpoc.com:443
-
-#Provide the base64 encoded file contents for channeltx
-channeltx:
+ #Eg. ordererAddress: orderer1.test.yourdomain.com:443
+ ordererAddress: orderer1.supplychain-net:7050
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/.helmignore b/platforms/hyperledger-fabric/charts/fabric-channel-join/.helmignore
new file mode 100644
index 00000000000..014fa775608
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+generated_config/
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-join/Chart.yaml
index f4fa27ef82b..4b659443cc8 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-join/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/Chart.yaml
@@ -5,7 +5,22 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Joins the peer to the channel."
name: fabric-channel-join
-version: 1.0.0
+description: "Hyperledger Fabric: Joins the peer to the channel."
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/README.md b/platforms/hyperledger-fabric/charts/fabric-channel-join/README.md
index fb57f297204..562e5989108 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-join/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/README.md
@@ -3,175 +3,102 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# Join Channel Hyperledger Fabric Deployment
+# fabric-channel-join
-- [Join Channel Hyperledger Fabric Deployment Helm Chart](#join-channel-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-channel-join chart deploys a Kubernetes job to join a channel. This chart should be executed after the [fabric-channel-create](../fabric-channel-create/README.md) chart or the [fabric-osnadmin-channel-create](../fabric-osnadmin-channel-create/README.md) chart for 2.5.x and the anchortx should be present in `files`. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## Join Channel Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-channel-join) for joining the channel.
-
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install peer0-allchannel bevel/fabric-channel-join
+```
-
## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
+- Kubernetes 1.19+
+- Helm 3.2.0+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
+Also, for Fabric 2.2.x, the [fabric-genesis](../fabric-genesis/README.md) and [fabric-channel-create](../fabric-channel-create/README.md) charts should be installed.
+For Fabric 2.5.x, the [fabric-osnadmin-channel-create](../fabric-osnadmin-channel-create/README.md) chart should be installed before this chart.
+Then you can get the channeltx with following commands:
+```bash
+cd ./fabric-channel-join/files
+kubectl --namespace supplychain-net get configmap allchannel-supplychain-anchortx -o jsonpath='{.data.allchannel-supplychain-anchortx_base64}' > anchortx.json
```
-fabric-channel-join/
- |- templates/
- |- _helpers.yaml
- |- configmap.yaml
- |- join_channel.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: Stores the configuration for the joinchannel container.
-- `join_channel.yaml`: The certificates-init retrieves TLS and MSP certificates from Vault and stores them in the local filesystem. The joinchannel joins the peer to the channel by fetching the channel configuration block from the orderer. Both containers are essential for the peer to join the channel and start participating in the network.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-channel-join/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-### Metadata
-
-| Name | Description | Default Value |
-| -----------------------| ---------------------------------------------------------------------------------| --------------------------------------------------|
-| namespace | Namespace for organization's peer | org1-net |
-| images.fabrictools | Valid image name and version for Fabric tools | ghcr.io/hyperledger/bevel-fabric-tools:2.2.2 |
-| images.alpineutils | Valid image name and version to read certificates from the Vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| labels | Custom labels for the organization | "" |
-
-### Peer
-
-| Name | Description | Default Value |
-| ------------| -------------------------------------------------| ----------------------------|
-| name | Name of the peer as per deployment YAML | peer0 |
-| address | Address of the peer and its grpc cluster IP port | peer0.org1-net:7051 |
-| localmspid | Local MSPID for the organization | Org1MSP |
-| loglevel | Log level for the organization's peer | info |
-| tlsstatus | TLS status for the organization's peer | true |
-
-### Vault
-
-| Name | Description | Default Value |
-| ----------------------| ------------------------------------------------------------------| -----------------------------|
-| role | Vault role for the organization | vault-role |
-| address | Vault server address | "" |
-| authpath | Kubernetes auth backend configured in Vault for the organization | devorg1-net-auth |
-| adminsecretprefix | Vault secretprefix for admin | secretsv2/data/crypto/peerOrganizations/org1-net/users/admin |
-| orderersecretprefix | Vault secretprefix for orderer | secretsv2/data/crypto/peerOrganizations/org1-net/orderer |
-| serviceaccountname | Service account name for Vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Imagesecret name for Vault | "" |
-
-### channel
-| Name | Description | Default Value |
-| ----------| ----------------------| -----------------|
-| address | Name of the channel | mychannel |
+## Installing the Chart
-### Orderer
+To install the chart with the release name `peer0-allchannel`:
-| Name | Description | Default Value |
-| ----------| --------------------------| -----------------------------|
-| address | Address for the orderer | orderer1.org1proxy.blockchaincloudpoc.com:443 |
-
-
-
-## Deployment
----
-
-To deploy the fabric-channel-join Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-channel-join/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-channel-join
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the fabric-channel-join node to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the deployment, we can use the following command:
-```
-$ kubectl get jobs -n
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install peer0-allchannel bevel/fabric-channel-join
```
-Replace `` with the actual namespace where the Job was created. This command will display information about the Job, including the number of completions and the current status of the Job's pods.
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-
-## Updating the Deployment
----
+> **Tip**: List all releases using `helm list`
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-channel-join/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-channel-join
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-channel-join node is up to date.
+## Uninstalling the Chart
+To uninstall/delete the `peer0-allchannel` deployment:
-
-## Deletion
----
-
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
+```bash
+helm uninstall peer0-allchannel
```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.version` | Fabric Version. | `2.5.4` |
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.network` | Network type that is being deployed | `fabric` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `false` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.fabricTools` | Fabric Tools image repository | `ghcr.io/hyperledger/bevel-fabric-tools` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Join Channel Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-channel-join), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+### Peer
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `peer.name` | Name of the Peer that is joining the channel | `peer0` |
+| `peer.type` | Type of the Peer that is joining the channel, choose between `anchor` or `general` | `anchor` |
+| `peer.address` | Peer Internal or External Address with port | `peer0.supplychain-net:7051` |
+| `peer.localMspId` | Peer MSP ID | `supplychainMSP` |
+| `peer.logLevel` | Peer Log Level | `info` |
+| `peer.tlsStatus` | TLS status of the peer | `true` |
+| `peer.channelName` | Name of the channel this peer wants to join | `AllChannel` |
+| `peer.ordererAddress` | Orderer Internal or External Address with port for Peer to connect | `orderer1.supplychain-net:7050` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/files/readme.txt b/platforms/hyperledger-fabric/charts/fabric-channel-join/files/readme.txt
new file mode 100644
index 00000000000..bf16a121ea7
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/files/readme.txt
@@ -0,0 +1 @@
+This is a dummy file. Place the channeltx_base64 file in this directory..
\ No newline at end of file
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/_helpers.tpl
index 7bf5f530a8e..869da311d62 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/_helpers.tpl
@@ -1,5 +1,46 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
\ No newline at end of file
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-channel-join.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-channel-join.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-channel-join.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create orderer tls configmap name depending on Configmap existance
+*/}}
+{{- define "fabric-channel-join.orderercrt" -}}
+{{- $secret := lookup "v1" "ConfigMap" .Release.Namespace "orderer-tls-cacert" -}}
+{{- if $secret -}}
+{{/*
+ Use this configmap
+*/}}
+{{- printf "orderer-tls-cacert" -}}
+{{- else -}}
+{{/*
+ Use the release configmap
+*/}}
+{{- printf "%s-orderer-tls-cacert" $.Values.peer.name -}}
+{{- end -}}
+{{- end -}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/anchorpeer.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/anchorpeer.yaml
new file mode 100644
index 00000000000..8be70ed1a79
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/anchorpeer.yaml
@@ -0,0 +1,230 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+{{- if eq .Values.peer.type "anchor" }}
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: anchorpeer-{{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ "helm.sh/hook": post-install
+ "helm.sh/hook-weight": "1"
+ "helm.sh/hook-delete-policy": "before-hook-creation"
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: anchorpeer-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-anchorpeer-job
+ app.kubernetes.io/part-of: anchorpeer-{{ .Release.Name }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+spec:
+ backoffLimit: 3
+ template:
+ metadata:
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: anchorpeer-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-anchorpeer-job
+ app.kubernetes.io/part-of: anchorpeer-{{ .Release.Name }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ restartPolicy: "OnFailure"
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
+ imagePullSecrets:
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ volumes:
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ secret:
+ secretName: {{ .Values.global.vault.tls }}
+ items:
+ - key: ca.crt.pem
+ path: ca-certificates.crt # curl expects certs to be in /etc/ssl/certs/ca-certificates.crt
+ {{ end }}
+ - name: certificates
+ emptyDir:
+ medium: Memory
+ - name: orderer-tls-cacert
+ configMap:
+ name: {{ include "fabric-channel-join.orderercrt" . }}
+ defaultMode: 0775
+ items:
+ - key: cacert
+ path: orderer.crt
+ {{- if ne (.Values.global.version | trunc 3) "2.5" }}
+ - name: anchorpeer-artifacts
+ configMap:
+ name: {{ .Release.Name }}-anchor-artifacts
+ {{- end }}
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ initContainers:
+ - name: certificates-init
+ image: {{ .Values.image.alpineUtils }}
+ imagePullPolicy: IfNotPresent
+ env:
+ - name: VAULT_ADDR
+ value: {{ .Values.global.vault.address }}
+ - name: VAULT_APP_ROLE
+ value: {{ .Values.global.vault.role }}
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ .Values.global.vault.authPath }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
+ - name: MOUNT_PATH
+ value: /secret
+ command: ["sh", "-c"]
+ args:
+ - |-
+ #!/usr/bin/env sh
+{{- if eq .Values.global.vault.type "hashicorp" }}
+
+ . /scripts/bevel-vault.sh
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+
+ function getAdminMspSecret {
+ KEY=$1
+
+ echo "Getting MSP certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${KEY}"
+
+ ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
+ CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
+ KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
+ SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
+ TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ }
+
+{{- else }}
+
+ function getAdminMspSecret {
+ KEY=$1
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+
+ ADMINCERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacerts' | base64 -d)
+ KEYSTORE=$(echo ${KUBENETES_SECRET} | jq -r '.data.keystore' | base64 -d)
+ SIGNCERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.signcerts' | base64 -d)
+ TLSCACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.tlscacerts' | base64 -d)
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ }
+{{- end }}
+
+ OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
+ mkdir -p ${OUTPUT_PATH}/admincerts
+ mkdir -p ${OUTPUT_PATH}/cacerts
+ mkdir -p ${OUTPUT_PATH}/keystore
+ mkdir -p ${OUTPUT_PATH}/signcerts
+ mkdir -p ${OUTPUT_PATH}/tlscacerts
+ getAdminMspSecret admin-msp
+
+ volumeMounts:
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ mountPath: "/etc/ssl/certs/"
+ readOnly: true
+ {{ end }}
+ - name: certificates
+ mountPath: /secret
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
+ containers:
+ - name: anchorpeer
+ image: {{ .Values.image.fabricTools }}:{{ .Values.global.version }}
+ imagePullPolicy: IfNotPresent
+ stdin: true
+ tty: true
+ command: ["sh", "-c"]
+ args:
+ - |-
+ #!/usr/bin/env sh
+
+ version2_5=`echo $NETWORK_VERSION | grep -c 2.5`
+
+ if [ $version2_5 = 1 ]
+ then
+ echo "Fetching the most recent configuration block for the channel"
+ peer channel fetch config config_block.pb -o ${ORDERER_URL} -c ${CHANNEL_NAME} --tls --cafile ${ORDERER_CA}
+
+ echo "Decoding config block to JSON and isolating config to ${CORE_PEER_LOCALMSPID}config.json"
+ configtxlator proto_decode --input config_block.pb --type common.Block --output config_block.json
+ jq .data.data[0].payload.data.config config_block.json >"${CORE_PEER_LOCALMSPID}config.json"
+
+ CHECK_ANCHOR=$(jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values.AnchorPeers.value.anchor_peers' ${CORE_PEER_LOCALMSPID}config.json)
+
+ PORT="${CORE_PEER_ADDRESS##*:}"
+ HOST="${CORE_PEER_ADDRESS%%:*}"
+ if echo "$CHECK_ANCHOR" | grep -q "$HOST"; then
+ echo "The anchopeer has already been created"
+ else
+ jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "'$HOST'","port": '$PORT'}]},"version": "0"}}' ${CORE_PEER_LOCALMSPID}config.json > ${CORE_PEER_LOCALMSPID}modified_config.json
+
+ configtxlator proto_encode --input "${CORE_PEER_LOCALMSPID}config.json" --type common.Config --output original_config.pb
+ configtxlator proto_encode --input "${CORE_PEER_LOCALMSPID}modified_config.json" --type common.Config --output modified_config.pb
+ configtxlator compute_update --channel_id "${CHANNEL_NAME}" --original original_config.pb --updated modified_config.pb --output config_update.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json
+ echo '{"payload":{"header":{"channel_header":{"channel_id":"'$CHANNEL_NAME'", "type":2}},"data":{"config_update":'$(cat config_update.json)'}}}' | jq . >config_update_in_envelope.json
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output "${CORE_PEER_LOCALMSPID}anchors.tx"
+
+ peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f ${CORE_PEER_LOCALMSPID}anchors.tx --tls --cafile ${ORDERER_CA}
+ fi
+ else
+ echo "Updating anchor peer for the channel ${CHANNEL_NAME}"
+ tls_status=${CORE_PEER_TLS_ENABLED}
+ if [ "$tls_status" = "true" ]
+ then
+ peer channel fetch 0 ${CHANNEL_NAME}.block -o ${ORDERER_URL} -c ${CHANNEL_NAME} --tls --cafile ${ORDERER_CA}
+ else
+ peer channel fetch 0 ${CHANNEL_NAME}.block -o ${ORDERER_URL} -c ${CHANNEL_NAME}
+ fi
+ cat ./channel-artifacts/anchors.tx.json | base64 -d > ${CORE_PEER_LOCALMSPID}anchors.tx
+ if [ "$tls_status" = "true" ]
+ then
+ peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f ${CORE_PEER_LOCALMSPID}anchors.tx --tls --cafile ${ORDERER_CA}
+ else
+ peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f ${CORE_PEER_LOCALMSPID}anchors.tx
+ fi
+ fi
+ workingDir: /opt/gopath/src/github.com/hyperledger/fabric/peer
+ envFrom:
+ - configMapRef:
+ name: {{ .Release.Name }}-config
+ volumeMounts:
+ - name: certificates
+ mountPath: /opt/gopath/src/github.com/hyperledger/fabric/crypto
+ readOnly: true
+ - name: orderer-tls-cacert
+ mountPath: /opt/gopath/src/github.com/hyperledger/fabric/orderer/tls/orderer.crt
+ subPath: orderer.crt
+ {{- if ne (.Values.global.version | trunc 3) "2.5" }}
+ - name: anchorpeer-artifacts
+ mountPath: /opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
+ readOnly: true
+ {{- end }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/configmap.yaml
index 51609ec30ee..df2f3b2d68a 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/configmap.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/configmap.yaml
@@ -7,22 +7,43 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: joinchannel-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-config
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-config
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: joinchannel-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app.kubernetes.io/name: {{ .Release.Name }}-config
+ app.kubernetes.io/component: configmap
+ app.kubernetes.io/part-of: {{ include "fabric-channel-join.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
- CHANNEL_NAME: {{ $.Values.channel.name }}
- FABRIC_LOGGING_SPEC: {{ $.Values.peer.loglevel }}
- CORE_PEER_ID: {{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}
- CORE_PEER_ADDRESS: {{ $.Values.peer.address }}
- CORE_PEER_LOCALMSPID: {{ $.Values.peer.localmspid }}
- CORE_PEER_TLS_ENABLED: "{{ $.Values.peer.tlsstatus }}"
+ CHANNEL_NAME: {{ .Values.peer.channelName | lower }}
+ FABRIC_LOGGING_SPEC: {{ .Values.peer.logLevel }}
+ CORE_PEER_ID: {{ .Values.peer.name }}.{{ .Release.Namespace }}
+ CORE_PEER_ADDRESS: {{ .Values.peer.address }}
+ CORE_PEER_LOCALMSPID: {{ .Values.peer.localMspId }}
+ CORE_PEER_TLS_ENABLED: "{{ .Values.peer.tlsStatus }}"
CORE_PEER_TLS_ROOTCERT_FILE: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp/tlscacerts/tlsca.crt
- ORDERER_CA: /opt/gopath/src/github.com/hyperledger/fabric/crypto/orderer/tls/ca.crt
- ORDERER_URL: {{ $.Values.orderer.address }}
+ ORDERER_CA: /opt/gopath/src/github.com/hyperledger/fabric/orderer/tls/orderer.crt
+ ORDERER_URL: {{ .Values.peer.ordererAddress }}
CORE_PEER_MSPCONFIGPATH: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp
+ NETWORK_VERSION: {{ .Values.global.version }}
+
+---
+{{- if ne (.Values.global.version | trunc 3) "2.5" }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ .Release.Name }}-anchor-artifacts
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/name: {{ .Release.Name }}-anchor-artifacts
+ app.kubernetes.io/component: anchorpeer-artifacts
+ app.kubernetes.io/part-of: {{ include "fabric-channel-join.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+data:
+ anchors.tx.json: |-
+ {{ .Files.Get "files/anchortx.json" | nindent 8 }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/join_channel.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/join_channel.yaml
index 85fd38380cf..a41ad4a719d 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/join_channel.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/templates/join_channel.yaml
@@ -7,37 +7,44 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: joinchannel-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- namespace: {{ $.Values.metadata.namespace }}
+ name: joinchannel-{{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ "helm.sh/hook": post-install
+ "helm.sh/hook-weight": "0"
+ "helm.sh/hook-delete-policy": "before-hook-creation"
labels:
- app: joinchannel-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- app.kubernetes.io/name: joinchannel-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: channel-join-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-channel-join-job
+ app.kubernetes.io/part-of: {{ include "fabric-channel-join.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
backoffLimit: 6
template:
metadata:
labels:
- app: joinchannel-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- app.kubernetes.io/name: joinchannel-{{ $.Values.peer.name }}-{{ $.Values.channel.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: channel-join-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-channel-join-job
+ app.kubernetes.io/part-of: {{ include "fabric-channel-join.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
restartPolicy: "OnFailure"
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
+ - name: {{ .Values.image.pullSecret }}
{{- end }}
volumes:
- {{ if .Values.vault.tls }}
+ {{ if .Values.global.vault.tls }}
- name: vaultca
secret:
- secretName: {{ $.Values.vault.tls }}
+ secretName: {{ .Values.global.vault.tls }}
items:
- key: ca.crt.pem
path: ca-certificates.crt # curl expects certs to be in /etc/ssl/certs/ca-certificates.crt
@@ -48,50 +55,80 @@ spec:
- name: scripts-volume
configMap:
name: bevel-vault-script
+ - name: orderer-tls-cacert
+ configMap:
+ name: {{ include "fabric-channel-join.orderercrt" . }}
+ defaultMode: 0775
+ items:
+ - key: cacert
+ path: orderer.crt
initContainers:
- name: certificates-init
- image: {{ $.Values.metadata.images.alpineutils }}
+ image: {{ .Values.image.alpineUtils }}
imagePullPolicy: IfNotPresent
env:
- name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
+ value: {{ .Values.global.vault.address }}
- name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: VAULT_PEER_SECRET_PREFIX
- value: "{{ $.Values.vault.adminsecretprefix }}"
- - name: VAULT_ORDERER_SECRET_PREFIX
- value: "{{ $.Values.vault.orderersecretprefix }}"
+ value: {{ .Values.global.vault.role }}
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ .Values.global.vault.authPath }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
- name: MOUNT_PATH
value: /secret
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
command: ["sh", "-c"]
args:
- |-
#!/usr/bin/env sh
- . /scripts/bevel-vault.sh
+{{- if eq .Values.global.vault.type "hashicorp" }}
- # Calling a function to retrieve the vault token.
+ . /scripts/bevel-vault.sh
vaultBevelFunc "init"
- echo "Getting Orderer TLS certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_ORDERER_SECRET_PREFIX}/tls"
+ function getAdminMspSecret {
+ KEY=$1
+
+ echo "Getting MSP certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${KEY}"
+
+ ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
+ CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
+ KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
+ SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
+ TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ }
- TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca.crt"]')
- OUTPUT_PATH="${MOUNT_PATH}/orderer/tls"
- mkdir -p ${OUTPUT_PATH}
- echo "${TLS_CA_CERT}" >> ${OUTPUT_PATH}/ca.crt
+{{- else }}
- echo "Getting MSP certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_PEER_SECRET_PREFIX}/msp"
+ function getAdminMspSecret {
+ KEY=$1
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
- ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
- CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
- KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
- SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
- TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+ ADMINCERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacerts' | base64 -d)
+ KEYSTORE=$(echo ${KUBENETES_SECRET} | jq -r '.data.keystore' | base64 -d)
+ SIGNCERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.signcerts' | base64 -d)
+ TLSCACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.tlscacerts' | base64 -d)
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ }
+
+{{- end }}
OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
mkdir -p ${OUTPUT_PATH}/admincerts
@@ -99,14 +136,9 @@ spec:
mkdir -p ${OUTPUT_PATH}/keystore
mkdir -p ${OUTPUT_PATH}/signcerts
mkdir -p ${OUTPUT_PATH}/tlscacerts
-
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ getAdminMspSecret admin-msp
volumeMounts:
- {{ if .Values.vault.tls }}
+ {{ if .Values.global.vault.tls }}
- name: vaultca
mountPath: "/etc/ssl/certs/"
readOnly: true
@@ -118,7 +150,7 @@ spec:
subPath: bevel-vault.sh
containers:
- name: joinchannel
- image: {{ $.Values.metadata.images.fabrictools }}
+ image: {{ .Values.image.fabricTools }}:{{ .Values.global.version }}
imagePullPolicy: IfNotPresent
stdin: true
tty: true
@@ -145,8 +177,11 @@ spec:
workingDir: /opt/gopath/src/github.com/hyperledger/fabric/peer
envFrom:
- configMapRef:
- name: joinchannel-{{ $.Values.channel.name }}-{{ $.Values.peer.name }}-config
+ name: {{ .Release.Name }}-config
volumeMounts:
- name: certificates
mountPath: /opt/gopath/src/github.com/hyperledger/fabric/crypto
readOnly: true
+ - name: orderer-tls-cacert
+ mountPath: /opt/gopath/src/github.com/hyperledger/fabric/orderer/tls/orderer.crt
+ subPath: orderer.crt
diff --git a/platforms/hyperledger-fabric/charts/fabric-channel-join/values.yaml b/platforms/hyperledger-fabric/charts/fabric-channel-join/values.yaml
index 6562c4161d5..ec0d8db02f4 100644
--- a/platforms/hyperledger-fabric/charts/fabric-channel-join/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-channel-join/values.yaml
@@ -3,75 +3,75 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+---
+# The following are for overriding global values
+global:
+ # HLF Network Version
+ #Eg. version: 2.5.4
+ version: 2.5.4
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the network type
+ network: fabric
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
+ #Enable or disable TLS for vault communication
+ #Eg. tls: true
+ tls:
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: org1-net
- namespace: org1-net
- images:
- #Provide the valid image name and version for fabric tools
- #Eg. fabric-tools: hyperledger/fabrictools:1.4.0
- fabrictools: ghcr.io/hyperledger/bevel-fabric-tools:2.2.2
- #Provide the valid image name and version to read certificates from vault server
- #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name , app.
- #Eg. labels:
- # role: join_channel
- labels:
+image:
+ #Provide the valid image name and version for fabric tools
+ #Eg. fabricTools: hyperledger/fabrictools
+ fabricTools: ghcr.io/hyperledger/bevel-fabric-tools
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
peer:
#Provide the name of the peer as per deployment yaml.
#Eg. name: peer0
name: peer0
+ #Provide the type of peer
+ #Eg. type: anchor | general
+ type: anchor
#Provide the address of the peer who wants to join channel and port to be mentioned is grpc cluster IP port
- #Eg. address: peer0.org1-net:7051
- address: peer0.org1-net:7051
- #Provide the localmspid for organization
- #Eg. localmspid: Org1MSP
- localmspid: Org1MSP
- #Provide the loglevel for organization's peer
- #Eg. loglevel: info
- loglevel: info
+ #Eg. address: peer0.supplychain-net:7051
+ address: peer0.supplychain-net:7051
+ #Provide the localMspId for organization
+ #Eg. localMspId: supplychainMSP
+ localMspId: supplychainMSP
+ #Provide the logLevel for organization's peer
+ #Eg. logLevel: info
+ logLevel: info
#Provide the value for tlsstatus to be true or false for organization's peer
#Eg. tlsstatus: true
- tlsstatus: true
-
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: org1-vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: devorg1-net-auth
- authpath: devorg1-net-auth
- #Provide the value for vault secretprefix
- #Eg. adminsecretprefix: secretsv2/data/crypto/peerOrganizations/.../users/admin
- adminsecretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/users/admin
- #Provide the value for vault secretprefix
- #Eg. orderersecretprefix: secretsv2/data/crypto/peerOrganizations/.../orderer
- orderersecretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/orderer
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Kuberenetes secret for vault ca.cert
-
-
-channel:
- #Provide the name of the channel
- #Eg. name: mychannel
- name: mychannel
-
-orderer:
+ tlsStatus: true
+ #Provide the name of the channel which peer will join
+ #Eg. channelName: AllChannel
+ channelName: AllChannel
#Provide the address for orderer
- #Eg. address: orderer1.org1proxy.blockchaincloudpoc.com:443
- address: orderer1.org1proxy.blockchaincloudpoc.com:443
+ #Eg. ordererAddress: orderer1.test.yourdomain.com:443
+ ordererAddress: orderer1.supplychain-net:7050
diff --git a/platforms/hyperledger-fabric/charts/fabric-cli/.helmignore b/platforms/hyperledger-fabric/charts/fabric-cli/.helmignore
new file mode 100644
index 00000000000..014fa775608
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-cli/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+generated_config/
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-cli/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-cli/Chart.yaml
index 67b27977c0a..0bc0fd2ec8b 100644
--- a/platforms/hyperledger-fabric/charts/fabric-cli/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-cli/Chart.yaml
@@ -5,7 +5,23 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Deploys Fabric Cli."
name: fabric-cli
-version: 1.0.0
+description: "Hyperledger Fabric: Deploys Fabric CLI"
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
+
diff --git a/platforms/hyperledger-fabric/charts/fabric-cli/README.md b/platforms/hyperledger-fabric/charts/fabric-cli/README.md
index 3741f56ee44..dac4d8572fd 100644
--- a/platforms/hyperledger-fabric/charts/fabric-cli/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-cli/README.md
@@ -3,175 +3,101 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# Fabric Cli Hyperledger Fabric Deployment
+# fabric-cli
-- [Fabric Cli Hyperledger Fabric Deployment Helm Chart](#fabric-cli-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-cli chart deploys a Fabric CLI attached to a Peer node to the Kubernetes cluster. This chart is a dependency and is deployed by the [fabric-peernode](../fabric-peernode/README.md) chart. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## Fabric Cli Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-cli) for Fabric Cli.
-
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
-
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-fabric-cli/
- |- templates/
- |- _helpers.yaml
- |- deployment.yaml
- |- volume.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install peer0-cli bevel/fabric-cli
```
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `deployment.yaml`: The certificates-init retrieves TLS certificates and cryptographic materials from HashiCorp Vault, ensuring secure communication. The cli runs Hyperledger Fabric CLI tools, using the fetched certificates for secure interaction with the network.
-- `volume.yaml`: Requests storage resources for the cli container
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-cli/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-### Metadata
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------------------------------------------| --------------------------------------------------|
-| namespace | Namespace for organization's peer deployment | org1-net |
-| images.fabrictools | Valid image name and version for fabric tools |ghcr.io/hyperledger/bevel-fabric-tools:2.2.2 |
-| images.alpineutils | Valid image name and version to read certificates from vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-
-### Storage
-
-| Name | Description | Default Value |
-| ------------| ----------------------| ---------------|
-| class | Storage class name | aws-storageclass |
-| size | Storage size | 256Mi |
-
-### Vault
-
-| Name | Description | Default Value |
-| ----------------------| ------------------------------------------------------------------| -------------------------------|
-| role | Vault role for the organization | vault-role |
-| address | Vault server address | "" |
-| authpath | Kubernetes auth backend configured in Vault for the organization | devorg1-net-auth |
-| adminsecretprefix | Vault secret prefix for admin | secretsv2/data/crypto/peerOrganizations/org1-net/users/admin |
-| orderersecretprefix | Vault secret prefix for orderer | secretsv2/data/crypto/peerOrganizations/org1-net/orderer |
-| serviceaccountname | Service account name for Vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Image secret name for Vault | "" |
-| tls | TLS status for Vault communication | "" |
-
-### Peer Configuration
-
-| Name | Description | Default Value |
-| --------------| --------------------------------------------| -----------------------------|
-| name | Name of the peer as per deployment YAML | peer0 |
-| localmspid | Local MSP ID for the organization's peer | Org1MSP |
-| tlsstatus | TLS status for the organization's peer | true |
-| address | Address for the peer | peer0.org1-net:7051 |
-
-### Orderer Configuration
-
-| Name | Description | Default Value |
-| ------------| -------------------------| -----------------------------|
-| address | Address for the orderer | orderer1.org1proxy.blockchaincloudpoc.com:443 |
-
-
-
-## Deployment
----
-
-To deploy the fabric-cli Helm chart, follow these steps:
+## Prerequisites
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-cli/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-cli
- ```
-Replace `` with the desired name for the release.
+- Kubernetes 1.19+
+- Helm 3.2.0+
-This will deploy the fabric-cli node to the Kubernetes cluster based on the provided configurations.
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
+## Installing the Chart
-
-## Verification
----
+To install the chart with the release name `peer0-cli`:
-To verify the deployment, we can use the following command:
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install peer0-cli bevel/fabric-cli
```
-$ kubectl get deployments -n
-```
-Replace `` with the actual namespace where the deployment was created. The command will display information about the deployment, including the number of replicas and their current status.
-
-
-## Updating the Deployment
----
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-cli/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-cli
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-cli node is up to date.
+> **Tip**: List all releases using `helm list`
+## Uninstalling the Chart
-
-## Deletion
----
+To uninstall/delete the `peer0-cli` deployment:
-To delete the deployment and associated resources, run the following Helm command:
+```bash
+helm uninstall peer0-cli
```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
-
-
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Fabric Cli Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-cli), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.version` | Fabric Version. | `2.5.4` |
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `false` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.fabricTools` | Fabric Tools image repository | `ghcr.io/hyperledger/bevel-fabric-tools` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
+
+### Configuration
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `peerName` | Name of the Peer that this CLI will connect. Leave empty when created using `fabric-peernode` chart | `""` |
+| `storageClass` | Storage Class for the cli, Storage Class should be already created by `fabric-peernode` chart. Pass existing storage class for independent CLI creation | `""` |
+| `storageSize` | PVC Storage Size for the cli | `256Mi` |
+| `localMspId` | Local MSP ID of the organization| `supplychainMSP` |
+| `tlsStatus` | TLS status of the peer | `true` |
+| `ports.grpc.clusterIpPort` | GRPC Internal Port for Peer | `7051` |
+| `ordererAddress` | Orderer Internal or External Address with port for CLI to connect | `orderer1.supplychain-net:7050` |
+| `healthCheck.retries` | Retry count to connect to the Peer | `20` |
+| `healthCheck.sleepTimeAfterError` | Wait seconds after unsuccessful connection attempt | `15` |
+
+### Labels
+
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `labels.service` | Array of Labels for service object | `[]` |
+| `labels.pvc` | Array of Labels for PVC object | `[]` |
+| `labels.deployment` | Array of Labels for deployment or statefulset object | `[]` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-cli/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-cli/templates/_helpers.tpl
index d43c09d8cef..6c628b76553 100644
--- a/platforms/hyperledger-fabric/charts/fabric-cli/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-cli/templates/_helpers.tpl
@@ -1,5 +1,75 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-cli.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-cli.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- printf "%s-cli" .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-cli.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create orderer tls configmap name depending on Configmap existance
+*/}}
+{{- define "fabric-cli.orderercrt" -}}
+{{- $secret := lookup "v1" "ConfigMap" .Release.Namespace "orderer-tls-cacert" -}}
+{{- if $secret -}}
+{{/*
+ Use this configmap
+*/}}
+{{- printf "orderer-tls-cacert" -}}
+{{- else -}}
+{{/*
+ Use the release configmap
+*/}}
+{{- printf "%s-orderer-tls-cacert" .Release.Name -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Peer name can be passed by Values or by Parent chart release name
+*/}}
+{{- define "fabric-cli.peername" -}}
+{{- if .Values.peerName -}}
+{{- printf .Values.peerName -}}
+{{- else -}}
+{{- printf .Release.Name -}}
+{{- end -}}
+{{- end -}}
+
+{{- define "labels.deployment" -}}
+{{- range $value := .Values.labels.deployment }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.service" -}}
+{{- range $value := .Values.labels.service }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.pvc" -}}
+{{- range $value := .Values.labels.pvc }}
+{{ toYaml $value }}
+{{- end }}
{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-cli/templates/deployment.yaml b/platforms/hyperledger-fabric/charts/fabric-cli/templates/deployment.yaml
index f302063ccb3..5b73303d31a 100644
--- a/platforms/hyperledger-fabric/charts/fabric-cli/templates/deployment.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-cli/templates/deployment.yaml
@@ -7,31 +7,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: {{ .Values.peer.name }}-cli
- namespace: {{ .Values.metadata.namespace }}
+ name: {{ template "fabric-cli.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app: cli
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ {{ include "labels.deployment" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: cli
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
template:
metadata:
labels:
app: cli
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ {{ include "labels.deployment" . | nindent 8 }}
spec:
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
+ - name: {{ .Values.image.pullSecret }}
{{- end }}
volumes:
- - name: {{ .Values.peer.name }}-cli-pv
+ - name: {{ .Release.Name }}-cli-pv
persistentVolumeClaim:
- claimName: {{ .Values.peer.name }}-cli-pvc
- {{ if .Values.vault.tls }}
+ claimName: {{ .Release.Name }}-cli-pvc
+ {{ if .Values.global.vault.tls }}
- name: vaultca
secret:
- secretName: {{ $.Values.vault.tls }}
+ secretName: {{ .Values.global.vault.tls }}
items:
- key: ca.crt.pem
path: ca-certificates.crt
@@ -42,69 +52,129 @@ spec:
- name: scripts-volume
configMap:
name: bevel-vault-script
+ - name: package-manager
+ configMap:
+ name: package-manager
+ - name: orderer-tls-cacert
+ configMap:
+ name: {{ include "fabric-cli.orderercrt" . }}
+ defaultMode: 0775
+ items:
+ - key: cacert
+ path: orderer.crt
initContainers:
- name: certificates-init
- image: {{ $.Values.metadata.images.alpineutils }}
+ image: {{ .Values.image.alpineUtils }}
imagePullPolicy: IfNotPresent
env:
- name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
+ value: {{ .Values.global.vault.address }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
- name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
+ value: {{ .Values.global.vault.authPath }}
- name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: VAULT_PEER_SECRET_PREFIX
- value: "{{ $.Values.vault.adminsecretprefix }}"
- - name: VAULT_ORDERER_SECRET_PREFIX
- value: "{{ $.Values.vault.orderersecretprefix }}"
+ value: {{ .Values.global.vault.role }}
- name: MOUNT_PATH
value: "/secret"
- name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
+ value: "{{ .Values.global.vault.type }}"
+ - name: CORE_PEER_ADDRESS
+ value: "{{ include "fabric-cli.peername" . }}.{{ .Release.Namespace }}:{{ .Values.ports.grpc.clusterIpPort }}"
command: ["sh", "-c"]
args:
- |-
#!/usr/bin/env sh
. /scripts/bevel-vault.sh
+{{- if eq .Values.global.vault.type "hashicorp" }}
+
# Calling a function to retrieve the vault token.
vaultBevelFunc "init"
+ function getAdminMspSecret {
+ KEY=$1
+
+ echo "Getting MSP certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${KEY}"
+ if [ "$SECRETS_AVAILABLE" == "yes" ]
+ then
+ ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
+ CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
+ KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
+ SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
+ TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ ADMIN_MSP_SECRET=true
+ else
+ ADMIN_MSP_SECRET=false
+ fi
+ }
+
+{{- else }}
+
+ function getAdminMspSecret {
+ KEY=$1
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ ADMIN_MSP_SECRET=false
+ else
+ ADMINCERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacerts' | base64 -d)
+ KEYSTORE=$(echo ${KUBENETES_SECRET} | jq -r '.data.keystore' | base64 -d)
+ SIGNCERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.signcerts' | base64 -d)
+ TLSCACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.tlscacerts' | base64 -d)
- echo "Getting Orderer TLS certificates from Vault using key $vault_secret_key"
- vaultBevelFunc "readJson" "${VAULT_ORDERER_SECRET_PREFIX}/tls"
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ ADMIN_MSP_SECRET=true
+ fi
+ }
- TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca.crt"]')
- OUTPUT_PATH="${MOUNT_PATH}/orderer/tls"
- mkdir -p ${OUTPUT_PATH}
- echo "${TLS_CA_CERT}" >> ${OUTPUT_PATH}/ca.crt
+{{- end }}
- ###############################################################################
+ COUNTER=1
+ while [ "$COUNTER" -le {{ .Values.healthCheck.retries }} ]
+ do
- echo "Getting MSP certificates from Vault using key $vault_secret_key"
- vaultBevelFunc "readJson" "${VAULT_PEER_SECRET_PREFIX}/msp"
+ OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
+ mkdir -p ${OUTPUT_PATH}/admincerts
+ mkdir -p ${OUTPUT_PATH}/cacerts
+ mkdir -p ${OUTPUT_PATH}/keystore
+ mkdir -p ${OUTPUT_PATH}/signcerts
+ mkdir -p ${OUTPUT_PATH}/tlscacerts
+ getAdminMspSecret admin-msp
- ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
- CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
- KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
- SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
- TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+ if [ "$ADMIN_MSP_SECRET" = "true" ]
+ then
+ echo "Peer certificates have been obtained correctly"
+ break
+ else
+ echo "Peer certificates have not been obtained, sleeping for {{ .Values.healthCheck.sleepTimeAfterError }}"
+ sleep {{ .Values.healthCheck.sleepTimeAfterError }}
+ COUNTER=`expr "$COUNTER" + 1`
+ fi
+ done
- OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
- mkdir -p ${OUTPUT_PATH}/admincerts
- mkdir -p ${OUTPUT_PATH}/cacerts
- mkdir -p ${OUTPUT_PATH}/keystore
- mkdir -p ${OUTPUT_PATH}/signcerts
- mkdir -p ${OUTPUT_PATH}/tlscacerts
+ if [ "$COUNTER" -gt {{ .Values.healthCheck.retries }} ]
+ then
+ echo "Retry attempted `expr $COUNTER - 1` times, The peer certificates have not been obtained."
+ exit 1
+ fi
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
volumeMounts:
- name: certificates
mountPath: /secret
- {{ if .Values.vault.tls }}
+ {{ if .Values.global.vault.tls }}
- name: vaultca
mountPath: "/etc/ssl/certs/"
readOnly: true
@@ -112,9 +182,12 @@ spec:
- name: scripts-volume
mountPath: /scripts/bevel-vault.sh
subPath: bevel-vault.sh
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
containers:
- name: cli
- image: {{ $.Values.metadata.images.fabrictools }}
+ image: {{ .Values.image.fabricTools }}:{{ .Values.global.version }}
imagePullPolicy: IfNotPresent
stdin: true
tty: true
@@ -126,23 +199,29 @@ spec:
- name: FABRIC_LOGGING_SPEC
value: "debug"
- name: CORE_PEER_ID
- value: "{{ .Values.peer.name }}.{{ .Values.metadata.namespace }}"
+ value: "{{ include "fabric-cli.peername" . }}.{{ .Release.Namespace }}"
- name: CORE_PEER_ADDRESS
- value: "{{ .Values.peer.address }}"
+ value: "{{ include "fabric-cli.peername" . }}.{{ .Release.Namespace }}:{{ .Values.ports.grpc.clusterIpPort }}"
- name: CORE_PEER_LOCALMSPID
- value: "{{ .Values.peer.localmspid }}"
+ value: "{{ .Values.localMspId }}"
- name: CORE_PEER_TLS_ENABLED
- value: "{{ .Values.peer.tlsstatus }}"
+ value: "{{ .Values.tlsStatus }}"
- name: CORE_PEER_TLS_ROOTCERT_FILE
value: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp/tlscacerts/tlsca.crt
- name: ORDERER_CA
- value: /opt/gopath/src/github.com/hyperledger/fabric/crypto/orderer/tls/ca.crt
+ value: /opt/gopath/src/github.com/hyperledger/fabric/orderer/tls/orderer.crt
- name: ORDERER_URL
- value: "{{ .Values.orderer.address }}"
+ value: "{{ .Values.ordererAddress }}"
- name: CORE_PEER_MSPCONFIGPATH
value: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp
volumeMounts:
- name: certificates
mountPath: /opt/gopath/src/github.com/hyperledger/fabric/crypto
- - name: {{ .Values.peer.name }}-cli-pv
+ - name: {{ .Release.Name }}-cli-pv
mountPath: /opt/gopath/src/github.com/chaincode
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
+ - name: orderer-tls-cacert
+ mountPath: /opt/gopath/src/github.com/hyperledger/fabric/orderer/tls/orderer.crt
+ subPath: orderer.crt
diff --git a/platforms/hyperledger-fabric/charts/fabric-cli/templates/volume.yaml b/platforms/hyperledger-fabric/charts/fabric-cli/templates/volume.yaml
index 8afd2d3e6c7..b22d5c5fa10 100644
--- a/platforms/hyperledger-fabric/charts/fabric-cli/templates/volume.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-cli/templates/volume.yaml
@@ -8,12 +8,18 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
- name: {{ $.Values.peer.name }}-cli-pvc
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-cli-pvc
+ namespace: {{ .Release.Namespace }}
+ labels:
+ {{ include "labels.pvc" . | nindent 4 }}
spec:
- storageClassName: {{ $.Values.storage.class }}
+ {{- if .Values.storageClass }}
+ storageClassName: {{ .Values.storageClass }}
+ {{- else }}
+ storageClassName: storage-{{ .Release.Name }}
+ {{- end }}
accessModes:
- ReadWriteOnce
resources:
requests:
- storage: {{ $.Values.storage.size }}
+ storage: {{ .Values.storageSize }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-cli/values.yaml b/platforms/hyperledger-fabric/charts/fabric-cli/values.yaml
index 15a12e758f3..92a319a1ba7 100644
--- a/platforms/hyperledger-fabric/charts/fabric-cli/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-cli/values.yaml
@@ -6,71 +6,74 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
+global:
+ # HLF Network Version
+ #Eg. version: 2.5.4
+ version: 2.5.4
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
+ #Kuberenetes secret for vault ca.cert
+ #Enable or disable TLS for vault communication if value present or not
+ #Eg. tls: vaultca
+ tls:
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: org1-net
- namespace: org1-net
- images:
- #Provide the valid image name and version for fabric tools
- #Eg. fabrictools: hyperledger/fabric-tools:1.4.0
- fabrictools: ghcr.io/hyperledger/bevel-fabric-tools:2.2.2
- #Provide the valid image name and version to read certificates from vault server
- #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
+image:
+ #Provide the valid image repository for fabric tools
+ #Eg. fabricTools: hyperledger/fabric-tools
+ fabricTools: ghcr.io/hyperledger/bevel-fabric-tools
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg.alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
-storage:
- #Provide the storageclassname
- class: aws-storageclass
- #Provide the storagesize
- size: 256Mi
+#Provide the peer name this CLI will connect to. Keep empty for creation via peernode dependency
+peerName:
+#Provide the StorageClass for CLI PVC
+storageClass:
+#Provide the size for CLI PVC
+storageSize: 256Mi
+#Provide the localMspId for organization
+#Eg. localMspId: supplychainMSP
+localMspId: supplychainMSP
+#Provide the value for tlsStatus to be true or false for organization's peer
+#Eg. tlsStatus: true
+tlsStatus: true
+ports:
+ grpc:
+ #Provide a cluster IP port for grpc service to be exposed
+ #Eg. clusterIpPort: 7051
+ clusterIpPort: 7051
+#Provide the address for orderer
+#Eg. ordererAddress: orderer1.supplychain-net:7050
+ordererAddress: orderer1.supplychain-net:7050
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: fra-demo-hlkube-cluster-org1
- authpath: devorg1-net-auth
- #Provide the value for vault secretprefix
- #Eg. adminsecretprefix: secretsv2/data/crypto/peerOrganizations/.../users/admin
- adminsecretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/users/admin
- #Provide the value for vault secretprefix
- #Eg. orderersecretprefix: secretsv2/data/crypto/peerOrganizations/.../orderer
- orderersecretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/orderer
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Kuberenetes secret for vault ca.cert
- #Enable or disable TLS for vault communication if value present or not
- #Eg. tls: vaultca
- tls:
+healthCheck:
+ retries: 20
+ sleepTimeAfterError: 15
-
-peer:
- #Provide the name of the peer as per deployment yaml.
- #Eg. name: peer0
- name: peer0
- #Provide the localmspid for organization
- #Eg. localmspid: Org1MSP
- localmspid: Org1MSP
- #Provide the value for tlsstatus to be true or false for organization's peer
- #Eg. tlsstatus: true
- tlsstatus: true
- #Provide the address for the peer
- #Eg: address: peer0.org1-net:7051
- address: peer0.org1-net:7051
-
-orderer:
- #Provide the address for orderer
- #Eg. address: orderer1.org1proxy.blockchaincloudpoc.com:443
- address: orderer1.org1proxy.blockchaincloudpoc.com:443
+labels:
+ service: []
+ pvc: []
+ deployment: []
diff --git a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/_helpers.tpl
index 7bf5f530a8e..390a404650d 100644
--- a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/_helpers.tpl
@@ -2,4 +2,34 @@
{{ range $key, $val := $.Values.metadata.labels }}
{{ $key }}: {{ $val }}
{{ end }}
+{{- end }}
+
+{{- define "labels.deployment" -}}
+{{- if $.Values.labels }}
+{{- range $key, $value := $.Values.labels.deployment }}
+{{- range $k, $v := $value }}
+ {{ $k }}: {{ $v | quote }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.service" -}}
+{{- if $.Values.labels }}
+{{- range $key, $value := $.Values.labels.service }}
+{{- range $k, $v := $value }}
+ {{ $k }}: {{ $v | quote }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.pvc" -}}
+{{- if $.Values.labels }}
+{{- range $key, $value := $.Values.labels.pvc }}
+{{- range $k, $v := $value }}
+ {{ $k }}: {{ $v | quote }}
+{{- end }}
+{{- end }}
+{{- end }}
{{- end }}
\ No newline at end of file
diff --git a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/deployment.yaml b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/deployment.yaml
index ef7c0d9f9a1..bf44cac9996 100644
--- a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/deployment.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/deployment.yaml
@@ -17,6 +17,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "labels.custom" . | nindent 2 }}
+ {{- include "labels.deployment" . | nindent 2 }}
spec:
replicas: 1
selector:
@@ -32,6 +33,7 @@ spec:
app.kubernetes.io/name: cc-{{ $.Values.chaincode.name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ {{- include "labels.deployment" . | nindent 6 }}
spec:
serviceAccountName: {{ $.Values.vault.serviceaccountname }}
{{- if .Values.vault.imagesecretname }}
@@ -108,7 +110,7 @@ spec:
- name: scripts-volume
mountPath: /scripts/bevel-vault.sh
subPath: bevel-vault.sh
- {{ end }}
+ {{ end }}
containers:
- image: {{ $.Values.metadata.images.external_chaincode }}
name: "{{ $.Values.chaincode.name }}-{{ $.Values.chaincode.version }}"
diff --git a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/service.yaml b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/service.yaml
index 631fe5e0548..763b5798988 100644
--- a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/service.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/templates/service.yaml
@@ -17,6 +17,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "labels.custom" . | nindent 2 }}
+ {{- include "labels.service" . | nindent 2 }}
spec:
type: {{ $.Values.service.servicetype }}
selector:
diff --git a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/values.yaml b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/values.yaml
index 14ebb45fbd2..ebc915097b3 100644
--- a/platforms/hyperledger-fabric/charts/fabric-external-chaincode/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-external-chaincode/values.yaml
@@ -74,3 +74,8 @@ service:
#Provide a cluster IP port for grpc service to be exposed
#Eg. clusteripport: 7051
clusteripport: 7052
+
+labels:
+ service: []
+ pvc: []
+ deployment: []
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/.helmignore b/platforms/hyperledger-fabric/charts/fabric-genesis/.helmignore
new file mode 100644
index 00000000000..014fa775608
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+generated_config/
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-genesis/Chart.yaml
new file mode 100644
index 00000000000..74d721a4785
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/Chart.yaml
@@ -0,0 +1,26 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+apiVersion: v1
+name: fabric-genesis
+description: "Hyperledger Fabric: Generates configtx and genesis files."
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/README.md b/platforms/hyperledger-fabric/charts/fabric-genesis/README.md
new file mode 100644
index 00000000000..86803bb2066
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/README.md
@@ -0,0 +1,150 @@
+[//]: # (##############################################################################################)
+[//]: # (Copyright Accenture. All Rights Reserved.)
+[//]: # (SPDX-License-Identifier: Apache-2.0)
+[//]: # (##############################################################################################)
+
+# fabric-genesis
+
+This chart is a component of Hyperledger Bevel. The fabric-genesis chart creates the genesis file and other channel artifacts for a Hyperfabric network. If enabled, the keys are then stored on the configured vault and stored as Kubernetes secrets. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+
+## TL;DR
+
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install genesis bevel/fabric-genesis
+```
+
+## Prerequisites
+
+- Kubernetes 1.19+
+- Helm 3.2.0+
+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
+
+The [Orderers](../fabric-orderernode/README.md) and [Peers](../fabric-peernode/README.md) should already be installed and this chart should generally be installed from the Orderer namespace as it has most of the admin permissions.
+
+After the peers have been installed, get certificates and the configuration file of each peer organization, place in `fabric-genesis/files`
+```bash
+cd ./fabric-genesis/files
+kubectl --namespace carrier-net get secret admin-msp -o json > carrier.json
+kubectl --namespace carrier-net get configmap peer0-msp-config -o json > carrier-config-file.json
+```
+
+If additional orderer(s) from a different organization is needed in genesis, then get that TLS cert and place in `fabric-genesis/files`
+```bash
+cd ./fabric-genesis/files
+kubectl --namespace carrier-net get secret orderer5-tls -o json > orderer5-orderer-tls.json
+```
+
+## Installing the Chart
+
+To install the chart with the release name `genesis`:
+
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install genesis bevel/fabric-genesis
+```
+
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
+
+> **Tip**: List all releases using `helm list`
+
+## Uninstalling the Chart
+
+To uninstall/delete the `genesis` deployment:
+
+```bash
+helm uninstall genesis
+```
+
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global parameters
+
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `global.version` | Fabric Version.| `2.5.4` |
+| `global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws` and `minikube` is tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.network` | Network type that is being deployed | `fabric` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.proxy.provider` | The proxy or Ingress provider. Can be `none` or `haproxy` | `haproxy` |
+| `global.proxy.externalUrlSuffix` | The External URL suffix at which the Fabric services will be available | `test.blockchaincloudpoc.com` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.fabricTools` | Fabric Tools image repository | `ghcr.io/hyperledger/bevel-fabric-tools` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
+
+### Organizations
+
+List of Organizations participating in the Network with their Peer and Orderer Addresses.
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `organizations.name` | Organization Name | `supplychain` |
+| `organizations.orderers` | List of organization's orderer nodes and their addresses. This list presents two fields `orderer.name` and `orderer.ordererAddress` | `- name: orderer1`
`ordererAddress: orderer1.supplychain-net:7050`
`- name: orderer2`
`ordererAddress: orderer2.supplychain-net:7050`
`- name: orderer3`
`ordererAddress: orderer3.supplychain-net:7050` |
+| `organizations.peers` | List of the organization's peer nodes and their addresses. This list presents two fields `peer.name` and `peer.peerAddress` | `- name: peer0`
`peerAddress: peer0.supplychain-net:7051`
`- name: peer1`
`peerAddress: peer1.supplychain-net:7051` |
+
+### Consensus
+
+| Name | Description | Default Value |
+| ---------| ----------------------------| ----------------|
+| `consensus` | Name of the consensus | `raft` |
+| `kafka.brokers` | Array of Kafka broker Addresses, only valid for `kafka` consensus | `""` |
+
+
+### Channels
+List of Channels you want to create the artifacts for.
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `channels.name` | Name of the channel | `allchannel` |
+| `channels.consortium`| Consortium Name | `SupplyChainConsortium` |
+| `channels.orderers` | List of orderer type organizations (from the list above) on the network | `- supplychain` |
+| `channels.participants` | List of participating channel organizations (from the list above) on the network | `- supplychain`
`- carrier` |
+
+
+### Settings
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `settings.generateGenesis` | Flag to generate the syschannel genesis for Fabric 2.2.x | `true` |
+| `settings.removeConfigMapOnDelete` | Flag to delete the genesis ConfigMap when uninstalling the release | `true` |
+
+## License
+
+This chart is licensed under the Apache v2.0 license.
+
+Copyright © 2024 Accenture
+
+### Attribution
+
+This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
+
+```
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+```
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/files/configtx_2_2.tpl b/platforms/hyperledger-fabric/charts/fabric-genesis/files/configtx_2_2.tpl
new file mode 100644
index 00000000000..f83c950fd5c
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/files/configtx_2_2.tpl
@@ -0,0 +1,154 @@
+# Configtx template for Fabric 2.2.x
+Organizations:
+{{- range $org := $.Values.organizations }}
+ - &{{ $org.name }}Org
+ Name: {{ $org.name }}MSP
+ ID: {{ $org.name }}MSP
+ MSPDir: ./crypto-config/organizations/{{ $org.name }}/msp
+ Policies:
+ Readers:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.member')"
+ Writers:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.member')"
+ Admins:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.admin')"
+ Endorsement:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.member')"
+ {{- if $org.orderers }}
+ OrdererEndpoints:
+ {{- range $orderer := $org.orderers }}
+ - {{ $orderer.ordererAddress }}
+ {{- end }}
+ {{- end }}
+ AnchorPeers:
+ {{- range $peer := $org.peers }}
+ {{- $split := split ":" $peer.peerAddress }}
+ - Host: {{ $split._0 }}
+ Port: {{ $split._1 }}
+ {{- end }}
+ {{- printf "\n" }}
+{{- end }}
+
+Capabilities:
+ Channel: &ChannelCapabilities
+ V2_0: true
+ Orderer: &OrdererCapabilities
+ V2_0: true
+ Application: &ApplicationCapabilities
+ V2_0: true
+
+Application: &ApplicationDefaults
+ Organizations:
+ Policies:
+ LifecycleEndorsement:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Endorsement"
+ Endorsement:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Endorsement"
+ Readers:
+ Type: ImplicitMeta
+ Rule: "ANY Readers"
+ Writers:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+ Admins:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Admins"
+ Capabilities:
+ <<: *ApplicationCapabilities
+
+Channel: &ChannelDefaults
+ Policies:
+ Readers:
+ Type: ImplicitMeta
+ Rule: "ANY Readers"
+ Writers:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+ Admins:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Admins"
+ Capabilities:
+ <<: *ChannelCapabilities
+
+Orderer: &OrdererDefaults
+{{- if eq $.Values.consensus "raft" }}
+ OrdererType: etcdraft
+ EtcdRaft:
+ Consenters:
+ {{- range $org := $.Values.organizations }}
+ {{- range $orderer := $org.orderers }}
+ {{- $split := split ":" $orderer.ordererAddress }}
+ - Host: {{ $split._0 }}
+ Port: {{ $split._1 }}
+ ClientTLSCert: ./crypto-config/organizations/{{ $org.name }}/orderers/{{ $orderer.name }}/tls/server.crt
+ ServerTLSCert: ./crypto-config/organizations/{{ $org.name }}/orderers/{{ $orderer.name }}/tls/server.crt
+ {{- end }}
+ {{- end }}
+{{- end }}
+ BatchTimeout: 2s
+ BatchSize:
+ MaxMessageCount: 10
+ AbsoluteMaxBytes: 98 MB
+ PreferredMaxBytes: 1024 KB
+{{- if eq $.Values.consensus "kafka" }}
+ OrdererType: {{ $.Values.consensus }}
+ Kafka:
+ Brokers:
+ {{- range $.Values.kafka.brokers }}
+ - {{ . }}
+ {{- end }}
+{{- end }}
+ Organizations:
+ Policies:
+ Readers:
+ Type: ImplicitMeta
+ Rule: "ANY Readers"
+ Writers:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+ Admins:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Admins"
+ BlockValidation:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+
+Profiles:
+ OrdererGenesis:
+ <<: *ChannelDefaults
+ {{- with (first $.Values.channels) }}
+ Orderer:
+ <<: *OrdererDefaults
+ Organizations:
+ {{- range $org := .orderers }}
+ - *{{ $org }}Org
+ {{- end }}
+ Capabilities:
+ <<: *OrdererCapabilities
+ Consortiums:
+ {{ .consortium }}:
+ Organizations:
+ {{- range $org := .participants }}
+ - *{{ $org }}Org
+ {{- end }}
+ {{- end }}
+{{- range $channel := $.Values.channels }}
+ {{ $channel.name }}:
+ Consortium: {{ $channel.consortium }}
+ <<: *ChannelDefaults
+ Application:
+ <<: *ApplicationDefaults
+ Organizations:
+ {{- range $org := $channel.participants }}
+ - *{{ $org }}Org
+ {{- end }}
+ Capabilities:
+ <<: *ApplicationCapabilities
+ {{- printf "\n" }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/files/configtx_2_5.tpl b/platforms/hyperledger-fabric/charts/fabric-genesis/files/configtx_2_5.tpl
new file mode 100644
index 00000000000..c312a4d1c45
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/files/configtx_2_5.tpl
@@ -0,0 +1,127 @@
+# Configtx template for Fabric 2.5.x
+Organizations:
+{{- range $org := $.Values.organizations }}
+ - &{{ $org.name }}Org
+ Name: {{ $org.name }}MSP
+ ID: {{ $org.name }}MSP
+ MSPDir: ./crypto-config/organizations/{{ $org.name }}/msp
+ Policies:
+ Readers:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.member')"
+ Writers:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.member')"
+ Admins:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.admin')"
+ Endorsement:
+ Type: Signature
+ Rule: "OR('{{ $org.name }}MSP.member')"
+ {{- if $org.orderers }}
+ OrdererEndpoints:
+ {{- range $orderer := $org.orderers }}
+ - {{ $orderer.ordererAddress }}
+ {{- end }}
+ {{- end }}
+ {{- printf "\n" }}
+{{- end }}
+
+Capabilities:
+ Channel: &ChannelCapabilities
+ V2_0: true
+ Orderer: &OrdererCapabilities
+ V2_0: true
+ Application: &ApplicationCapabilities
+ V2_5: true
+
+Application: &ApplicationDefaults
+ Organizations:
+ Policies:
+ LifecycleEndorsement:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Endorsement"
+ Endorsement:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Endorsement"
+ Readers:
+ Type: ImplicitMeta
+ Rule: "ANY Readers"
+ Writers:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+ Admins:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Admins"
+ Capabilities:
+ <<: *ApplicationCapabilities
+
+Channel: &ChannelDefaults
+ Policies:
+ Readers:
+ Type: ImplicitMeta
+ Rule: "ANY Readers"
+ Writers:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+ Admins:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Admins"
+ Capabilities:
+ <<: *ChannelCapabilities
+
+Orderer: &OrdererDefaults
+ BatchTimeout: 2s
+ BatchSize:
+ MaxMessageCount: 10
+ AbsoluteMaxBytes: 98 MB
+ PreferredMaxBytes: 1024 KB
+ Organizations:
+ Policies:
+ Readers:
+ Type: ImplicitMeta
+ Rule: "ANY Readers"
+ Writers:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+ Admins:
+ Type: ImplicitMeta
+ Rule: "MAJORITY Admins"
+ BlockValidation:
+ Type: ImplicitMeta
+ Rule: "ANY Writers"
+
+Profiles:
+{{- range $channel := $.Values.channels }}
+ {{ $channel.name }}:
+ <<: *ChannelDefaults
+ {{- if eq $.Values.consensus "raft" }}
+ Orderer:
+ <<: *OrdererDefaults
+ OrdererType: etcdraft
+ EtcdRaft:
+ Consenters:
+ {{- range $org := $.Values.organizations }}
+ {{- range $orderer := $org.orderers }}
+ {{- $split := split ":" $orderer.ordererAddress }}
+ - Host: {{ $split._0 }}
+ Port: {{ $split._1 }}
+ ClientTLSCert: ./crypto-config/organizations/{{ $org.name }}/orderers/{{ $orderer.name }}/tls/server.crt
+ ServerTLSCert: ./crypto-config/organizations/{{ $org.name }}/orderers/{{ $orderer.name }}/tls/server.crt
+ {{- end }}
+ {{- end }}
+ Organizations:
+ {{- range $orderer := $channel.orderers }}
+ - *{{ $orderer }}Org
+ {{- end }}
+ Capabilities: *OrdererCapabilities
+ {{- end }}
+ Application:
+ <<: *ApplicationDefaults
+ Organizations:
+ {{- range $org := $channel.participants }}
+ - *{{ $org }}Org
+ {{- end }}
+ Capabilities: *ApplicationCapabilities
+ {{- printf "\n" }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/_helpers.tpl
new file mode 100644
index 00000000000..94a126b4377
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/_helpers.tpl
@@ -0,0 +1,28 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-genesis.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-genesis.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-genesis.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/configmap.yaml
new file mode 100644
index 00000000000..9975157e676
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/configmap.yaml
@@ -0,0 +1,59 @@
+ ##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ .Release.Name }}-configtx-yaml
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/name: configtx-yaml
+ app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/part-of: {{ include "fabric-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+data:
+ configtx.yaml: |-
+{{- if eq ($.Values.global.version | trunc 3) "2.5" }}
+ {{ tpl (.Files.Get "files/configtx_2_5.tpl") . | nindent 8 }}
+{{- else }}
+ {{ tpl (.Files.Get "files/configtx_2_2.tpl") . | nindent 8 }}
+{{- end }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ .Release.Name }}-admin-msp-certs
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/name: admin-msp-certs
+ app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/part-of: {{ include "fabric-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+data:
+{{- range $org := .Values.organizations }}
+{{- $file := $.Files.Get (printf "files/%s.json" $org.name) }}
+{{- if $file }}
+ {{ $org.name }}.json: |-
+ {{ $.Files.Get (printf "files/%s.json" $org.name) | nindent 4 }}
+{{- end }}
+{{- $file := $.Files.Get (printf "files/%s-config-file.json" $org.name) }}
+{{- if $file }}
+ {{ $org.name }}-config-file.json: |-
+ {{ $.Files.Get (printf "files/%s-config-file.json" $org.name) | nindent 4 }}
+{{- end }}
+{{- range $orderer := $org.orderers }}
+{{- $ordfile := $.Files.Get (printf "files/%s-orderer-tls.json" $orderer.name) }}
+{{- if $ordfile }}
+ {{ $orderer.name }}-orderer-tls.json: |-
+ {{ $.Files.Get (printf "files/%s-orderer-tls.json" $orderer.name) | nindent 4 }}
+{{- end }}
+{{- end }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/templates/genesis-job-cleanup.yaml b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/genesis-job-cleanup.yaml
new file mode 100644
index 00000000000..aa02bbd789c
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/genesis-job-cleanup.yaml
@@ -0,0 +1,68 @@
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ .Release.Name }}-cleanup
+ labels:
+ app.kubernetes.io/name: {{ .Release.Name }}-cleanup
+ app.kubernetes.io/component: genesis-job-cleanup
+ app.kubernetes.io/part-of: {{ include "fabric-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/managed-by: helm
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-weight: "0"
+ helm.sh/hook: "pre-delete"
+ helm.sh/hook-delete-policy: "hook-succeeded"
+spec:
+ backoffLimit: 3
+ completions: 1
+ template:
+ metadata:
+ labels:
+ app.kubernetes.io/name: {{ .Release.Name }}-cleanup
+ app.kubernetes.io/component: genesis-job-cleanup
+ app.kubernetes.io/part-of: {{ include "fabric-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ restartPolicy: "Never"
+ containers:
+ - name: delete-secrets
+ image: "{{ .Values.image.alpineUtils }}"
+ securityContext:
+ runAsUser: 0
+ imagePullPolicy: IfNotPresent
+ env:
+ command: ["sh", "-c"]
+ args:
+ - |-
+{{- if .Values.settings.removeConfigMapOnDelete }}
+ {{- range $channel := $.Values.channels }}
+ if kubectl get configmap --namespace {{ $.Release.Namespace }} {{ $channel.name }}-genesis &> /dev/null; then
+ echo "Deleting genesis-file configmap in k8s ..."
+ kubectl delete configmap --namespace {{ $.Release.Namespace }} {{ $channel.name }}-genesis
+ fi
+ if kubectl get configmap --namespace {{ $.Release.Namespace }} syschannel-genesis &> /dev/null; then
+ echo "Deleting genesis-file configmap in k8s ..."
+ kubectl delete configmap --namespace {{ $.Release.Namespace }} syschannel-genesis
+ fi
+ if kubectl get configmap --namespace {{ $.Release.Namespace }} {{ $channel.name }}-channeltx &> /dev/null; then
+ echo "Deleting channeltx configmap in k8s ..."
+ kubectl delete configmap --namespace {{ $.Release.Namespace }} {{ $channel.name }}-channeltx
+ fi
+ {{- range $participant := $channel.participants }}
+ if kubectl get configmap --namespace {{ $.Release.Namespace }} {{ $channel.name }}-{{ $participant }}-anchortx &> /dev/null; then
+ echo "Deleting anchortx configmap in k8s ..."
+ kubectl delete configmap --namespace {{ $.Release.Namespace }} {{ $channel.name }}-{{ $participant }}-anchortx
+ fi
+ {{- end }}
+ {{- end }}
+{{- end}}
+
+
+
+
+
+
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/templates/job.yaml b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/job.yaml
new file mode 100644
index 00000000000..29e5e4e47aa
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/templates/job.yaml
@@ -0,0 +1,346 @@
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ .Release.Name }}-job
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-delete-policy: "before-hook-creation"
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}-job
+ app.kubernetes.io/component: fabric-genesis-job
+ app.kubernetes.io/part-of: {{ include "fabric-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+spec:
+ backoffLimit: 6
+ template:
+ metadata:
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}-job
+ app.kubernetes.io/component: fabric-genesis-job
+ app.kubernetes.io/part-of: {{ include "fabric-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ restartPolicy: OnFailure
+ imagePullSecrets:
+ {{- if .Values.image.pullSecret }}
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ volumes:
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ - name: package-manager
+ configMap:
+ name: package-manager
+ - name: configtx-file
+ configMap:
+ name: {{ .Release.Name }}-configtx-yaml
+ defaultMode: 0775
+ {{- range $org := $.Values.organizations }}
+ {{- $file := $.Files.Get (printf "files/%s.json" $org.name) }}
+ {{- if $file }}
+ - name: {{ $org.name }}-admin-msp
+ configMap:
+ name: {{ $.Release.Name }}-admin-msp-certs
+ items:
+ - key: {{ $org.name }}.json
+ path: {{ $org.name }}.json
+ {{- end }}
+ {{- $file := $.Files.Get (printf "files/%s-config-file.json" $org.name) }}
+ {{- if $file }}
+ - name: {{ $org.name }}-config-file
+ configMap:
+ name: {{ $.Release.Name }}-admin-msp-certs
+ items:
+ - key: {{ $org.name }}-config-file.json
+ path: {{ $org.name }}-config-file.json
+ {{- end }}
+ {{- range $orderer := $org.orderers }}
+ {{- $ordfile := $.Files.Get (printf "files/%s-orderer-tls.json" $orderer.name) }}
+ {{- if $ordfile }}
+ - name: {{ $orderer.name }}-tls-config
+ configMap:
+ name: {{ $.Release.Name }}-admin-msp-certs
+ items:
+ - key: {{ $orderer.name }}-orderer-tls.json
+ path: {{ $orderer.name }}-orderer-tls.json
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ - name: certificates
+ emptyDir:
+ medium: Memory
+ containers:
+ - name: "generate-artifacts"
+ image: {{ .Values.image.fabricTools }}:{{ .Values.global.version }}
+ imagePullPolicy: IfNotPresent
+ env:
+ - name: VAULT_ADDR
+ value: {{ $.Values.global.vault.address }}
+ - name: VAULT_APP_ROLE
+ value: {{ $.Values.global.vault.role }}
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ $.Values.global.vault.authPath }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: VAULT_TYPE
+ value: "{{ $.Values.global.vault.type }}"
+ - name: NETWORK_VERSION
+ value: "{{ $.Values.global.version }}"
+ - name: PROXY
+ value: {{ .Values.global.proxy.provider }}
+ - name: EXTERNAL_URL_SUFFIX
+ value: {{ .Values.global.proxy.externalUrlSuffix }}
+ - name: COMPONENT_NAME
+ value: {{ .Release.Namespace }}
+ command: ["bash", "-c"]
+ args:
+ - |-
+ #!/usr/bin/env sh
+ safeConfigmap () {
+ FOLDER_PATH=$1
+ NAME=$2
+ KEY=$3
+ kubectl get configmap --namespace ${COMPONENT_NAME} ${NAME}
+ if [ $? -ne 0 ]; then
+ kubectl create configmap --namespace ${COMPONENT_NAME} ${NAME} --from-file=${KEY}=$FOLDER_PATH
+ fi
+ }
+ . /scripts/package-manager.sh
+ # Define the packages to install
+ apt-get update --allow-releaseinfo-change
+ packages_to_install="jq curl wget"
+ install_packages "$packages_to_install"
+ # Download kubectl binary
+ curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.27.0/bin/linux/amd64/kubectl;
+ chmod u+x kubectl && mv kubectl /usr/local/bin/kubectl;
+
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . /scripts/bevel-vault.sh
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+
+ function getMSPCerts {
+ KEY=$1
+ path=$2
+ mkdir -p ${path}/msp/admincerts
+ mkdir -p ${path}/msp/cacerts
+ mkdir -p ${path}/msp/tlscacerts
+
+ echo "Getting TLS certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/users/${KEY}"
+
+ ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
+ CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
+ TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+
+ echo "${ADMINCERT}" > ${path}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem
+ echo "${TLSCACERTS}" > ${path}/msp/tlscacerts/ca.crt
+ echo "${CACERTS}" > ${path}/msp/cacerts/ca.crt
+ }
+
+ function getOrdererTLSCerts {
+ KEY=$1
+ path=$2
+ mkdir -p ${path}/orderers/${KEY}/tls
+ echo "Getting TLS certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/orderers/${KEY}-tls"
+
+ TLS_SERVER_CERT=$(echo ${VAULT_SECRET} | jq -r '.["server_crt"]')
+
+ echo "${TLS_SERVER_CERT}" > ${path}/orderers/${KEY}/tls/server.crt
+ }
+ function writeSafeSecret {
+ key=$1
+ file=$2
+ cat $file | base64 > ${key}.base64
+
+ vaultBevelFunc "init"
+ FILE_B64=$(cat ${key}.base64)
+
+ echo "
+ {
+ \"data\":
+ {
+ \"${key}_base64\": \"${FILE_B64}\"
+ }
+ }" > payload.json
+
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/channel-artifacts/${key}" 'payload.json'
+ rm payload.json
+
+ kubectl get configmap --namespace ${COMPONENT_NAME} ${key}
+ if [ $? -ne 0 ]; then
+ kubectl create configmap --namespace ${COMPONENT_NAME} ${key} --from-file=${key}_base64=${key}.base64
+ fi
+ }
+ {{- else }}
+ function getMSPCerts {
+ key=$1
+ path=$2
+ mkdir -p ${path}/msp/admincerts
+ mkdir -p ${path}/msp/cacerts
+ mkdir -p ${path}/msp/tlscacerts
+ KUBENETES_SECRET=$(kubectl get secret ${key} --namespace ${COMPONENT_NAME} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ echo "Certficates absent in kuberenetes secrets"
+ exit 1
+ else
+ ADMINCERT=$(echo "$KUBENETES_SECRET" | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo "$KUBENETES_SECRET" | jq -r '.data.cacerts' | base64 -d)
+ TLSCACERTS=$(echo "$KUBENETES_SECRET" | jq -r '.data.tlscacerts' | base64 -d)
+
+ echo "${ADMINCERT}" > ${path}/msp/admincerts/Admin@${COMPONENT_NAME}-cert.pem
+ echo "${TLSCACERTS}" > ${path}/msp/tlscacerts/ca.crt
+ echo "${CACERTS}" > ${path}/msp/cacerts/ca.crt
+
+ fi
+ }
+
+ function getOrdererTLSCerts {
+ key=$1
+ path=$2
+ mkdir -p ${path}/orderers/${key}/tls
+
+ KUBENETES_SECRET=$(kubectl get secret ${key}-tls --namespace ${COMPONENT_NAME} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ echo "Certficates absent in kuberenetes secrets"
+ exit 1
+ else
+ TLS_SERVER_CERT=$(echo "$KUBENETES_SECRET" | jq -r '.data.servercrt' | base64 -d)
+ echo "${TLS_SERVER_CERT}" > ${path}/orderers/${key}/tls/server.crt
+ fi
+ }
+
+ function writeSafeSecret {
+ key=$1
+ file=$2
+ cat $file | base64 > ${key}.base64
+
+ kubectl get configmap --namespace ${COMPONENT_NAME} ${key}
+ if [ $? -ne 0 ]; then
+ kubectl create configmap --namespace ${COMPONENT_NAME} ${key} --from-file=${key}_base64=${key}.base64
+ fi
+ }
+ {{- end }}
+
+ OUTPUT_PATH_PEER="/templates/crypto-config/organizations"
+ {{- range $org := $.Values.organizations }}
+ if [ -e /templates/{{ $org.name }}.json ]; then
+ # Read the admin-msp details from files for other orgs
+ ADMINCERTS=$(jq -r '.data.admincerts' /templates/{{ $org.name}}.json)
+ CACERTS=$(jq -r '.data.cacerts' /templates/{{ $org.name}}.json)
+ TLSCACERTS=$(jq -r '.data.tlscacerts' /templates/{{ $org.name}}.json)
+
+ mkdir -p ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/admincerts
+ mkdir -p ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/cacerts
+ mkdir -p ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/tlscacerts
+
+ echo "$ADMINCERTS" | base64 -d > ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/admincerts/Admin@{{ $org.name }}-net-cert.pem
+ echo "$TLSCACERTS" | base64 -d > ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/tlscacerts/ca.crt
+ echo "$CACERTS" | base64 -d > ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/cacerts/ca.crt
+ else
+ # Read the admin-msp details from k8s secrets for org that is executing the genesis
+ getMSPCerts admin-msp ${OUTPUT_PATH_PEER}/{{ $org.name }}
+ fi
+ {{- if $org.peers }}
+ if [ -e /templates/{{ $org.name }}-config-file.json ]; then
+ # Read the MSP Configfile from files for other orgs
+ CONFIG_FILE=$(jq -r '.data."mspConfig"' /templates/{{ $org.name }}-config-file.json)
+ echo "$CONFIG_FILE" > ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/config.yaml
+ else
+ # Read the MSP Configfile from k8s secrets for org that is executing the genesis
+ {{- with (first $org.peers) }}
+ KUBENETES_SECRET=$(kubectl get configmap {{ .name }}-msp-config --namespace ${COMPONENT_NAME} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ echo "MSP Config absent in Kuberenetes"
+ exit 1
+ else
+ CONFIG_FILE=$(echo "$KUBENETES_SECRET" | jq -r '.data.mspConfig')
+ echo "${CONFIG_FILE}" > ${OUTPUT_PATH_PEER}/{{ $org.name }}/msp/config.yaml
+ fi
+ {{- end }}
+ fi
+ {{- end }}
+ {{- if $org.orderers }}
+ {{- range $orderer := $org.orderers }}
+ if [ -e /templates/{{ $orderer.name }}-orderer-tls.json ]; then
+ # Read the MSP Configfile from files for other orgs
+ CONFIG_FILE=$(jq -r '.data.servercrt' /templates/{{ $orderer.name }}-orderer-tls.json)
+ echo "$CONFIG_FILE" | base64 -d > ${OUTPUT_PATH_PEER}/{{ $org.name }}/orderers/{{ $orderer.name }}/tls/server.crt
+ else
+ getOrdererTLSCerts {{ $orderer.name }} ${OUTPUT_PATH_PEER}/{{ $org.name }}
+ fi
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ cd /templates
+ version2_5=`echo $NETWORK_VERSION | grep -c 2.5`
+ {{- if .Values.settings.generateGenesis }}
+ if [ $version2_5 = 1 ]; then
+ echo "version 2.5.x does not need syschannel genesis"
+ else
+ echo "version 2.2.x syschannel genesis"
+ configtxgen -configPath "/templates" -profile OrdererGenesis -channelID syschannel -outputBlock genesis.block
+ writeSafeSecret syschannel-genesis genesis.block
+ fi
+ {{- end }}
+ {{- range $channel := $.Values.channels }}
+ if [ $version2_5 = 1 ]; then
+ echo "version 2.5.x"
+ configtxgen -configPath "/templates" -profile {{ $channel.name }} -channelID {{ $channel.name }} -outputBlock {{ $channel.name }}.genesis.block
+ writeSafeSecret {{ $channel.name }}-genesis {{ $channel.name }}.genesis.block
+ else
+ echo "version 2.2.x"
+ configtxgen -configPath "/templates" -profile {{ $channel.name }} -channelID {{ $channel.name }} -outputCreateChannelTx {{ $channel.name }}.tx
+ writeSafeSecret {{ $channel.name }}-channeltx {{ $channel.name }}.tx
+ {{- range $participant := $channel.participants }}
+ configtxgen -configPath "/templates" -profile {{ $channel.name }} -channelID {{ $channel.name }} -asOrg {{ $participant }}MSP -outputAnchorPeersUpdate {{ $channel.name }}{{ $participant }}MSPAnchor.tx
+ writeSafeSecret {{ $channel.name }}-{{ $participant }}-anchortx {{ $channel.name }}{{ $participant }}MSPAnchor.tx
+ {{- end }}
+ fi
+ {{- end }}
+ volumeMounts:
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
+ - name: configtx-file
+ mountPath: /templates/configtx.yaml
+ subPath: configtx.yaml
+ - name: certificates
+ mountPath: /templates/crypto-config
+ {{- range $org := $.Values.organizations }}
+ {{- $file := $.Files.Get (printf "files/%s.json" $org.name) }}
+ {{- if $file }}
+ - name: {{ $org.name }}-admin-msp
+ mountPath: /templates/{{ $org.name }}.json
+ subPath: {{ $org.name }}.json
+ {{- end }}
+ {{- $file := $.Files.Get (printf "files/%s-config-file.json" $org.name) }}
+ {{- if $file }}
+ - name: {{ $org.name }}-config-file
+ mountPath: /templates/{{ $org.name }}-config-file.json
+ subPath: {{ $org.name }}-config-file.json
+ {{- end }}
+ {{- range $orderer := $org.orderers }}
+ {{- $ordfile := $.Files.Get (printf "files/%s-orderer-tls.json" $orderer.name) }}
+ {{- if $ordfile }}
+ - name: {{ $orderer.name }}-tls-config
+ mountPath: /templates/{{ $orderer.name }}-orderer-tls.json
+ subPath: {{ $orderer.name }}-orderer-tls.json
+ {{- end }}
+ {{- end }}
+ {{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-genesis/values.yaml b/platforms/hyperledger-fabric/charts/fabric-genesis/values.yaml
new file mode 100644
index 00000000000..44b7f300420
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-genesis/values.yaml
@@ -0,0 +1,109 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+---
+# The following are for overriding global values
+global:
+ # HLF Network Version
+ #Eg. version: 2.5.4
+ version: 2.5.4
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the network type
+ network: fabric
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
+
+ proxy:
+ #This will be the proxy/ingress provider. Can have values "haproxy" or "none"
+ #Eg. provider: "haproxy"
+ provider: haproxy
+ #This field specifies the external url for the organization
+ #Eg. externalUrlSuffix: test.blockchaincloudpoc.com
+ externalUrlSuffix: test.blockchaincloudpoc.com
+
+image:
+ #Provide the valid image repository for fabric tools
+ #Eg. fabricTools: hyperledger/fabric-tools
+ fabricTools: ghcr.io/hyperledger/bevel-fabric-tools
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
+
+# Allows specification of one or many organizations that will be connecting to a network.
+organizations:
+ # Specification for the 1st organization.
+ - name: supplychain
+ orderers:
+ - name: orderer1
+ ordererAddress: orderer1.supplychain-net:7050 # Internal/External URI of the orderer
+ - name: orderer2
+ ordererAddress: orderer2.supplychain-net:7050
+ - name: orderer3
+ ordererAddress: orderer3.supplychain-net:7050
+ peers:
+ - name: peer0
+ peerAddress: peer0.supplychain-net:7051 # Internal/External URI of the peer
+ - name: peer1
+ peerAddress: peer1.supplychain-net:7051
+
+ # Specification for the 2nd organization.
+ - name: carrier
+ peers:
+ - name: peer0
+ peerAddress: peer0.carrier-net:7051 # Internal/External URI of the peer
+
+#Provide name of the consensus. Currently support raft and kafka
+#Eg. consensus: raft
+consensus: raft
+# kafka is only valid for consensus: kafka
+#Provide the kafka broker list
+kafka:
+ #Eg. brokers:
+ # - kafka-0.broker.example-com.svc.cluster.local:9092
+ # - kafka-1.broker.example-com.svc.cluster.local:9092
+ # - kafka-2.broker.example-com.svc.cluster.local:9092
+ # - kafka-3.broker.example-com.svc.cluster.local:9092
+ brokers:
+
+# The channels defined for a network with participating peers in each channel
+channels:
+ - name: allchannel
+ consortium: SupplyChainConsortium
+ orderers:
+ - supplychain
+ participants:
+ - supplychain
+ - carrier
+
+settings:
+ # Flag to generate the genesis file for Fabrix 2.2.x
+ generateGenesis: true
+ # Flag to ensure the genesis configmap is removed on helm uninstall
+ removeConfigMapOnDelete: true
diff --git a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/_helpers.tpl
index 7bf5f530a8e..8823df47301 100644
--- a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/_helpers.tpl
@@ -2,4 +2,34 @@
{{ range $key, $val := $.Values.metadata.labels }}
{{ $key }}: {{ $val }}
{{ end }}
-{{- end }}
\ No newline at end of file
+{{- end }}
+
+{{- define "labels.deployment" -}}
+{{- if $.Values.labels }}
+{{- range $key, $value := $.Values.labels.deployment }}
+{{- range $k, $v := $value }}
+ {{ $k }}: {{ $v | quote }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.service" -}}
+{{- if $.Values.labels }}
+{{- range $key, $value := $.Values.labels.service }}
+{{- range $k, $v := $value }}
+ {{ $k }}: {{ $v | quote }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.pvc" -}}
+{{- if $.Values.labels }}
+{{- range $key, $value := $.Values.labels.pvc }}
+{{- range $k, $v := $value }}
+ {{ $k }}: {{ $v | quote }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/deployment.yaml b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/deployment.yaml
index 4a1224d9ead..a23be73df84 100644
--- a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/deployment.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/deployment.yaml
@@ -16,6 +16,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "labels.custom" . | nindent 2 }}
+ {{ include "labels.deployment" . | nindent 2 }}
annotations:
{{- if $.Values.annotations }}
{{- range $key, $value := $.Values.annotations.deployment }}
@@ -44,6 +45,7 @@ spec:
app.kubernetes.io/name: {{ $.Values.service.name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ {{ include "labels.deployment" . | nindent 6 }}
spec:
serviceAccountName: {{ $.Values.service.serviceaccountname }}
{{- if .Values.service.imagesecretname }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/pvc.yaml b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/pvc.yaml
index 94dbc75d7bd..b341d78e267 100644
--- a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/pvc.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/pvc.yaml
@@ -15,6 +15,7 @@ metadata:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ {{ include "labels.pvc" . | nindent 2 }}
annotations:
{{- if $.Values.annotations }}
{{- range $key, $value := $.Values.annotations.pvc }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/service.yaml b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/service.yaml
index ce803a8d957..97d6e197379 100644
--- a/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/service.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-operations-console/templates/service.yaml
@@ -29,6 +29,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "labels.custom" . | nindent 2 }}
+ {{ include "labels.service" . | nindent 2 }}
spec:
type: {{ $.Values.service.servicetype }}
selector:
diff --git a/platforms/hyperledger-fabric/charts/fabric-operations-console/values.yaml b/platforms/hyperledger-fabric/charts/fabric-operations-console/values.yaml
index 0b1b1049069..3b4f69d49a9 100644
--- a/platforms/hyperledger-fabric/charts/fabric-operations-console/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-operations-console/values.yaml
@@ -80,3 +80,8 @@ proxy:
#This field contains the external URL of the organization
#Eg. external_url_suffix: orderer1.org1proxy.blockchaincloudpoc.com:443
external_url_suffix: orderer1.org1proxy.blockchaincloudpoc.com:443
+
+labels:
+ service: []
+ pvc: []
+ deployment: []
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/.helmignore b/platforms/hyperledger-fabric/charts/fabric-orderernode/.helmignore
new file mode 100644
index 00000000000..014fa775608
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+generated_config/
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/Chart.yaml
index dda2a22b87b..fcce9ef2506 100644
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/Chart.yaml
@@ -5,7 +5,23 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Deploys orderer node."
name: fabric-orderernode
-version: 1.0.0
+description: "Hyperledger Fabric: Deploys orderer node."
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
+
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/README.md b/platforms/hyperledger-fabric/charts/fabric-orderernode/README.md
index 1c9f8f4fa48..6e45da36e52 100644
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/README.md
@@ -3,225 +3,148 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# Orderer Node Hyperledger Fabric Deployment
+# fabric-orderernode
-- [Orderer Node Hyperledger Fabric Deployment Helm Chart](#orderer-node-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-orderernode chart deploys a Orderer Node for Hyperledger Fabric blockchain network. If enabled, the keys are stored on the configured vault and stored as Kubernetes secrets. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## Orderer Node Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-orderernode) for orderer node.
-
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- HAproxy is required as ingress controller.
-- Helm installed.
-
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-fabric-orderernode/
- |- templates/
- |- _helpers.yaml
- |- configmap.yaml
- |- deployment.yaml
- |- service.yaml
- |- servicemonitor.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install orderer1 bevel/fabric-orderernode
```
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: Defines two ConfigMaps, one for the orderer configuration and one for the genesis block.
-- `deployment.yaml`: The kafka-healthcheck checks the health of the Kafka brokers before the main container is started. The certificates-init fetches the TLS and MSP certificates from Vault and stores them in a local directory. The {{ $.Values.orderer.name }} runs the Hyperledger Fabric orderer. The grpc-web exposes the orderer's gRPC API over HTTP/WebSockets. These containers are responsible for ensuring that the orderer is up and running, that it has the necessary certificates, and that it can be accessed by clients.
-- `service.yaml`: Ensures internal and external access with exposed ports for gRPC (7050), gRPC-Web (7443), and operations (9443), and optionally uses HAProxy for external exposure and secure communication.
-- `servicemonitor.yaml`: Define a ServiceMonitor resource that allows Prometheus to collect metrics from the orderer node's "operations" port. The configuration is conditionally applied based on the availability of the Prometheus Operator's API version and whether metrics are enabled for the orderer service.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-orderernode/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-### Metadata
-
-| Name | Description | Default Value |
-| ---------------------- | ----------------------------------------------------------------------| -------------------------------------------------|
-| namespace | Namespace for orderer | org1-net |
-| network.version | HyperLedger Fabric network version | 2.2.2 |
-| images.orderer | Valid image name and version for fabric orderer | ghcr.io/hyperledger/bevel-fabric-orderer:2.2.2 |
-| images.alpineutils | Valid image name and version to read certificates from vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| images.healthcheck | Valid image name and version for health check of Kafka | busybox |
-| labels | Custom labels | "" |
-
-### Orderer
-
-| Name | Description | Default Value |
-| --------------------------- | ----------------------------------------------------------------------- | ----------------|
-| name | Name for the orderer node | orderer |
-| loglevel | Log level for orderer deployment | info |
-| localmspid | Local MSP ID for orderer deployment | OrdererMSP |
-| tlsstatus | Enable/disable TLS for orderer deployment | true |
-| keepaliveserverinterval | Interval in which the orderer signals the connection has kept alive | 10s |
-| address | Provide the address for orderer | orderer1.org1proxy.blockchaincloudpoc.com:443 |
-
-### Consensus
-
-| Name | Description | Default Value |
-| ---------| ----------------------------| ----------------|
-| name | Name of the consensus | raft |
-
-### Storage
-
-| Name | Description | Default Value |
-| ----------------------| -----------------------------------| ----------------|
-| storageclassname | Storage class name for orderer | aws-storageclassname |
-| storagesize | Storage size for storage class | 512Mi |
-
-### Service
-
-| Name | Description | Default Value |
-| ------------------------------| ------------------------------------------| ----------------|
-| servicetype | Service type for orderer | ClusterIP |
-| ports.grpc.nodeport | Cluster IP port for grpc service | "" |
-| ports.grpc.clusteripport | Cluster IP port for grpc service | 7050 |
-| ports.metrics.enabled | Enable/disable metrics service | false |
-| ports.metrics.clusteripport | Cluster IP port for metrics service | 9443 |
-
-### Annotations
-
-| Name | Description | Default Value |
-| ---------------| --------------------------------------- | --------------|
-| service | Extra annotations for service | "" |
-| deployment | Extra annotations for deployment | "" |
-
-### Vault
-
-| Name | Description | Default Value |
-| --------------------------- | --------------------------------------------------------------------| --------------------------------- |
-| address | Vault server address | "" |
-| role | Vault role for orderer deployment | vault-role |
-| authpath | Kubernetes auth backend configured in vault for orderer deployment | devorg1-net-auth |
-| type | Provide the type of vault | hashicorp |
-| secretprefix | Vault secretprefix | secretsv2/data/crypto/ordererOrganizations/org1-net/orderers/orderer.org1-net |
-| imagesecretname | Image secret name for vault | "" |
-| serviceaccountname | Service account name for vault | vault-auth |
-| tls | Enable/disable TLS for vault communication | "" |
-
-### Kafka
-
-| Name | Description | Default Value |
-| --------------------------- | ------------------------------------------------------------------------| ----------------|
-| readinesscheckinterval | Interval in seconds to check readiness of Kafka services | 5 |
-| readinessthreshold | Threshold for checking if specified Kafka brokers are up and running | 4 |
-| brokers | List of Kafka broker addresses | "" |
-
-### Proxy
-
-| Name | Description | Default Value |
-| --------------------------- | --------------------------------------- | ------------------------------ |
-| provider | Proxy/ingress provider | none |
-| external_url_suffix | External URL suffix of the organization | org1proxy.blockchaincloudpoc.com:443 |
-
-### Config
-
-| Name | Description | Default Value |
-| --------------------------- | --------------------------------------- | ------------------------------ |
-| pod.resources.limits.memory | Limit memory for node | 512M |
-| pod.resources.limits.cpu | Limit CPU for node | 1 |
-| pod.resources.requests.memory | Requested memory for node | 512M |
-| pod.resources.requests.cpu | Requested CPU for node | 0.25 |
+## Prerequisites
+- Kubernetes 1.19+
+- Helm 3.2.0+
-
-## Deployment
----
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-To deploy the fabric-orderernode Helm chart, follow these steps:
+> **Important**: Also check the dependent charts.
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-orderernode/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-orderernode
- ```
-Replace `` with the desired name for the release.
+## Installing the Chart
-This will deploy the fabric-orderernode node to the Kubernetes cluster based on the provided configurations.
+To install the chart with the release name `orderer1`:
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install orderer1 bevel/fabric-orderernode
+```
-
-## Verification
----
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-To verify the deployment, we can use the following command:
-```
-$ kubectl get statefulsets -n
-```
-Replace `` with the actual namespace where the StatefulSet was created. This command will display information about the StatefulSet, including the number of replicas and their current status.
+> **Tip**: List all releases using `helm list`
+## Uninstalling the Chart
-
-## Updating the Deployment
----
+To uninstall/delete the `orderer1` deployment:
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-orderernode/values.yaml) file with the desired changes and run the following Helm command:
+```bash
+helm uninstall orderer1
```
-$ helm upgrade ./fabric-orderernode
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-orderernode node is up to date.
-
-
-## Deletion
----
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global
+
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.version` | Fabric Version. | `2.5.4` |
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `""` |
+| `global.proxy.provider` | The proxy or Ingress provider. Can be `none` or `haproxy` | `haproxy` |
+| `global.proxy.externalUrlSuffix` | The External URL suffix at which the Fabric GRPC services will be available | `test.blockchaincloudpoc.com` |
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
+### Storage
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `storage.size` | Size of the PVC needed for Orderer Node | `512Mi` |
+| `storage.reclaimPolicy` | Reclaim policy for the PVC. Choose from: `Delete` or `Retain` | `Delete` |
+| `storage.volumeBindingMode` | Volume binding mode for the PVC. Choose from: `Immediate` or `WaitForFirstConsumer` | `Immediate` |
+| `storage.allowedTopologies.enabled` | Check [bevel-storageclass](../../../shared/charts/bevel-storageclass/README.md) for details | `false` |
+
+### Certs
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `certs.generateCertificates` | Flag to generate certificates for the Orderer Node | `true` |
+| `certs.orgData.caAddress` | Address of the CA Server without https | `ca.supplychain-net:7051` |
+| `certs.orgData.caAdminUser` | CA Admin Username | `supplychain-admin` |
+| `certs.orgData.caAdminPassword` | CA Admin Password | `supplychain-adminpw` |
+| `certs.orgData.orgName` | Organization Name | `supplychain` |
+| `certs.orgData.type` | Type of certificate to generate, choosed from `orderer` or `peer` | `orderer` |
+| `certs.orgData.componentSubject` | X.509 subject for the organization | `"O=Orderer,L=51.50/-0.13/London,C=GB"` |
+| `certs.settings.createConfigMaps` | Flag to create configmaps. Must be set to `false` for additional orderers/peers in the same organization. | `true` |
+| `certs.settings.refreshCertValue` | Flag to refresh User certificates | `false` |
+| `certs.settings.addPeerValue` | Flag to be used when adding a new peer to the organization | `false` |
+| `certs.settings.removeCertsOnDelete` | Flag to delete the user and peer certificates on uninstall | `false` |
+| `certs.settings.removeOrdererTlsOnDelete` | Flag to delete the orderer TLS certificates on uninstall | `false` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.orderer` |Fabric Orderer image repository | `ghcr.io/hyperledger/bevel-fabric-orderer` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.healthCheck` | Busybox image repository and tag | `busybox` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Orderer Node Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-orderernode), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+### Orderer
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `orderer.consensus` | Consensus type for the Orderer Node | `raft` |
+| `orderer.logLevel` | Log level for the Orderer Node | `info` |
+| `orderer.localMspId` | Local MSP ID for the Orderer Organization | `supplychainMSP` |
+| `orderer.tlsStatus` | TLS status of the Orderer Node | `true` |
+| `orderer.keepAliveServerInterval` | Keep Alive Interval in Seconds | `10s` |
+| `orderer.serviceType` | Service Type for the Ordering Service | `ClusterIP` |
+| `orderer.ports.grpc.nodePort` | NodePort for the Orderer GRPC Service | `""` |
+| `orderer.ports.grpc.clusterIpPort` | TCP Port for the Orderer GRPC Service | `7050` |
+| `orderer.ports.metrics.enabled` | Flag to enable metrics port | `false` |
+| `orderer.ports.metrics.clusterIpPort` | TCP Port for the Orderer metrics | `9443` |
+| `orderer.resources.limits.memory` | Memory limit for the Orderer Node | `512M` |
+| `orderer.resources.limits.cpu` | CPU limit for the Orderer Node | `1` |
+| `orderer.resources.requests.memory` | Memory request for the Orderer Node | `512M` |
+| `orderer.resources.requests.cpu` | CPU request for the Orderer Node | `0.25` |
+
+### Settings
+
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `kafka.readinessCheckInterval` | Interval between readiness checks for the Brokers | `5` |
+| `kafka.readinessThresHold` | Threshold for readiness checks for the Brokers | `1` |
+| `kafka.brokers` | List of Kafka Broker Addresses | `""` |
+| `healthCheck.retries` | Retry count to connect to Vault | `20` |
+| `healthCheck.sleepTimeAfterError` | Wait seconds after unsuccessful connection attempt | `15` |
+
+### Labels
+
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `labels.service` | Array of Labels for service object | `[]` |
+| `labels.pvc` | Array of Labels for PVC object | `[]` |
+| `labels.deployment` | Array of Labels for deployment or statefulset object | `[]` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/requirements.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/requirements.yaml
new file mode 100644
index 00000000000..77e9a174a8a
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/requirements.yaml
@@ -0,0 +1,14 @@
+dependencies:
+ - name: bevel-storageclass
+ alias: storage
+ repository: "file://../../../shared/charts/bevel-storageclass"
+ tags:
+ - storage
+ version: ~1.0.0
+ - name: fabric-catools
+ alias: certs
+ repository: "file://../fabric-catools"
+ tags:
+ - catools
+ version: ~1.1.0
+ condition: certs.generateCertificates
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/_helpers.tpl
index 7bf5f530a8e..c5697ed561c 100644
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/_helpers.tpl
@@ -1,5 +1,46 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
\ No newline at end of file
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-orderernode.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-orderernode.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-orderernode.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "labels.deployment" -}}
+{{- range $value := $.Values.labels.deployment }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.service" -}}
+{{- range $value := $.Values.labels.service }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.pvc" -}}
+{{- range $value := $.Values.labels.pvc }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/configmap.yaml
index 03e3239be3b..f7c63d12aec 100644
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/configmap.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/configmap.yaml
@@ -7,27 +7,29 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ $.Values.orderer.name }}-config
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-config
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: {{ $.Values.orderer.name }}-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-orderernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
data:
- FABRIC_LOGGING_SPEC: {{ $.Values.orderer.loglevel }}
+ FABRIC_LOGGING_SPEC: {{ .Values.orderer.logLevel }}
ORDERER_GENERAL_LISTENADDRESS: 0.0.0.0
-{{ if contains "2.5" $.Values.metadata.network.version }}
+{{ if contains "2.5" .Values.global.version }}
ORDERER_GENERAL_BOOTSTRAPMETHOD: "none"
{{ else }}
ORDERER_GENERAL_GENESISMETHOD: file
ORDERER_GENERAL_GENESISFILE: /var/hyperledger/orderer/orderer.genesis.block
{{ end }}
- ORDERER_GENERAL_LOCALMSPID: {{ $.Values.orderer.localmspid }}
- ORDERER_GENERAL_KEEPALIVE_SERVERINTERVAL: {{ $.Values.orderer.keepaliveserverinterval }}
+ ORDERER_GENERAL_LOCALMSPID: {{ .Values.orderer.localMspId }}
+ ORDERER_GENERAL_KEEPALIVE_SERVERINTERVAL: {{ .Values.orderer.keepAliveServerInterval }}
ORDERER_GENERAL_LOCALMSPDIR: /var/hyperledger/orderer/crypto/msp
- ORDERER_GENERAL_TLS_ENABLED: "{{ $.Values.orderer.tlsstatus }}"
+ ORDERER_GENERAL_TLS_ENABLED: "{{ .Values.orderer.tlsStatus }}"
ORDERER_GENERAL_TLS_PRIVATEKEY: /var/hyperledger/orderer/crypto/tls/server.key
ORDERER_GENERAL_TLS_CERTIFICATE: /var/hyperledger/orderer/crypto/tls/server.crt
ORDERER_GENERAL_TLS_ROOTCAS: '[/var/hyperledger/orderer/crypto/tls/ca.crt]'
@@ -39,8 +41,8 @@ data:
ORDERER_KAFKA_RETRY_SHORTTOTAL: "30s"
ORDERER_KAFKA_VERBOSE: "true"
GODEBUG: "netdns=go"
- ORDERER_OPERATIONS_LISTENADDRESS: 0.0.0.0:10443
-{{ if contains "2.5" $.Values.metadata.network.version }}
+ ORDERER_OPERATIONS_LISTENADDRESS: 0.0.0.0:9443
+{{ if contains "2.5" .Values.global.version }}
ORDERER_ADMIN_LISTENADDRESS: 0.0.0.0:7055
ORDERER_ADMIN_TLS_ENABLED: "true"
ORDERER_ADMIN_TLS_PRIVATEKEY: /var/hyperledger/orderer/crypto/tls/server.key
@@ -49,19 +51,3 @@ data:
ORDERER_ADMIN_TLS_CLIENTROOTCAS: '[/var/hyperledger/orderer/crypto/tls/ca.crt]'
{{ end }}
----
-{{- if ne $.Values.metadata.network.version "2.5.4" }}
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: genesis-block-{{ $.Values.orderer.name }}
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: genesis-block
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
-data:
- genesis.block.base64: {{ .Values.genesis | quote }}
-{{ end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/deployment.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/deployment.yaml
deleted file mode 100644
index 0946683fde2..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/deployment.yaml
+++ /dev/null
@@ -1,268 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: apps/v1
-kind: StatefulSet
-metadata:
- name: {{ $.Values.orderer.name }}
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: {{ $.Values.orderer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.deployment }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
-spec:
- updateStrategy:
- type: RollingUpdate
- serviceName: "{{ $.Values.orderer.name }}"
- replicas: 1
- selector:
- matchLabels:
- app: {{ $.Values.orderer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/name: {{ $.Values.orderer.name }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- template:
- metadata:
- annotations:
- checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
- labels:
- app: {{ $.Values.orderer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/name: {{ $.Values.orderer.name }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- spec:
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
- imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
- {{- end }}
- volumes:
- - name: certificates
- emptyDir:
- medium: Memory
- {{ if .Values.vault.tls }}
- - name: vaultca
- secret:
- secretName: {{ $.Values.vault.tls }}
- items:
- - key: ca.crt.pem
- path: ca-certificates.crt # curl expects certs to be in /etc/ssl/certs/ca-certificates.crt
- {{ end }}
- {{- if ne $.Values.metadata.network.version "2.5.4" }}
- - name: {{ $.Values.orderer.name }}-genesis-volume
- configMap:
- name: genesis-block-{{ $.Values.orderer.name }}
- items:
- - key: genesis.block.base64
- path: genesis.block.base64
- {{ end }}
- - name: scripts-volume
- configMap:
- name: bevel-vault-script
- initContainers:
- - name: kafka-healthcheck
- image: {{ $.Values.metadata.images.healthcheck }}
- imagePullPolicy: IfNotPresent
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- if [ {{ $.Values.consensus.name }} == kafka ]
- then
- COUNTER=1
- FLAG=true
- KAFKACOUNT=0
- COUNT=0
- {{ range $.Values.kafka.brokers}}
- COUNT=`expr "$COUNT" + 1`
- {{ end }}
- while [ "$COUNTER" -le {{ $.Values.kafka.readinessthreshold }} ]
- do
- {{ range $.Values.kafka.brokers}}
- KAFKA_BROKERS={{ . }}
- STATUS=$(nc -vz $KAFKA_BROKERS 2>&1 | grep -c open )
- if [ "$STATUS" == 0 ]
- then
- FLAG=false
- else
- FLAG=true
- KAFKACOUNT=`expr "$KAFKACOUNT" + 1`
- echo "$KAFKACOUNT kafka brokers out of $COUNT are up and running"
- fi
- {{ end }}
- if [ "$FLAG" == false ]
- then
- echo "$KAFKACOUNT kafka brokers out of $COUNT are up and running!"
- echo "Retry attempted $COUNTER times, retrying after {{ $.Values.kafka.readinesscheckinterval }} seconds"
- COUNTER=`expr "$COUNTER" + 1`
- sleep {{ $.Values.kafka.readinesscheckinterval }}
- else
- echo "SUCCESS!"
- echo "All $KAFKACOUNT kafka broker are up and running!"
- exit 0
- break
- fi
- done
- if [ "$COUNTER" -gt {{ $.Values.kafka.readinessthreshold }} ] || [ "$FLAG" == false ]
- then
- echo "Retry attempted $COUNTER times, no kafka brokers are up and running. Giving up!"
- exit 1
- break
- fi
- fi
- - name: certificates-init
- image: {{ $.Values.metadata.images.alpineutils }}
- imagePullPolicy: IfNotPresent
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: VAULT_SECRET_PREFIX
- value: "{{ $.Values.vault.secretprefix }}"
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: MOUNT_PATH
- value: /secret
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- . /scripts/bevel-vault.sh
-
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
-
- echo "Getting TLS certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_SECRET_PREFIX}/tls"
-
- TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca.crt"]')
- TLS_SERVER_CERT=$(echo ${VAULT_SECRET} | jq -r '.["server.crt"]')
- TLS_SERVER_KEY=$(echo ${VAULT_SECRET} | jq -r '.["server.key"]')
-
- OUTPUT_PATH="${MOUNT_PATH}/tls"
- mkdir -p ${OUTPUT_PATH}
- echo "${TLS_CA_CERT}" >> ${OUTPUT_PATH}/ca.crt
- echo "${TLS_SERVER_CERT}" >> ${OUTPUT_PATH}/server.crt
- echo "${TLS_SERVER_KEY}" >> ${OUTPUT_PATH}/server.key
-
- echo "Getting MSP certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_SECRET_PREFIX}/msp"
-
- ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
- CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
- KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
- SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
- TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
-
- OUTPUT_PATH="${MOUNT_PATH}/msp"
- mkdir -p ${OUTPUT_PATH}/admincerts
- mkdir -p ${OUTPUT_PATH}/cacerts
- mkdir -p ${OUTPUT_PATH}/keystore
- mkdir -p ${OUTPUT_PATH}/signcerts
- mkdir -p ${OUTPUT_PATH}/tlscacerts
-
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
- volumeMounts:
- - name: certificates
- mountPath: /secret
- {{ if .Values.vault.tls }}
- - name: vaultca
- mountPath: "/etc/ssl/certs/"
- readOnly: true
- {{ end }}
- - name: scripts-volume
- mountPath: /scripts/bevel-vault.sh
- subPath: bevel-vault.sh
- containers:
- - name: {{ $.Values.orderer.name }}
- image: {{ $.Values.metadata.images.orderer }}
- imagePullPolicy: IfNotPresent
- workingDir: /opt/gopath/src/github.com/hyperledger/fabric
- command: ["sh", "-c", "cat /var/hyperledger/orderer/genesis/genesis.block.base64 | base64 -d > /var/hyperledger/orderer/orderer.genesis.block && orderer"]
- ports:
- - containerPort: 7050
- - name: operations
- containerPort: 10443
- envFrom:
- - configMapRef:
- name: {{ $.Values.orderer.name }}-config
- volumeMounts:
- - name: datadir
- mountPath: /var/hyperledger/production/orderer
- {{- if ne $.Values.metadata.network.version "2.5.4" }}
- - name: {{ $.Values.orderer.name }}-genesis-volume
- mountPath: /var/hyperledger/orderer/genesis
- readOnly: true
- {{- end }}
- - name: certificates
- mountPath: /var/hyperledger/orderer/crypto
- readOnly: true
- resources:
- requests:
- memory: {{ .Values.config.pod.resources.requests.memory }}
- cpu: {{ .Values.config.pod.resources.requests.cpu }}
- limits:
- memory: {{ .Values.config.pod.resources.limits.memory }}
- cpu: {{ .Values.config.pod.resources.limits.cpu }}
- - name: grpc-web
- image: "ghcr.io/hyperledger-labs/grpc-web:latest"
- imagePullPolicy: IfNotPresent
- ports:
- - name: grpc-web
- containerPort: 7443
- env:
- - name: BACKEND_ADDRESS
- value: "{{ $.Values.orderer.name }}.{{ $.Values.metadata.namespace }}:{{ $.Values.service.ports.grpc.clusteripport }}"
- - name: SERVER_TLS_CERT_FILE
- value: "/certs/tls/server.crt"
- - name: SERVER_TLS_KEY_FILE
- value: "/certs/tls/server.key"
- - name: BACKEND_TLS_CA_FILES
- value: "/certs/tls/ca.crt"
- - name: SERVER_BIND_ADDRESS
- value: "0.0.0.0"
- - name: SERVER_HTTP_DEBUG_PORT
- value: "8080"
- - name: SERVER_HTTP_TLS_PORT
- value: "7443"
- - name: BACKEND_TLS
- value: "true"
- - name: SERVER_HTTP_MAX_WRITE_TIMEOUT
- value: 5m
- - name: SERVER_HTTP_MAX_READ_TIMEOUT
- value: 5m
- - name: USE_WEBSOCKETS
- value: "true"
- volumeMounts:
- - name: certificates
- mountPath: /certs
- volumeClaimTemplates:
- #Lables are not being taken by Kubernetes as it dynamically creates PVC
- - metadata:
- name: datadir
- spec:
- accessModes: [ "ReadWriteOnce" ]
- storageClassName: {{ $.Values.storage.storageclassname }}
- resources:
- requests:
- storage: {{ $.Values.storage.storagesize }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/node-statefulset.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/node-statefulset.yaml
new file mode 100644
index 00000000000..cb5e927c8e8
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/node-statefulset.yaml
@@ -0,0 +1,361 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: {{ template "fabric-orderernode.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-orderernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ {{- include "labels.deployment" . | nindent 4 }}
+spec:
+ updateStrategy:
+ type: RollingUpdate
+ serviceName: "{{ .Release.Name }}"
+ replicas: 1
+ selector:
+ matchLabels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-orderernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ template:
+ metadata:
+ annotations:
+ checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-orderernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ {{- include "labels.deployment" . | nindent 8 }}
+ spec:
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
+ imagePullSecrets:
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ volumes:
+ - name: certificates
+ emptyDir:
+ medium: Memory
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ secret:
+ secretName: {{ .Values.global.vault.tls }}
+ items:
+ - key: ca.crt.pem
+ path: ca-certificates.crt # curl expects certs to be in /etc/ssl/certs/ca-certificates.crt
+ {{ end }}
+ {{- if ne ($.Values.global.version | trunc 3) "2.5" }}
+ - name: {{ .Release.Name }}-genesis-volume
+ configMap:
+ name: syschannel-genesis
+ items:
+ - key: syschannel-genesis_base64
+ path: genesis.block.base64
+ {{ end }}
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ initContainers:
+ - name: kafka-healthcheck
+ image: {{ .Values.image.healthCheck }}
+ imagePullPolicy: IfNotPresent
+ command: ["sh", "-c"]
+ args:
+ - |-
+ #!/usr/bin/env sh
+ if [ {{ .Values.orderer.consensus }} == kafka ]
+ then
+ COUNTER=1
+ FLAG=true
+ KAFKACOUNT=0
+ COUNT=0
+ {{ range .Values.kafka.brokers}}
+ COUNT=`expr "$COUNT" + 1`
+ {{ end }}
+ while [ "$COUNTER" -le {{ .Values.kafka.readinessThresHold }} ]
+ do
+ {{ range .Values.kafka.brokers}}
+ KAFKA_BROKERS={{ . }}
+ STATUS=$(nc -vz $KAFKA_BROKERS 2>&1 | grep -c open )
+ if [ "$STATUS" == 0 ]
+ then
+ FLAG=false
+ else
+ FLAG=true
+ KAFKACOUNT=`expr "$KAFKACOUNT" + 1`
+ echo "$KAFKACOUNT kafka brokers out of $COUNT are up and running"
+ fi
+ {{ end }}
+ if [ "$FLAG" == false ]
+ then
+ echo "$KAFKACOUNT kafka brokers out of $COUNT are up and running!"
+ echo "Retry attempted $COUNTER times, retrying after {{ .Values.kafka.readinessCheckInterval }} seconds"
+ COUNTER=`expr "$COUNTER" + 1`
+ sleep {{ .Values.kafka.readinessCheckInterval }}
+ else
+ echo "SUCCESS!"
+ echo "All $KAFKACOUNT kafka broker are up and running!"
+ exit 0
+ break
+ fi
+ done
+ if [ "$COUNTER" -gt {{ .Values.kafka.readinessThresHold }} ] || [ "$FLAG" == false ]
+ then
+ echo "Retry attempted $COUNTER times, no kafka brokers are up and running. Giving up!"
+ exit 1
+ break
+ fi
+ fi
+ - name: certificates-init
+ image: {{ .Values.image.alpineUtils }}
+ imagePullPolicy: IfNotPresent
+ env:
+ - name: VAULT_ADDR
+ value: {{ .Values.global.vault.address }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ .Values.global.vault.authPath }}
+ - name: VAULT_APP_ROLE
+ value: {{ .Values.global.vault.role }}
+ - name: MOUNT_PATH
+ value: /secret
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
+ - name: ORDERER_NAME
+ value: {{ .Release.Name }}
+ command: ["sh", "-c"]
+ args:
+ - |-
+ #!/usr/bin/env sh
+
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . /scripts/bevel-vault.sh
+
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+
+ function getOrdererTlsSecret {
+ KEY=$1
+
+ echo "Getting TLS certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/orderers/${KEY}"
+ if [ "$SECRETS_AVAILABLE" == "yes" ]
+ then
+ TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca_crt"]')
+ TLS_SERVER_CERT=$(echo ${VAULT_SECRET} | jq -r '.["server_crt"]')
+ TLS_SERVER_KEY=$(echo ${VAULT_SECRET} | jq -r '.["server_key"]')
+
+ echo "${TLS_CA_CERT}" > ${OUTPUT_PATH}/ca.crt
+ echo "${TLS_SERVER_CERT}" > ${OUTPUT_PATH}/server.crt
+ echo "${TLS_SERVER_KEY}" > ${OUTPUT_PATH}/server.key
+ ORDERER_TLS_SECRET=true
+ else
+ ORDERER_TLS_SECRET=false
+ fi
+ }
+
+ function getOrdererMspSecret {
+ KEY=$1
+
+ echo "Getting MSP certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/orderers/${KEY}"
+ if [ "$SECRETS_AVAILABLE" == "yes" ]
+ then
+ ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
+ CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
+ KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
+ SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
+ TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ ORDERER_MSP_SECRET=true
+ else
+ ORDERER_MSP_SECRET=false
+ fi
+ }
+
+{{- else }}
+ function getOrdererTlsSecret {
+ KEY=$1
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ ORDERER_TLS_SECRET=false
+ else
+ TLS_CA_CERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacrt' | base64 -d)
+ TLS_SERVER_CERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.servercrt' | base64 -d)
+ TLS_SERVER_KEY=$(echo ${KUBENETES_SECRET} | jq -r '.data.serverkey' | base64 -d)
+
+ echo "${TLS_CA_CERT}" > ${OUTPUT_PATH}/ca.crt
+ echo "${TLS_SERVER_CERT}" > ${OUTPUT_PATH}/server.crt
+ echo "${TLS_SERVER_KEY}" > ${OUTPUT_PATH}/server.key
+ ORDERER_TLS_SECRET=true
+ fi
+ }
+
+ function getOrdererMspSecret {
+ KEY=$1
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ ORDERER_MSP_SECRET=false
+ else
+ ADMINCERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacerts' | base64 -d)
+ KEYSTORE=$(echo ${KUBENETES_SECRET} | jq -r '.data.keystore' | base64 -d)
+ SIGNCERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.signcerts' | base64 -d)
+ TLSCACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.tlscacerts' | base64 -d)
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ ORDERER_MSP_SECRET=true
+ fi
+ }
+
+{{- end }}
+ COUNTER=1
+ while [ "$COUNTER" -le {{ .Values.healthCheck.retries }} ]
+ do
+ OUTPUT_PATH="${MOUNT_PATH}/tls"
+ mkdir -p ${OUTPUT_PATH}
+ getOrdererTlsSecret ${ORDERER_NAME}-tls
+
+ OUTPUT_PATH="${MOUNT_PATH}/msp"
+ mkdir -p ${OUTPUT_PATH}/admincerts
+ mkdir -p ${OUTPUT_PATH}/cacerts
+ mkdir -p ${OUTPUT_PATH}/keystore
+ mkdir -p ${OUTPUT_PATH}/signcerts
+ mkdir -p ${OUTPUT_PATH}/tlscacerts
+ getOrdererMspSecret ${ORDERER_NAME}-msp
+
+ if [ "$ORDERER_TLS_SECRET" = "true" ] && [ "$ORDERER_MSP_SECRET" = "true" ]
+ then
+ echo "Orderer certificates have been obtained correctly"
+ break
+ else
+ echo "Orderer certificates have not been obtained, sleeping for {{ .Values.healthCheck.sleepTimeAfterError }}"
+ sleep {{ .Values.healthCheck.sleepTimeAfterError }}
+ COUNTER=`expr "$COUNTER" + 1`
+ fi
+ done
+
+ if [ "$COUNTER" -gt {{ .Values.healthCheck.retries }} ]
+ then
+ echo "Retry attempted `expr $COUNTER - 1` times, Orderer certificates have not been obtained."
+ exit 1
+ fi
+ volumeMounts:
+ - name: certificates
+ mountPath: /secret
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ mountPath: "/etc/ssl/certs/"
+ readOnly: true
+ {{ end }}
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
+ containers:
+ - name: fabric-orderer
+ image: {{ .Values.image.orderer }}:{{ .Values.global.version }}
+ imagePullPolicy: IfNotPresent
+ workingDir: /opt/gopath/src/github.com/hyperledger/fabric
+ command: ["sh", "-c", "cat /var/hyperledger/orderer/genesis/genesis.block.base64 | base64 -d > /var/hyperledger/orderer/orderer.genesis.block && orderer"]
+ ports:
+ - containerPort: 7050
+ - name: operations
+ containerPort: 9443
+ - name: onsadmin
+ containerPort: 7055
+ envFrom:
+ - configMapRef:
+ name: {{ .Release.Name }}-config
+ volumeMounts:
+ - name: datadir
+ mountPath: /var/hyperledger/production/orderer
+ {{- if ne ($.Values.global.version | trunc 3) "2.5" }}
+ - name: {{ .Release.Name }}-genesis-volume
+ mountPath: /var/hyperledger/orderer/genesis
+ readOnly: true
+ {{- end }}
+ - name: certificates
+ mountPath: /var/hyperledger/orderer/crypto
+ readOnly: true
+ resources:
+ requests:
+ memory: {{ .Values.orderer.resources.requests.memory }}
+ cpu: {{ .Values.orderer.resources.requests.cpu }}
+ limits:
+ memory: {{ .Values.orderer.resources.limits.memory }}
+ cpu: {{ .Values.orderer.resources.limits.cpu }}
+ - name: grpc-web
+ image: "ghcr.io/hyperledger-labs/grpc-web:latest"
+ imagePullPolicy: IfNotPresent
+ ports:
+ - name: grpc-web
+ containerPort: 7443
+ env:
+ - name: BACKEND_ADDRESS
+ value: "{{ .Release.Name }}.{{ .Release.Namespace }}:{{ .Values.orderer.ports.grpc.clusterIpPort }}"
+ - name: SERVER_TLS_CERT_FILE
+ value: "/certs/tls/server.crt"
+ - name: SERVER_TLS_KEY_FILE
+ value: "/certs/tls/server.key"
+ - name: BACKEND_TLS_CA_FILES
+ value: "/certs/tls/ca.crt"
+ - name: SERVER_BIND_ADDRESS
+ value: "0.0.0.0"
+ - name: SERVER_HTTP_DEBUG_PORT
+ value: "8080"
+ - name: SERVER_HTTP_TLS_PORT
+ value: "7443"
+ - name: BACKEND_TLS
+ value: "true"
+ - name: SERVER_HTTP_MAX_WRITE_TIMEOUT
+ value: 5m
+ - name: SERVER_HTTP_MAX_READ_TIMEOUT
+ value: 5m
+ - name: USE_WEBSOCKETS
+ value: "true"
+ volumeMounts:
+ - name: certificates
+ mountPath: /certs
+ volumeClaimTemplates:
+ #Lables are not being taken by Kubernetes as it dynamically creates PVC
+ - metadata:
+ name: datadir
+ labels:
+ {{- include "labels.pvc" . | nindent 8 }}
+ spec:
+ accessModes: [ "ReadWriteOnce" ]
+ storageClassName: storage-{{ .Release.Name }}
+ resources:
+ requests:
+ storage: {{ .Values.storage.size }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/service.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/service.yaml
index ee998da18d2..114b5d2d2db 100644
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/service.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/service.yaml
@@ -7,33 +7,28 @@
apiVersion: v1
kind: Service
metadata:
- name: {{ $.Values.orderer.name }}
- namespace: {{ $.Values.metadata.namespace }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.service }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
+ name: {{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
labels:
- run: {{ $.Values.orderer.name }}
- app.kubernetes.io/name: {{ $.Values.orderer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ run: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-orderernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ {{- include "labels.service" . | nindent 4 }}
spec:
- type: {{ $.Values.service.servicetype }}
+ type: {{ .Values.orderer.serviceType }}
selector:
- app: {{ $.Values.orderer.name }}
+ app: {{ .Release.Name }}
ports:
- protocol: TCP
targetPort: 7050
- port: {{ $.Values.service.ports.grpc.clusteripport }}
- {{- if (ne $.Values.service.servicetype "ClusterIP") }}
- nodePort: {{ $.Values.service.ports.grpc.nodeport }}
+ port: {{ .Values.orderer.ports.grpc.clusterIpPort }}
+ {{- if (ne .Values.orderer.serviceType "ClusterIP") }}
+ nodePort: {{ .Values.orderer.ports.grpc.nodeport }}
{{- end }}
name: grpc
- name: grpc-web
@@ -43,61 +38,66 @@ spec:
- name: operations
protocol: TCP
targetPort: 9443
- port: {{ $.Values.service.ports.metrics.clusteripport }}
- {{- if (eq $.Values.service.servicetype "ClusterIP") }}
+ port: {{ .Values.orderer.ports.metrics.clusterIpPort }}
+{{ if contains "2.5" .Values.global.version }}
+ - name: onsadmin
+ protocol: TCP
+ targetPort: 7055
+ port: 7055
+{{- end }}
+ {{- if (eq .Values.orderer.serviceType "ClusterIP") }}
clusterIP: None
{{- end }}
-{{ if eq $.Values.proxy.provider "haproxy" }}
+{{ if eq .Values.global.proxy.provider "haproxy" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: {{ $.Values.orderer.name }}
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
annotations:
- kubernetes.io/ingress.class: "haproxy"
ingress.kubernetes.io/ssl-passthrough: "true"
spec:
+ ingressClassName: "haproxy"
rules:
- - host: {{ $.Values.orderer.name }}.{{ $.Values.proxy.external_url_suffix }}
+ - host: {{ .Release.Name }}.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.orderer.name }}
+ name: {{ .Release.Name }}
port:
- number: {{ $.Values.service.ports.grpc.clusteripport }}
- - host: {{ $.Values.orderer.name }}-proxy.{{ $.Values.proxy.external_url_suffix }}
+ number: {{ .Values.orderer.ports.grpc.clusterIpPort }}
+ - host: {{ .Release.Name }}-proxy.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.orderer.name }}
+ name: {{ .Release.Name }}
port:
number: 7443
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: {{ $.Values.orderer.name }}-ops
- namespace: {{ $.Values.metadata.namespace }}
- annotations:
- kubernetes.io/ingress.class: "haproxy"
+ name: {{ .Release.Name }}-ops
+ namespace: {{ .Release.Namespace }}
spec:
+ ingressClassName: "haproxy"
rules:
- - host: {{ $.Values.orderer.name }}-ops.{{ $.Values.proxy.external_url_suffix }}
+ - host: {{ .Release.Name }}-ops.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.orderer.name }}
+ name: {{ .Release.Name }}
port:
- number: 10443
+ number: 9443
{{ end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/servicemonitor.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/servicemonitor.yaml
index 62850b18082..92ad3e488fe 100644
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/servicemonitor.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/templates/servicemonitor.yaml
@@ -1,14 +1,18 @@
-{{- if $.Values.service.ports.metrics.enabled }}
+{{- if .Values.orderer.ports.metrics.enabled }}
{{- if $.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor" }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
- app: {{ $.Values.orderer.name }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-orderernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- name: {{ $.Values.orderer.name }}
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
spec:
jobLabel: {{ .Release.Name }}
endpoints:
@@ -16,10 +20,10 @@ spec:
port: operations
namespaceSelector:
matchNames:
- - {{ $.Values.metadata.namespace }}
+ - {{ .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
- run: {{ $.Values.orderer.name }}
+ run: {{ .Release.Name }}
{{- end }}
{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-orderernode/values.yaml b/platforms/hyperledger-fabric/charts/fabric-orderernode/values.yaml
index a08d5e3488d..270207e8376 100644
--- a/platforms/hyperledger-fabric/charts/fabric-orderernode/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-orderernode/values.yaml
@@ -4,150 +4,164 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
-metadata:
- #Provide the namespace for orderer
- #Eg. namespace: org1-net
- namespace: org1-net
+global:
# HLF Network Version
- network:
- version: 2.2.2
- images:
- #Provide the valid image name and version for fabric orderer
- #Eg. orderer: hyperledger/fabric-orderer:1.4.0
- orderer: ghcr.io/hyperledger/bevel-fabric-orderer:2.2.2
- #Provide the valid image name and version to read certificates from vault server
- #Eg.alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the valid image name and version for healthcheck of kafka
- #Eg. healthcheck: busybox
- healthcheck: busybox
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name , run
- #These lables will not be applied to VolumeClaimTemplate of StatefulSet as labels are automatically picked up by Kubernetes
- #Eg. labels:
- # role: orderer
- labels:
-
-orderer:
- #Provide the name for the orderer node
- #Eg. name: orderer
- name: orderer
- #Provide the loglevel for orderer deployment
- #Eg. loglevel: info
- loglevel: info
- #Provide the localmspid for orderer deployment
- #Eg. localmspid: OrdererMSP
- localmspid: OrdererMSP
- #Provide the value for tlsstatus to be true or false for orderer deployment
- #Eg. tlsstatus: true
- tlsstatus: true
- #Provide the interval in which the orderer to signal the connection has kept alive
- #Eg. keepaliveserverinterval: 10s
- keepaliveserverinterval: 10s
- #Provide the address for orderer
- #Eg. address: orderer1.org1proxy.blockchaincloudpoc.com:443
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ #Eg. version: 2.5.4
+ version: 2.5.4
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
+ #Kuberenetes secret for vault ca.cert
+ #Enable or disable TLS for vault communication if value present or not
+ #Eg. tls: vaultca
+ tls:
+
+ proxy:
+ #This will be the proxy/ingress provider. Can have values "none" or "haproxy"
+ #Eg. provider: "haproxy"
+ provider: "haproxy"
+ #This field contains the external URL of the organization
+ #Eg. externalUrlSuffix: test.blockchaincloudpoc.com
+ externalUrlSuffix: test.blockchaincloudpoc.com
-consensus:
- #Provide name of the consensus. Currently support raft and kafka
- #Eg. name: raft
- name: raft
-
storage:
- #Provide the storageclassname for orderer
- #Eg. storageclassname: aws-storage
- storageclassname: aws-storageclass
- #Provide the storagesize for storage class
- #Eg. storagesize: 512Mi
- storagesize: 512Mi
+ #Provide storage size for Orderer Volume
+ #Eg. size: 512Mi
+ size: 512Mi
+ # NOTE: when you set this to Retain, the volume WILL persist after the chart is delete and you need to manually delete it
+ reclaimPolicy: "Delete" # choose from: Delete | Retain
+ volumeBindingMode: Immediate # choose from: Immediate | WaitForFirstConsumer
+ allowedTopologies:
+ enabled: false
+
+certs:
+ # Flag indicating the creation of certificates.
+ generateCertificates: true
+ orgData:
+ caAddress: ca.supplychain-net:7051
+ caAdminUser: supplychain-admin
+ caAdminPassword: supplychain-adminpw
+ #Provide organization's name in lowercases
+ #Eg. orgName: supplychain
+ orgName: supplychain
+ #Provide organization's type (orderer or peer)
+ #Eg. type: orderer
+ type: orderer
+ #Provide organization's subject
+ #Eg. componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+ componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: true
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: false
+ removeOrdererTlsOnDelete: false
-service:
- #Provide the servicetype a peer
- #Eg. servicetype: NodePort
- servicetype: ClusterIP
+image:
+ #Provide the valid image repository for fabric orderer
+ #Eg. orderer: hyperledger/fabric-orderer
+ orderer: ghcr.io/hyperledger/bevel-fabric-orderer
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg.alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the valid image name and version for healthCheck of kafka
+ #Eg. healthCheck: busybox
+ healthCheck: busybox
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
+
+orderer:
+ #Provide the name of the consensus. Currently support raft and kafka
+ #Eg. consensus: raft
+ consensus: raft
+ #Provide the logLevel for orderer deployment
+ #Eg. logLevel: info
+ logLevel: info
+ #Provide the localMspId for orderer deployment
+ #Eg. localMspId: supplychainMSP
+ localMspId: supplychainMSP
+ #Provide the value for tlsStatus to be true or false for orderer deployment
+ #Eg. tlsStatus: true
+ tlsStatus: true
+ #Provide the interval in which the orderer to signal the connection has kept alive
+ #Eg. keepAliveServerInterval: 10s
+ keepAliveServerInterval: 10s
+ #Provide the serviceType a peer
+ #Eg. serviceType: NodePort
+ serviceType: ClusterIP
ports:
grpc:
#Provide a nodeport for orderer in the range of 30000-32767 (optional)
#Eg. nodeport: 30001
nodeport:
#Provide a cluster IP port for orderer to be exposed.
- #Eg. clusteripport: 7050
- clusteripport: 7050
+ #Eg. clusterIpPort: 7050
+ clusterIpPort: 7050
metrics:
enabled: false
- clusteripport: 9443
-annotations:
- #Extra annotations
- service: {}
- deployment: {}
-
-vault:
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the vaultrole for orderer deployment
- #Eg. vaultrole: orderer-vault-role
- role: vault-role
- #Provide the kubernetes auth backed configured in vault for orderer deployment
- #Eg. authpath: devorg1-net-auth
- authpath: devorg1-net-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the value for vault secretprefix
- #Eg. secretprefix: secretsv2/data/crypto/ordererOrganizations/.../orderers/....
- secretprefix: secretsv2/data/crypto/ordererOrganizations/org1-net/orderers/orderer.org1-net
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Kuberenetes secret for vault ca.cert
- #Enable or disable TLS for vault communication if value present or not
- #Eg. tls: vaultca
- tls:
-
-
-kafka:
- #Provide the interval in seconds you want to iterate till all kafka services to be ready
- #Eg. readinesscheckinterval: 5
- readinesscheckinterval: 5
- #Provide the threshold till you want to check if all specified kafka brokers are up and running
- #Eg. readinessthreshold: 4
- readinessthreshold: 4
- #Provide the kafka broker list
- #Eg. brokers:
- # - kafka-0.broker.org1-net.svc.cluster.local:9092
- # - kafka-1.broker.org1-net.svc.cluster.local:9092
- # - kafka-2.broker.org1-net.svc.cluster.local:9092
- # - kafka-3.broker.org1-net.svc.cluster.local:9092
- brokers:
-
-proxy:
- #This will be the proxy/ingress provider. Can have values "none" or "haproxy"
- #Eg. provider: "haproxy"
- provider: "haproxy"
- #This field contains the external URL of the organization
- #Eg. external_url_suffix: org1.blockchaincloudpoc.com
- external_url_suffix: org1proxy.blockchaincloudpoc.com:443
-
-config:
- # Set limits and requests of pod
- pod:
- resources:
- limits:
+ clusterIpPort: 9443
+ resources:
+ limits:
# Provide the limit memory for node
# Eg. memory: 512M
- memory: 512M
+ memory: 512M
# Provide the limit cpu for node
# Eg. cpu: 1
- cpu: 1
- requests:
+ cpu: 1
+ requests:
# Provide the requests memory for node
# Eg. memory: 512M
- memory: 512M
+ memory: 512M
# Provide the requests cpu for node
# Eg. cpu: 0.25
- cpu: 0.25
+ cpu: 0.25
+
+kafka:
+ #Provide the interval in seconds you want to iterate till all kafka services to be ready
+ #Eg. readinessCheckInterval: 5
+ readinessCheckInterval: 5
+ #Provide the threshold till you want to check if all specified kafka brokers are up and running
+ #Eg. readinessThresHold: 4
+ readinessThresHold: 4
+ #Provide the kafka broker list
+ #Eg. brokers:
+ # - kafka-0.broker.org1-net.svc.cluster.local:9092
+ # - kafka-1.broker.org1-net.svc.cluster.local:9092
+ # - kafka-2.broker.org1-net.svc.cluster.local:9092
+ # - kafka-3.broker.org1-net.svc.cluster.local:9092
+ brokers:
+
+healthCheck:
+ # The amount of times to retry fetching from/writing to Vault before giving up.
+ # Eg. retries: 10
+ retries: 10
+ # The amount of time in seconds to wait after an error occurs when fetching from/writing to Vault.
+ # Eg. sleepTimeAfterError: 15
+ sleepTimeAfterError: 15
+
+labels:
+ service: []
+ pvc: []
+ deployment: []
diff --git a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/.helmignore b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/.helmignore
new file mode 100644
index 00000000000..014fa775608
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+generated_config/
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/Chart.yaml
index d2a165f9379..adadd4aceca 100644
--- a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/Chart.yaml
@@ -5,7 +5,22 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: A Helm chart for create channel
name: fabric-osnadmin-channel-create
-version: 1.0.0
+description: "Hyperledger Fabric: Creates channel using OSNAdmin"
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/README.md b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/README.md
index e164d0b4082..58328cc9896 100644
--- a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/README.md
@@ -3,179 +3,92 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# Create Channel Hyperledger Fabric Deployment
+# fabric-osnadmin-channel-create
-- [Osn Create Channel Hyperledger Fabric Deployment Helm Chart](#osn-create-channel-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-osnadmin-channel-create chart deploys a Kubernetes job to create a channel. The channel name is same as the release name. This chart should be executed after the [fabric-genesis](../fabric-genesis/README.md) chart. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## Osn Create Channel Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create) to create a channel with fabric 2.5.4.
-
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
-
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install allchannel bevel/fabric-osnadmin-channel-create
```
-fabric-osnadmin-channel-create/
- |- templates/
- |- _helpers.yaml
- |- configmap.yaml
- |- osn_create_channel.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: Store configuration data that can be consumed by containers. The first ConfigMap stores various configuration data as key-value pairs and the second ConfigMap stores the base64-encoded content of the channel configuration file (channel.tx.base64).
-- `osn_create_channel.yaml`: The certificates-init fetches TLS certificates from a Vault server and stores them in a local directory. The createchannel check the channel creation. If the channel does not exist, the createchannel creates the channel.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-### Metadata
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------------------------------------------|---------------------------------------------------|
-| namespace | Provide the namespace for organization's peer | org1-net |
-| network.version | Provide Fabric version | 2.5.4 |
-| images.fabrictools | Valid image name and version for fabric tools | ghcr.io/hyperledger/bevel-fabric-tools:2.5.4 |
-| images.alpineutils | Valid image name and version to read certificates from vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| labels | Custom labels (other than specified) | "" |
-
-
-### Deployment
-
-| Name | Description | Default Value |
-| ------------ | ------------------------------------------- | -------------- |
-| annotations | Deployment annotations | "" |
-
-### Vault
-| Name | Description | Default Value |
-| ------------------- | --------------------------------------------------------------------| ------------------------------|
-| role | Vault role for the organization | vault-role |
-| address | Vault server address | "" |
-| authpath | Kubernetes auth backend configured in vault for the organization | devorg1-net-auth |
-| orderersecretprefix | Vault secret prefix for orderer | secret/secretsv2/crypto/ordererOrganizations/org1-net/orderers |
-| serviceaccountname | Service account name for vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Image secret name for vault | "" |
-| tls | Vault ca.cert Kubernetes secret | "" |
-
-### Channel
-
-| Name | Description | Default Value |
-| ------ | --------------------------------- | -------------- |
-| name | Name of the channel | mychannel |
-
-### Orderer
-
-| Name | Description | Default Value |
-| ------- | ----------------------------| --------------------------|
-| orderer_info | Provide orderer's names | orderer1 |
-
-### Other
-
-| Name | Description | Default Value |
-| ---------- | ---------------------------------------------| --------------- |
-| genesis | Provide the base64 encoded genesis file | "" |
-
-
-
-## Deployment
----
+## Prerequisites
-To deploy the fabric-channel-create Helm chart, follow these steps:
+- Kubernetes 1.19+
+- Helm 3.2.0+
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-osnadmin-channel-create
- ```
-Replace `` with the desired name for the release.
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-This will deploy the fabric-channel-create node to the Kubernetes cluster based on the provided configurations.
+Also, [fabric-genesis](../fabric-genesis/README.md) chart should be installed and this chart should be executed from the same namespace as the Orderer Organization.
+## Installing the Chart
-
-## Verification
----
+To install the chart with the channel name `allchannel`:
-To verify the deployment, we can use the following command:
-```
-$ kubectl get jobs -n
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install allchannel bevel/fabric-osnadmin-channel-create
```
-Replace `` with the actual namespace where the Job was created. This command will display information about the Job, including the number of completions and the current status of the Job's pods.
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-
-## Updating the Deployment
----
-
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./fabric-channel-create
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-channel-create node is up to date.
+> **Tip**: List all releases using `helm list`
+## Uninstalling the Chart
-
-## Deletion
----
+To uninstall/delete the `allchannel` deployment:
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
+```bash
+helm uninstall allchannel
```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
-
-
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Osn Create Channel Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.version` | Fabric Version. This chart is only used for `2.5.x` | `2.5.4` |
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.network` | Network type that is being deployed | `fabric` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `false` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.fabricTools` | Fabric Tools image repository | `ghcr.io/hyperledger/bevel-fabric-tools` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
+
+### Settings
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `orderers` | List of Orderer nodes in the network and their OSN Admin addresses. This list presents two fields `name` and `adminAddress` | `- name: orderer1`
`adminAddress: orderer1.supplychain-net:7055`
`- name: orderer2`
`adminAddress: orderer2.supplychain-net:7055`
`- name: orderer3`
`adminAddress: orderer3.supplychain-net:7055` |
+| `orderer.addOrderer` | Flag to add new Orderer node to the network | `false` |
+| `orderer.name` | Name of the new Orderer node to be addded | `neworderer` |
+| `orderer.localMspId` | New Orderer MSP ID | `newordererMSP` |
+| `orderer.ordererAddress` | New Orderer Internal or External Address with port for Peer to connect | `neworderer.neworg-net:7050` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/_helpers.tpl
index d43c09d8cef..6d9284abc4b 100644
--- a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/_helpers.tpl
@@ -1,5 +1,28 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-osnadmin-channel-create.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-osnadmin-channel-create.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-osnadmin-channel-create.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/configmap.yaml
index 4c583456ac7..0e9eb9014e4 100644
--- a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/configmap.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/configmap.yaml
@@ -7,43 +7,24 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ $.Values.channel.name }}-config
- namespace: {{ $.Values.metadata.namespace }}
- {{- if $.Values.deployment.annotations }}
- annotations:
-{{ toYaml $.Values.deployment.annotations | nindent 8 }}
- {{- end }}
+ name: {{ .Release.Name }}-osnadmin-config
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: {{ $.Values.channel.name }}-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app.kubernetes.io/name: {{ .Release.Name }}-osnadmin-config
+ app.kubernetes.io/component: fabric-osnadmin-channel-create-job
+ app.kubernetes.io/part-of: {{ include "fabric-osnadmin-channel-create.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
- CHANNEL_NAME: {{ $.Values.channel.name }}
+ CHANNEL_NAME: {{ .Release.Name }}
ADMIN_TLS_CERTS: /opt/gopath/src/github.com/hyperledger/fabric/crypto
GENESIS_FILE: /opt/gopath/src/github.com/hyperledger/fabric/orderer/genesis
-{{- if $.Values.add_orderer }}
- CORE_PEER_LOCALMSPID: {{ $.Values.orderer.localmspid }}
+{{- if $.Values.orderer.addOrderer }}
+ CORE_PEER_LOCALMSPID: {{ $.Values.orderer.localMspId }}
CORE_PEER_TLS_ROOTCERT_FILE: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp/tlscacerts/tlsca.crt
CORE_PEER_MSPCONFIGPATH: /opt/gopath/src/github.com/hyperledger/fabric/crypto/admin/msp
- CORE_PEER_ADDRESS: {{ $.Values.orderer.address }}
+ CORE_PEER_ADDRESS: {{ $.Values.orderer.ordererAddress }}
ORDERER_CA: /opt/gopath/src/github.com/hyperledger/fabric/crypto/{{ $.Values.orderer.name }}/tls/ca.crt
{{ end }}
----
-{{- if not $.Values.add_orderer }}
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: {{ $.Values.channel.name }}-genesis-block
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: genesis-block
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
-data:
- genesis.block.base64: {{ $.Values.genesis | quote }}
-{{ end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/osn_create_channel.yaml b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/osn_create_channel.yaml
index 36272c3b0e0..426ce6c520c 100644
--- a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/osn_create_channel.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/templates/osn_create_channel.yaml
@@ -7,50 +7,50 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: osn-createchannel-{{ $.Values.channel.name }}
- namespace: {{ $.Values.metadata.namespace }}
- {{- if $.Values.deployment.annotations }}
- annotations:
-{{ toYaml $.Values.deployment.annotations | nindent 8 }}
- {{- end }}
+ name: channel-create-{{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
labels:
- app: osn-createchannel-{{ $.Values.channel.name }}
- app.kubernetes.io/name: osn-createchannel-{{ $.Values.channel.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: osn-createchannel-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-osnadmin-channel-create-job
+ app.kubernetes.io/part-of: {{ include "fabric-osnadmin-channel-create.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
backoffLimit: 6
template:
metadata:
labels:
- app: osn-createchannel-{{ $.Values.channel.name }}
- app.kubernetes.io/name: osn-createchannel-{{ $.Values.channel.name }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: osn-createchannel-{{ .Release.Name }}
+ app.kubernetes.io/component: fabric-osnadmin-channel-create-job
+ app.kubernetes.io/part-of: {{ include "fabric-osnadmin-channel-create.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
restartPolicy: "OnFailure"
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
+ - name: {{ .Values.image.pullSecret }}
{{- end }}
volumes:
- {{ if .Values.vault.tls }}
+ {{ if .Values.global.vault.tls }}
- name: vaultca
secret:
- secretName: {{ $.Values.vault.tls }}
+ secretName: {{ .Values.global.vault.tls }}
items:
- key: ca.crt.pem
path: ca-certificates.crt
{{ end }}
- {{- if not $.Values.add_orderer }}
+ {{- if not $.Values.orderer.addOrderer }}
- name: genesis
configMap:
- name: {{ $.Values.channel.name }}-genesis-block
+ name: {{ .Release.Name }}-genesis
items:
- - key: genesis.block.base64
+ - key: {{ .Release.Name }}-genesis_base64
path: genesis.block.base64
{{ end }}
- name: certificates
@@ -61,41 +61,53 @@ spec:
name: bevel-vault-script
initContainers:
- name: certificates-init
- image: {{ $.Values.metadata.images.alpineutils }}
+ image: {{ $.Values.image.alpineUtils }}
imagePullPolicy: IfNotPresent
env:
- name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
+ value: {{ $.Values.global.vault.address }}
- name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: VAULT_ADMIN_SECRET_PREFIX
- value: "{{ $.Values.vault.adminsecretprefix }}"
- - name: VAULT_ORDERER_SECRET_PREFIX
- value: "{{ $.Values.vault.orderersecretprefix }}"
- - name: ORDERERS_NAMES
- value: "{{ $.Values.orderers.orderer_info }}"
- - name: COMPONENT_NAME
- value: {{ $.Values.metadata.namespace }}
+ value: {{ $.Values.global.vault.role }}
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ $.Values.global.vault.authPath }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: VAULT_TYPE
+ value: "{{ $.Values.global.vault.type }}"
- name: MOUNT_PATH
value: /secret
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
command: ["sh", "-c"]
args:
- |-
#!/usr/bin/env sh
- source /scripts/bevel-vault.sh
+{{- if eq .Values.global.vault.type "hashicorp" }}
+
+ source /scripts/bevel-vault.sh
vaultBevelFunc "init"
- list=$(echo "$ORDERERS_NAMES" | tr "*" "\n")
- for ORDERER in $list
- do
- ORDERER_NAME="${ORDERER%%,*}"
- # Check if orderer msp already created
- vaultBevelFunc "readJson" "${VAULT_ORDERER_SECRET_PREFIX}/${ORDERER_NAME}.${COMPONENT_NAME}/msp"
+ function getOrdererTlsSecret {
+ KEY=$1
+
+ echo "Getting TLS certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/orderers/${KEY}"
+
+ TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca_crt"]')
+ TLS_SERVER_CERT=$(echo ${VAULT_SECRET} | jq -r '.["server_crt"]')
+ TLS_SERVER_KEY=$(echo ${VAULT_SECRET} | jq -r '.["server_key"]')
+
+ echo "${TLS_CA_CERT}" > ${OUTPUT_PATH}/ca.crt
+ echo "${TLS_SERVER_CERT}" > ${OUTPUT_PATH}/server.crt
+ echo "${TLS_SERVER_KEY}" > ${OUTPUT_PATH}/server.key
+ }
+
+ function getOrdererMspSecret {
+ type=$1
+ KEY=$2
+ echo "Getting MSP certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/${type}/${KEY}"
ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
@@ -103,59 +115,71 @@ spec:
SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ }
+{{- else }}
+
+ function getOrdererTlsSecret {
+ KEY=$1
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+ CACERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacrt' | base64 -d)
+ CLIENTSEVER=$(echo ${KUBENETES_SECRET} | jq -r '.data.servercrt' | base64 -d)
+ CLIENTKEY=$(echo ${KUBENETES_SECRET} | jq -r '.data.serverkey' | base64 -d)
+
+ echo "${CACERT}" > ${OUTPUT_PATH}/ca.crt
+ echo "${CLIENTSEVER}" > ${OUTPUT_PATH}/server.crt
+ echo "${CLIENTKEY}" > ${OUTPUT_PATH}/server.key
+ }
+
+ function getOrdererMspSecret {
+ type=$1
+ KEY=$2
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+
+ ADMINCERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacerts' | base64 -d)
+ KEYSTORE=$(echo ${KUBENETES_SECRET} | jq -r '.data.keystore' | base64 -d)
+ SIGNCERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.signcerts' | base64 -d)
+ TLSCACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.tlscacerts' | base64 -d)
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+
+ }
+{{- end }}
+
+ OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
+ mkdir -p ${OUTPUT_PATH}/admincerts
+ mkdir -p ${OUTPUT_PATH}/cacerts
+ mkdir -p ${OUTPUT_PATH}/keystore
+ mkdir -p ${OUTPUT_PATH}/signcerts
+ mkdir -p ${OUTPUT_PATH}/tlscacerts
+ getOrdererMspSecret users admin-msp
+
+ {{- range $orderer := .Values.orderers }}
+ ORDERER_NAME={{ .name }}
OUTPUT_PATH="${MOUNT_PATH}/${ORDERER_NAME}/msp"
mkdir -p ${OUTPUT_PATH}/admincerts
mkdir -p ${OUTPUT_PATH}/cacerts
mkdir -p ${OUTPUT_PATH}/keystore
mkdir -p ${OUTPUT_PATH}/signcerts
mkdir -p ${OUTPUT_PATH}/tlscacerts
-
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
-
- # Check if orderers tls already created
- vaultBevelFunc "readJson" "${VAULT_ORDERER_SECRET_PREFIX}/${ORDERER_NAME}.${COMPONENT_NAME}/tls"
-
- CACERT=$(echo ${VAULT_SECRET} | jq -r '.["ca.crt"]')
- CLIENTSEVER=$(echo ${VAULT_SECRET} | jq -r '.["server.crt"]')
- CLIENTKEY=$(echo ${VAULT_SECRET} | jq -r '.["server.key"]')
+ getOrdererMspSecret orderers ${ORDERER_NAME}-msp
OUTPUT_PATH="${MOUNT_PATH}/${ORDERER_NAME}/tls"
mkdir -p ${OUTPUT_PATH}
-
- echo "${CACERT}" >> ${OUTPUT_PATH}/ca.crt
- echo "${CLIENTSEVER}" >> ${OUTPUT_PATH}/server.crt
- echo "${CLIENTKEY}" >> ${OUTPUT_PATH}/server.key
- done
-
- ###############################################################################
- echo "Getting MSP certificates from Vault using key $vault_secret_key"
- vaultBevelFunc "readJson" "${VAULT_ADMIN_SECRET_PREFIX}/msp"
-
- ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
- CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
- KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
- SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
- TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
-
- OUTPUT_PATH="${MOUNT_PATH}/admin/msp"
- mkdir -p ${OUTPUT_PATH}/admincerts
- mkdir -p ${OUTPUT_PATH}/cacerts
- mkdir -p ${OUTPUT_PATH}/keystore
- mkdir -p ${OUTPUT_PATH}/signcerts
- mkdir -p ${OUTPUT_PATH}/tlscacerts
-
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ getOrdererTlsSecret ${ORDERER_NAME}-tls
+ {{- end }}
volumeMounts:
- {{ if .Values.vault.tls }}
+ {{ if .Values.global.vault.tls }}
- name: vaultca
mountPath: "/etc/ssl/certs/"
readOnly: true
@@ -167,22 +191,22 @@ spec:
subPath: bevel-vault.sh
containers:
- name: createchannel
- image: {{ $.Values.metadata.images.fabrictools }}
+ image: {{ .Values.image.fabricTools }}:{{ .Values.global.version }}
imagePullPolicy: IfNotPresent
stdin: true
tty: true
+ envFrom:
+ - configMapRef:
+ name: {{ .Release.Name }}-osnadmin-config
env:
- - name: ORDERERS_INFO
- value: "{{ $.Values.orderers.orderer_info }}"
- - name: NAMESPACE
- value: "{{ $.Values.metadata.namespace }}"
- name: ADD_ORDERER
- value: "{{ $.Values.add_orderer }}"
+ value: "{{ .Values.orderer.addOrderer }}"
command: ["sh", "-c"]
args:
- |-
+
#!/usr/bin/env sh
- echo "Fetch genesis file..."
+ echo "Format or fetch genesis file..."
if [ $ADD_ORDERER = false ]
then
cat ./genesis/genesis.block.base64 | base64 -d > orderer.genesis.block
@@ -190,13 +214,13 @@ spec:
peer channel fetch config ${CHANNEL_NAME}_config_block.pb -o ${CORE_PEER_ADDRESS} -c ${CHANNEL_NAME} --tls --cafile ${ORDERER_CA}
fi
- list=$(echo "$ORDERERS_INFO" | tr "*" "\n")
- for ORDERER_NAME in $list
- do
+ {{- range $orderer := .Values.orderers }}
+ ORDERER_NAME={{ .name }}
ADMIN_TLS_PRIVATE_KEY="${ADMIN_TLS_CERTS}/${ORDERER_NAME}/tls/server.key"
ADMIN_TLS_SIGN_CERT="${ADMIN_TLS_CERTS}/${ORDERER_NAME}/tls/server.crt"
OSN_TLS_CA_ROOT_CERT="${ADMIN_TLS_CERTS}/${ORDERER_NAME}/tls/ca.crt"
- ORDERER_URL="${ORDERER_NAME}.${NAMESPACE}:7055"
+ # The ORDERER_URL is hardcoded to use local orderer URL as of now
+ ORDERER_URL="{{ .adminAddress }}"
CHANNEL_LIST_QUERY_RESPONSE=$(osnadmin channel list --channelID ${CHANNEL_NAME} -o "${ORDERER_URL}" --ca-file "${OSN_TLS_CA_ROOT_CERT}" --client-cert "${ADMIN_TLS_SIGN_CERT}" --client-key "${ADMIN_TLS_PRIVATE_KEY}")
if echo "$CHANNEL_LIST_QUERY_RESPONSE" | grep '404'; then
@@ -210,20 +234,17 @@ spec:
osnadmin channel list -o "${ORDERER_URL}" --ca-file "${OSN_TLS_CA_ROOT_CERT}" --client-cert "${ADMIN_TLS_SIGN_CERT}" --client-key "${ADMIN_TLS_PRIVATE_KEY}"
elif echo "$CHANNEL_LIST_QUERY_RESPONSE" | grep '200\|201'; then
echo "Channel ${CHANNEL_NAME}, is already created for url: ${ORDERER_URL}"
- osnadmin channel list --channelID ${CHANNEL_NAME} -o "${ORDERER_URL}" --ca-file "${OSN_TLS_CA_ROOT_CERT}" --client-cert "${ADMIN_TLS_SIGN_CERT}" --client-key "${ADMIN_TLS_PRIVATE_KEY}"
+ echo "$CHANNEL_LIST_QUERY_RESPONSE"
else
echo $CHANNEL_LIST_QUERY_RESPONSE
fi
- done
+ {{- end }}
workingDir: /opt/gopath/src/github.com/hyperledger/fabric/orderer
- envFrom:
- - configMapRef:
- name: {{ $.Values.channel.name }}-config
volumeMounts:
- name: certificates
mountPath: /opt/gopath/src/github.com/hyperledger/fabric/crypto
readOnly: true
- {{- if not $.Values.add_orderer }}
+ {{- if not $.Values.orderer.addOrderer }}
- name: genesis
mountPath: /opt/gopath/src/github.com/hyperledger/fabric/orderer/genesis
readOnly: true
diff --git a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/values.yaml b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/values.yaml
index 44059765ab8..e155f09470f 100644
--- a/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-osnadmin-channel-create/values.yaml
@@ -3,64 +3,64 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
-
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: org1-net
- namespace: org1-net
- #Provide Fabric version
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+---
+# The following are for overriding global values
+global:
+ # HLF Network Version
#Eg. version: 2.5.4
- network:
- version: 2.5.4
- images:
- #Provide the valid image name and version for fabric tools
- #Eg. fabrictools: hyperledger/fabric-tools:2.2.2
- fabrictools: ghcr.io/hyperledger/bevel-fabric-tools:2.5.4
- #Provide the valid image name and version to read certificates from vault server
- #Eg. alpineutils: hyperledgerlabs/alpine-utils:1.0
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name , app.
- #Eg. labels:
- # role: create_channel
- labels:
-
-deployment:
- annotations:
+ version: 2.5.4
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the network type
+ network: fabric
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
+ #Enable or disable TLS for vault communication
+ #Eg. tls: true
+ tls:
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://vault.internal.example.com:9000
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: devorg1-net-auth
- authpath: devorg1-net-auth
- #Provide the value for vault secretprefix
- #Provide the value for vault secretprefix where orderers certificates are stored.
- #Eg. orderersecretprefix: secretsv2/crypto/ordererOrganizations/org1-net/orderers
- orderersecretprefix: secretsv2/crypto/ordererOrganizations/org1-net/orderers
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
+image:
+ #Provide the valid image name and version for fabric tools
+ #Eg. fabricTools: hyperledger/fabric-tools
+ fabricTools: ghcr.io/hyperledger/bevel-fabric-tools
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg. alpineUtils: hyperledgerlabs/alpine-utils:1.0
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
-channel:
- #Provide the name of the channel
- #Eg. name: mychannel
- name: mychannel
+#Provide orderer details
+orderers:
+ - name: orderer1
+ adminAddress: orderer1.supplychain-net:7055 # Internal URI of the orderer ONS Admin service
+ - name: orderer2
+ adminAddress: orderer2.supplychain-net:7055
+ - name: orderer3
+ adminAddress: orderer3.supplychain-net:7055
orderer:
- #Provide orderer's names
- #Eg. address: orderer1*orderer2*orderer3
- orderer_info: orderer1
-
-#Provide the base64 encoded genesis file
-genesis:
+ addOrderer: false
+ name: neworderer
+ localMspId: newordererMSP
+ ordererAddress: neworderer.neworg-net:7050
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/.helmignore b/platforms/hyperledger-fabric/charts/fabric-peernode/.helmignore
new file mode 100644
index 00000000000..014fa775608
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+generated_config/
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/Chart.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/Chart.yaml
index e4003f788ce..407c54689c0 100644
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/Chart.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/Chart.yaml
@@ -5,7 +5,22 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "Hyperledger Fabric: Deploys peer node."
name: fabric-peernode
-version: 1.0.0
+description: "Hyperledger Fabric: Deploys peer node."
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - hlf
+ - fabric
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/README.md b/platforms/hyperledger-fabric/charts/fabric-peernode/README.md
index 1ee770a923d..81a7d8b6f76 100644
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/README.md
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/README.md
@@ -3,232 +3,159 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
-# Peer Node Hyperledger Fabric Deployment
+# fabric-peernode
-- [Peer Node Hyperledger Fabric Deployment Helm Chart](#peer-node-hyperledger-fabric-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
+This chart is a component of Hyperledger Bevel. The fabric-peernode chart deploys a Peer Node for Hyperledger Fabric blockchain network. If enabled, the keys are stored on the configured vault and stored as Kubernetes secrets. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+## TL;DR
-
-## Peer Node Hyperledger Fabric Deployment Helm Chart
----
-A [Helm chart](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-peernode) for peer node.
-
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install peer0 bevel/fabric-peernode
+```
-
## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- HAproxy is required as ingress controller.
-- Helm installed.
+- Kubernetes 1.19+
+- Helm 3.2.0+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-fabric-peernode/
- |- conf/
- |- default_core.yaml
- |- templates/
- |- _helpers.yaml
- |- configmap.yaml
- |- deployment.yaml
- |- service.yaml
- |- servicemonitor.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
+> **Important**: Also check the dependent charts.
-- `default_core.yaml`: Default configuration file for the peer node.
-- `templates/`: Contains the Kubernetes manifest templates that define the resources to be deployed.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: Provides a way to configure the Hyperledger Fabric peer and enable it to join the network, interact with other nodes. The environment variables that are defined in the peer-config ConfigMap are used to configure the peer's runtime behavior. The configuration for the MSP is defined in the msp-config ConfigMap. The core.yaml file is used to configure the chaincode builder
-- `deployment.yaml`: The certificates-init container fetches TLS certificates and other secrets from Vault. The couchdb container runs a CouchDB database that is used to store the ledger state. The {{ $.Values.peer.name }} container runs a Hyperledger Fabric peer that manages the ledger and provides access to the blockchain network. The grpc-web container runs a gRPC-Web proxy that allows gRPC services to be accessed via a web browser.
-- `service.yaml`: Ensures internal and external access with exposed ports for gRPC (7051), events (7053), CouchDB (5984), gRPC-Web (7443), and operations (9443), and optionally uses HAProxy for external exposure and secure communication.
-- `servicemonitor.yaml`: Define a ServiceMonitor resource that allows Prometheus to collect metrics from the peer node's "operations" port. The configuration is conditionally applied based on the availability of the Prometheus Operator's API version and whether metrics are enabled for the peer service.
-- `Chart.yaml`: Contains the metadata for the Helm chart, such as the name, version, and description.
-- `README.md`: Provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the Helm chart.
-
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-fabric/charts/fabric-peernode/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-### Metadata
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------------------------------------------| --------------------------------------------------|
-| namespace | Provide the namespace for organization's peer | org1-net |
-| images.couchdb | valid image name and version for fabric couchdb | ghcr.io/hyperledger/bevel-fabric-couchdb:2.2.2 |
-| images.peer | valid image name and version for fabric peer | ghcr.io/hyperledger/bevel-fabric-peer:2.2.2 |
-| images.alpineutils | valid image name and version to read certificates from vault server | ghcr.io/hyperledger/bevel-alpine:latest |
-| labels | Provide custom labels | "" |
-
-### Annotations
-
-| Name | Description | Default Value |
-| ---------------| --------------------------------------- | --------------|
-| service | Extra annotations for service | "" |
-| pvc | Extra annotations for pvc | "" |
-| deployment | Extra annotations for deployment | "" |
+## Installing the Chart
-### Peer
+To install the chart with the release name `peer0`:
-| Name | Description | Default Value |
-| ------------------------------------------| ----------------------------------------------------------------------| ----------------------------------------------|
-| name | Name of the peer as per deployment yaml | peer0 |
-| gossippeeraddress | URL of gossipping peer and port for grpc | peer1.org1-net.svc.cluster.local:7051 |
-| gossipexternalendpoint | URL of gossip external endpoint and port for haproxy https service | peer0.org1-net.org1proxy.blockchaincloudpoc.com:443 |
-| localmspid | Local MSP ID for the organization | Org1MSP |
-| loglevel | Log level for organization's peer | info |
-| tlsstatus | Set to true or false for organization's peer | true |
-| builder | Valid chaincode builder image for Fabric | hyperledger/fabric-ccenv:2.2.2 |
-| couchdb.username | CouchDB username (mandatory if provided) | org1-user |
-| configpath | Provide the configuration path | "" |
-| core | Provide core configuration | "" |
-| mspconfig.organizationalunitidentifiers | Provide the members of the MSP in organizational unit identifiers | "" |
-| mspconfig.nodeOUs.clientOUidentifier.organizationalunitidentifier | Organizational unit identifier for client nodes | client |
-| mspconfig.nodeOUs.peerOUidentifier.organizationalunitidentifier | Organizational unit identifier for peer nodes | peer |
-| mspconfig.nodeOUs.adminOUidentifier.organizationalunitidentifier | Organizational unit identifier for admin nodes (2.2.x) | admin |
-| mspconfig.nodeOUs.ordererOUidentifier.organizationalunitidentifier | Organizational unit identifier for orderer nodes (2.2.x) | orderer |
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install peer0 bevel/fabric-peernode
+```
-### Storage
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-| Name | Description | Default Value |
-| --------------------------| -------------------------------- | ------------------- |
-| peer.storageclassname | Storage class name for peer | aws-storageclass |
-| peer.storagesize | Storage size for peer | 512Mi |
-| couchdb.storageclassname | Storage class name for CouchDB | aws-storageclass |
-| couchdb.storagesize | Storage size for CouchDB | 512Mi |
-
-### Vault
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------------------------------------------| --------------------------------------------------|
-| role | Vault role for the organization | vault-role |
-| address | Vault server address | "" |
-| authpath | Kubernetes auth backend configured in vault for the organization | devorg1-net-auth |
-| secretprefix | Vault secret prefix | ssecretsv2/data/crypto/peerOrganizations/org1-net/peers/peer0.org1-net |
-| serviceaccountname | Service account name for vault | vault-auth |
-| type | Provide the type of vault | hashicorp |
-| imagesecretname | Image secret name for vault | "" |
-| secretcouchdbpass | Vault path for secret CouchDB password | secretsv2/data/credentials/org1-net/couchdb/org1?user |
-| tls | Enable or disable TLS for vault communication | "" |
-
-### Service
-
-| Name | Description | Default Value |
-| ----------------------------- | ------------------------------------------| ------------------- |
-| servicetype | Service type for the peer | ClusterIP |
-| loadBalancerType | Load balancer type for the peer | "" |
-| ports.grpc.nodeport | Cluster IP port for grpc service | "" |
-| ports.grpc.clusteripport | Cluster IP port for grpc service | 7051 |
-| ports.events.nodeport | Cluster IP port for event service | "" |
-| ports.events.clusteripport | Cluster IP port for event service | 7053 |
-| ports.couchdb.nodeport | Cluster IP port for CouchDB service | "" |
-| ports.couchdb.clusteripport | Cluster IP port for CouchDB service | 5984 |
-| ports.metrics.enabled | Enable/disable metrics service | false |
-| ports.metrics.clusteripport | Cluster IP port for metrics service | 9443 |
-
-### Proxy
-
-| Name | Description | Default Value |
-| ----------------------| ----------------------------------------------------------| ------------------- |
-| provider | Proxy/ingress provider ( haproxy or none) | none |
-| external_url_suffix | External URL of the organization | org1proxy.blockchaincloudpoc.com |
-| port | External port on proxy service | 443 |
-
-### Config
-
-| Name | Description | Default Value |
-| ----------------------------- | --------------------------- | ------------------- |
-| pod.resources.limits.memory | Limit memory for node | 512M |
-| pod.resources.limits.cpu | Limit CPU for node | 1 |
-| pod.resources.requests.memory | Requested memory for node | 512M |
-| pod.resources.requests.cpu | Requested CPU for node | 0.25 |
-
-
-
-## Deployment
----
-
-To deploy the fabric-peernode Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-peernode/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./fabric-peernode
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the fabric-peernode node to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the deployment, we can use the following command:
-```
-$ kubectl get statefulsets -n
-```
-Replace `` with the actual namespace where the StatefulSet was created. This command will display information about the StatefulSet, including the number of replicas and their current status.
+> **Tip**: List all releases using `helm list`
+## Uninstalling the Chart
-
-## Updating the Deployment
----
+To uninstall/delete the `peer0` deployment:
-If we need to update the deployment with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-peernode/values.yaml) file with the desired changes and run the following Helm command:
+```bash
+helm uninstall peer0
```
-$ helm upgrade ./fabric-peernode
-```
-Replace `` with the name of the release. This command will apply the changes to the deployment, ensuring the fabric-peernode node is up to date.
-
-
-## Deletion
----
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global
+
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.version` | Fabric Version. | `2.5.4` |
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` are tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `supplychain` |
+| `global.vault.secretEngine` | Vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | Vault secret prefix which must start with `data/` | `data/supplychain` |
+| `global.vault.tls` | Name of the Kubernetes secret which has certs to connect to TLS enabled Vault | `""` |
+| `global.proxy.provider` | The proxy or Ingress provider. Can be `none` or `haproxy` | `haproxy` |
+| `global.proxy.externalUrlSuffix` | The External URL suffix at which the Fabric GRPC services will be available | `test.blockchaincloudpoc.com` |
+| `global.proxy.port` | The External Port on the proxy | `443` |
-To delete the deployment and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
+### Storage
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `storage.enabled` | Flag to enable Storage Class creation for the Peer, set to `false` when using same peer name in different organizations | `true` |
+| `storage.peer` | Size of the PVC needed for Peer Node | `512Mi` |
+| `storage.couchdb` | Size of the PVC needed for CouchDB Database | `512Mi` |
+| `storage.reclaimPolicy` | Reclaim policy for the PVC. Choose from: `Delete` or `Retain` | `Delete` |
+| `storage.volumeBindingMode` | Volume binding mode for the PVC. Choose from: `Immediate` or `WaitForFirstConsumer` | `Immediate` |
+| `storage.allowedTopologies.enabled` | Check [bevel-storageclass](../../../shared/charts/bevel-storageclass/README.md) for details | `false` |
+
+### Certs
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `certs.generateCertificates` | Flag to generate certificates for the Peer Node | `true` |
+| `certs.orgData.caAddress` | Address of the CA Server without https | `ca.supplychain-net:7051` |
+| `certs.orgData.caAdminUser` | CA Admin Username | `supplychain-admin` |
+| `certs.orgData.caAdminPassword` | CA Admin Password | `supplychain-adminpw` |
+| `certs.orgData.orgName` | Organization Name | `supplychain` |
+| `certs.orgData.type` | Type of certificate to generate, choosed from `orderer` or `peer` | `peer` |
+| `certs.orgData.componentSubject` | X.509 subject for the organization | `"O=Peer,L=51.50/-0.13/London,C=GB"` |
+| `certs.users.usersList` | Array of Users with their attributes | `""` |
+| `certs.settings.createConfigMaps` | Flag to create configmaps. Must be set to `false` for additional orderers/peers in the same organization. | `false` |
+| `certs.settings.refreshCertValue` | Flag to refresh User certificates | `false` |
+| `certs.settings.addPeerValue` | Flag to be used when adding a new peer to the organization | `false` |
+| `certs.settings.removeCertsOnDelete` | Flag to delete the user and peer certificates on uninstall | `false` |
+| `certs.settings.removePeerTlsOnDelete` | Flag to delete the orderer TLS certificates on uninstall | `false` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.couchdb` | CouchDB image repository | `ghcr.io/hyperledger/bevel-fabric-couchdb` |
+| `image.peer` | Fabric Peer image repository | `ghcr.io/hyperledger/bevel-fabric-peer` |
+| `image.alpineUtils` | Alpine utils image repository and tag | `ghcr.io/hyperledger/bevel-alpine:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [Peer Node Hyperledger Fabric Deployment Helm Chart](https://github.com/hyperledger/bevel/blob/main/platforms/hyperledger-fabric/charts/fabric-peernode), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+### Peer
+| Name | Description | Default Value |
+|--------|---------|-------------|
+| `peer.gossipPeerAddress` | Internal or External Address of the Gossip Peer Node, leave empty to use Peer's own address | `peer1.supplychain-net:7051` |
+| `peer.logLevel` | Log level for the Peer Node | `info` |
+| `peer.localMspId` | Local MSP ID for the Peer Organization | `supplychainMSP` |
+| `peer.tlsStatus` | TLS status of the Peer Node | `true` |
+| `peer.cliEnabled` | Flag to deploy the Peer CLI. Check [fabric-cli](../fabric-cli/README.md) for details | `false` |
+| `peer.ordererAddress` | Orderer Internal or External Address with port for CLI to connect | `orderer1.supplychain-net:7050` |
+| `peer.builder` | Chaincode Builder Image repository | `hyperledger/fabric-ccenv` |
+| `peer.couchdb.username` | CouchDB User Name | `supplychain-user` |
+| `peer.couchdb.password` | CouchDB User Password | ` supplychain-userpw` |
+| `peer.mspConfig.organizationalUnitIdentifiers` | List of Organizational Unit Identifiers for Peer MSP Config | `""` |
+| `peer.mspConfig.nodeOUs.clientOUIdentifier` | Organizational Unit Identifier to identify node as client | `client` |
+| `peer.mspConfig.nodeOUs.peerOUIdentifier` | Organizational Unit Identifier to identify node as peer | `peer` |
+| `peer.mspConfig.nodeOUs.adminOUIdentifier` | Organizational Unit Identifier to identify node as admin | `admin` |
+| `peer.mspConfig.nodeOUs.ordererOUIdentifier` | Organizational Unit Identifier to identify node as orderer | `orderer` |
+| `peer.serviceType` | Service Type for the GRPC Service | `ClusterIP` |
+| `peer.loadBalancerType` | Load Balancer Type for the GRPC Service | `""` |
+| `peer.ports.grpc.nodePort` | NodePort for the Peer GRPC Service | `""` |
+| `peer.ports.grpc.clusterIpPort` | TCP Port for the Peer GRPC Service | `7051` |
+| `peer.ports.events.nodePort` | NodePort for the Peer Events Service | `""` |
+| `peer.ports.events.clusterIpPort` | TCP Port for the Peer Events Service | `7053` |
+| `peer.ports.couchdb.nodePort` | NodePort for the CouchDB Service | `""` |
+| `peer.ports.couchdb.clusterIpPort` | TCP Port for the CouchDB Service | `5984` |
+| `peer.ports.metrics.enabled` | Flag to enable metrics port | `false` |
+| `peer.ports.metrics.clusterIpPort` | TCP Port for the Peer metrics | `9443` |
+| `peer.resources.limits.memory` | Memory limit for the Peer Node | `1Gi` |
+| `peer.resources.limits.cpu` | CPU limit for the Peer Node | `1` |
+| `peer.resources.requests.memory` | Memory request for the Peer Node | `512M` |
+| `peer.resources.requests.cpu` | CPU request for the Peer Node | `0.25` |
+| `peer.upgrade` | Flag to denote that Peer is being upgraded | `false` |
+| `peer.healthCheck.retries` | Retry count to connect to Vault | `20` |
+| `peer.healthCheck.sleepTimeAfterError` | Wait seconds after unsuccessful connection attempt | `15` |
+
+### Labels
+
+| Name | Description | Default Value |
+| ----------------| ----------- | ------------- |
+| `labels.service` | Array of Labels for service object | `[]` |
+| `labels.pvc` | Array of Labels for PVC object | `[]` |
+| `labels.deployment` | Array of Labels for deployment or statefulset object | `[]` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/files/readme.txt b/platforms/hyperledger-fabric/charts/fabric-peernode/files/readme.txt
new file mode 100644
index 00000000000..1a177b74f91
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/files/readme.txt
@@ -0,0 +1 @@
+This is a dummy file. Place the orderer.crt file in this directory..
\ No newline at end of file
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/requirements.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/requirements.yaml
new file mode 100644
index 00000000000..d00f80f0495
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/requirements.yaml
@@ -0,0 +1,22 @@
+dependencies:
+ - name: bevel-storageclass
+ alias: storage
+ repository: "file://../../../shared/charts/bevel-storageclass"
+ tags:
+ - storage
+ version: ~1.0.0
+ condition: storage.enabled
+ - name: fabric-catools
+ alias: certs
+ repository: "file://../fabric-catools"
+ tags:
+ - catools
+ version: ~1.1.0
+ condition: certs.generateCertificates
+ - name: fabric-cli
+ alias: peer
+ repository: "file://../fabric-cli"
+ tags:
+ - cli
+ version: ~1.1.0
+ condition: peer.cliEnabled
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/_helpers.tpl b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/_helpers.tpl
index 7bf5f530a8e..3996d38ea7c 100644
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/_helpers.tpl
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/_helpers.tpl
@@ -1,5 +1,46 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
\ No newline at end of file
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "fabric-peernode.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "fabric-peernode.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "fabric-peernode.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "labels.deployment" -}}
+{{- range $value := .Values.labels.deployment }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.service" -}}
+{{- range $value := .Values.labels.service }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
+
+{{- define "labels.pvc" -}}
+{{- range $value := .Values.labels.pvc }}
+{{ toYaml $value }}
+{{- end }}
+{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/configmap.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/configmap.yaml
index d582db7b489..380ab1500c3 100644
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/configmap.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/configmap.yaml
@@ -7,28 +7,35 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ $.Values.peer.name }}-config
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-config
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: {{ $.Values.peer.name }}-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ app.kubernetes.io/name: {{ .Release.Name }}-config
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
data:
CORE_VM_ENDPOINT: unix:///host/var/run/docker.sock
- CORE_PEER_ID: {{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}
- FABRIC_LOGGING_SPEC: "grpc=debug:{{ $.Values.peer.loglevel }}"
+ CORE_PEER_ID: {{ .Release.Name }}.{{ .Release.Namespace }}
+ FABRIC_LOGGING_SPEC: "grpc=debug:{{ .Values.peer.logLevel }}"
CORE_LEDGER_STATE_STATEDATABASE: CouchDB
CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS: localhost:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME: "{{ $.Values.peer.couchdb.username }}"
- CORE_PEER_ADDRESS: {{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}:{{ $.Values.service.ports.grpc.clusteripport }}
- CORE_PEER_GOSSIP_BOOTSTRAP: {{ $.Values.peer.gossippeeraddress }}
- {{ if $.Values.peer.gossipexternalendpoint }}
- CORE_PEER_GOSSIP_EXTERNALENDPOINT: {{ $.Values.peer.gossipexternalendpoint }}
- {{ end }}
- CORE_PEER_LOCALMSPID: {{ $.Values.peer.localmspid }}
- CORE_PEER_TLS_ENABLED: "{{ $.Values.peer.tlsstatus }}"
+ CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME: "{{ .Values.peer.couchdb.username }}"
+ CORE_PEER_ADDRESS: {{ .Release.Name }}.{{ .Release.Namespace }}:{{ .Values.peer.ports.grpc.clusterIpPort }}
+ {{- if .Values.peer.gossipPeerAddress }}
+ CORE_PEER_GOSSIP_BOOTSTRAP: {{ .Values.peer.gossipPeerAddress }}
+ {{- else }}
+ CORE_PEER_GOSSIP_BOOTSTRAP: {{ .Release.Name }}.{{ .Release.Namespace }}:{{ .Values.peer.ports.grpc.clusterIpPort }}
+ {{- end }}
+ {{- if eq .Values.global.proxy.provider "none" }}
+ CORE_PEER_GOSSIP_EXTERNALENDPOINT: {{ .Release.Name }}.{{ .Release.Namespace }}:{{ .Values.peer.ports.grpc.clusterIpPort }}
+ {{- else }}
+ CORE_PEER_GOSSIP_EXTERNALENDPOINT: {{ .Release.Name }}.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}:{{ .Values.global.proxy.port }}
+ {{- end }}
+ CORE_PEER_LOCALMSPID: {{ .Values.peer.localMspId }}
+ CORE_PEER_TLS_ENABLED: "{{ .Values.peer.tlsStatus }}"
CORE_PEER_TLS_CERT_FILE: /etc/hyperledger/fabric/crypto/tls/server.crt
CORE_PEER_TLS_KEY_FILE: /etc/hyperledger/fabric/crypto/tls/server.key
CORE_PEER_TLS_ROOTCERT_FILE: /etc/hyperledger/fabric/crypto/msp/tlscacerts/tlsca.crt
@@ -36,58 +43,82 @@ data:
CORE_PEER_GOSSIP_ORGLEADER: "false"
CORE_PEER_PROFILE_ENABLED: "true"
CORE_PEER_ADDRESSAUTODETECT: "true"
- CORE_PEER_NETWORKID: {{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}
+ CORE_PEER_NETWORKID: {{ .Release.Name }}.{{ .Release.Namespace }}
CORE_PEER_MSPCONFIGPATH: /etc/hyperledger/fabric/crypto/msp
GODEBUG: "netdns=go"
CORE_PEER_GOSSIP_SKIPHANDSHAKE: "true"
- CORE_CHAINCODE_BUILDER: "{{ $.Values.peer.builder }}"
+ CORE_CHAINCODE_BUILDER: "{{ .Values.peer.builder }}:{{ .Values.global.version }}"
CORE_OPERATIONS_LISTENADDRESS: 0.0.0.0:9443
---
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ $.Values.peer.name }}-msp-config
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-msp-config
+ namespace: {{ .Release.Namespace }}
labels:
- app.kubernetes.io/name: {{ $.Values.peer.name }}-msp-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ app.kubernetes.io/name: {{ .Release.Name }}-msp-config
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
data:
- mspconfig: |
- {{if ($.Values.peer.mspconfig.organizationalunitidentifiers) }}
- OrganizationalUnitIdentifiers:{{ range $.Values.peer.mspconfig.organizationalunitidentifiers }}
+ mspConfig: |-
+
+ {{- if (.Values.peer.mspConfig.organizationalUnitIdentifiers) }}
+ OrganizationalUnitIdentifiers:
+ {{- range .Values.peer.mspConfig.organizationalUnitIdentifiers }}
- Certificate: cacerts/ca.crt
- OrganizationalUnitIdentifier: {{ . }}{{ end }}{{end}}
+ OrganizationalUnitIdentifier: {{ . }}
+ {{- end }}
+ {{- end }}
NodeOUs:
Enable: true
ClientOUIdentifier:
Certificate: cacerts/ca.crt
- OrganizationalUnitIdentifier: {{ $.Values.peer.mspconfig.nodeOUs.clientOUidentifier.organizationalunitidentifier }}
+ OrganizationalUnitIdentifier: {{ .Values.peer.mspConfig.nodeOUs.clientOUIdentifier }}
PeerOUIdentifier:
Certificate: cacerts/ca.crt
- OrganizationalUnitIdentifier: {{ $.Values.peer.mspconfig.nodeOUs.peerOUidentifier.organizationalunitidentifier }}
+ OrganizationalUnitIdentifier: {{ .Values.peer.mspConfig.nodeOUs.peerOUIdentifier }}
AdminOUIdentifier:
Certificate: cacerts/ca.crt
- OrganizationalUnitIdentifier: {{ $.Values.peer.mspconfig.nodeOUs.adminOUidentifier.organizationalunitidentifier }}
+ OrganizationalUnitIdentifier: {{ .Values.peer.mspConfig.nodeOUs.adminOUIdentifier }}
OrdererOUIdentifier:
Certificate: cacerts/ca.crt
- OrganizationalUnitIdentifier: {{ $.Values.peer.mspconfig.nodeOUs.ordererOUidentifier.organizationalunitidentifier }}
+ OrganizationalUnitIdentifier: {{ .Values.peer.mspConfig.nodeOUs.ordererOUIdentifier }}
-{{ if $.Values.peer.configpath }}
---
apiVersion: v1
kind: ConfigMap
metadata:
- name: builders-config
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}-builders-config
+ namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: builders-config
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
data:
- core.yaml.base64: {{ .Values.peer.core | quote }}
-{{ end }}
\ No newline at end of file
+ core.yaml: {{ .Files.Get "conf/default_core.yaml" | nindent 8 | quote }}
+
+{{- $orderercrt := .Files.Get "files/orderer.crt" }}
+{{ if $orderercrt }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ .Release.Name }}-orderer-tls-cacert
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/name: orderer-tls-cacert
+ app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/part-of: {{ include "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+data:
+ cacert: |-
+ {{ .Files.Get "files/orderer.crt" | nindent 8 }}
+{{- end }}
\ No newline at end of file
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/deployment.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/deployment.yaml
deleted file mode 100755
index f3123e7ddfd..00000000000
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/deployment.yaml
+++ /dev/null
@@ -1,326 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: apps/v1
-kind: StatefulSet
-metadata:
- name: {{ $.Values.peer.name }}
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- name: {{ $.Values.peer.name }}
- app.kubernetes.io/name: {{ $.Values.peer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.deployment }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
-spec:
- updateStrategy:
- type: RollingUpdate
- serviceName: "{{ $.Values.peer.name }}"
- replicas: 1
- selector:
- matchLabels:
- app: {{ $.Values.peer.name }}
- app.kubernetes.io/name: {{ $.Values.peer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- template:
- metadata:
- annotations:
- checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
- labels:
- app: {{ $.Values.peer.name }}
- app.kubernetes.io/name: {{ $.Values.peer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- spec:
- serviceAccountName: {{ $.Values.vault.serviceaccountname }}
- {{- if .Values.vault.imagesecretname }}
- imagePullSecrets:
- - name: {{ $.Values.vault.imagesecretname }}
- {{- end }}
- initContainers:
- - name: certificates-init
- image: {{ $.Values.metadata.images.alpineutils}}
- imagePullPolicy: IfNotPresent
- env:
- - name: VAULT_ADDR
- value: {{ $.Values.vault.address }}
- - name: VAULT_SECRET_PREFIX
- value: "{{ $.Values.vault.secretprefix }}"
- - name: KUBERNETES_AUTH_PATH
- value: {{ $.Values.vault.authpath }}
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: MOUNT_PATH
- value: /secret
- - name: VAULT_TYPE
- value: "{{ $.Values.vault.type }}"
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- . /scripts/bevel-vault.sh
-
- # Calling a function to retrieve the vault token.
- vaultBevelFunc "init"
-
- echo "Getting TLS certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_SECRET_PREFIX}/tls"
-
- TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca.crt"]')
- TLS_SERVER_CERT=$(echo ${VAULT_SECRET} | jq -r '.["server.crt"]')
- TLS_SERVER_KEY=$(echo ${VAULT_SECRET} | jq -r '.["server.key"]')
-
- OUTPUT_PATH="${MOUNT_PATH}/tls"
- mkdir -p ${OUTPUT_PATH}
- echo "${TLS_CA_CERT}" >> ${OUTPUT_PATH}/ca.crt
- echo "${TLS_SERVER_CERT}" >> ${OUTPUT_PATH}/server.crt
- echo "${TLS_SERVER_KEY}" >> ${OUTPUT_PATH}/server.key
-
- echo "Getting MSP certificates from Vault."
- vaultBevelFunc "readJson" "${VAULT_SECRET_PREFIX}/msp"
-
- ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
- CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
- KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
- SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
- TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
-
- OUTPUT_PATH="${MOUNT_PATH}/msp"
- mkdir -p ${OUTPUT_PATH}/admincerts
- mkdir -p ${OUTPUT_PATH}/cacerts
- mkdir -p ${OUTPUT_PATH}/keystore
- mkdir -p ${OUTPUT_PATH}/signcerts
- mkdir -p ${OUTPUT_PATH}/tlscacerts
-
- echo "${ADMINCERT}" >> ${OUTPUT_PATH}/admincerts/admin.crt
- echo "${CACERTS}" >> ${OUTPUT_PATH}/cacerts/ca.crt
- echo "${KEYSTORE}" >> ${OUTPUT_PATH}/keystore/server.key
- echo "${SIGNCERTS}" >> ${OUTPUT_PATH}/signcerts/server.crt
- echo "${TLSCACERTS}" >> ${OUTPUT_PATH}/tlscacerts/tlsca.crt
-
- # COUCH_DB CREDENTIALS
- echo "Getting couch db credentials"
- SECRET_COUCHDB_PASS={{ $.Values.vault.secretcouchdbpass }}
- if [ ! -z $SECRET_COUCHDB_PASS ]
- then
- vault_secret_key=$(echo ${SECRET_COUCHDB_PASS} |awk -F "?" '{print $1}')
- vault_data_key=$(echo ${SECRET_COUCHDB_PASS} |awk -F "?" '{print $2}')
-
- # Calling a function to retrieve secrets from Vault only if they exist.
- vaultBevelFunc "readJson" "${vault_secret_key}"
-
- PASSWORD=$(echo ${VAULT_SECRET} | jq -r ".[\"${vault_data_key}\"]")
- echo "${PASSWORD}" >> ${MOUNT_PATH}/user_cred
- fi
- volumeMounts:
- {{ if .Values.vault.tls }}
- - name: vaultca
- mountPath: "/etc/ssl/certs/"
- readOnly: true
- {{ end }}
- - name: certificates
- mountPath: /secret
- - name: scripts-volume
- mountPath: /scripts/bevel-vault.sh
- subPath: bevel-vault.sh
- containers:
- - name: couchdb
- image: {{ $.Values.metadata.images.couchdb }}
- imagePullPolicy: IfNotPresent
- command: ["sh", "-c"]
- args:
- - |-
- chown -R couchdb:couchdb /opt/couchdb
- chmod -R 0770 /opt/couchdb/data
- chmod 664 /opt/couchdb/etc/*.ini
- chmod 664 /opt/couchdb/etc/local.d/*.ini
- chmod 775 /opt/couchdb/etc/*.d
- if [ -e /etc/hyperledger/fabric/crypto/user_cred ] && [ -z $COUCHDB_USER ]
- then
- echo " Error! Please provide username for the password "
- exit 1
- break
- elif [ -e /etc/hyperledger/fabric/crypto/user_cred ] && [ ! -z $COUCHDB_USER ]
- then
- export COUCHDB_PASSWORD=`cat /etc/hyperledger/fabric/crypto/user_cred`
- break
- elif [ ! -e /etc/hyperledger/fabric/crypto/user_cred ] && [ ! -z $COUCHDB_USER ]
- then
- echo " Error! Please provide password for username $COUCHDB_USER "
- exit 1
- break
- else
- :
- fi
- tini -- /docker-entrypoint.sh /opt/couchdb/bin/couchdb
- ports:
- - containerPort: 5984
- env:
- - name: COUCHDB_USER
- value: "{{ $.Values.peer.couchdb.username }}"
- volumeMounts:
- - name: datadir-couchdb
- mountPath: /opt/couchdb/data
- - name: certificates
- mountPath: /etc/hyperledger/fabric/crypto
- - name: {{ $.Values.peer.name }}
- image: {{ $.Values.metadata.images.peer }}
- imagePullPolicy: IfNotPresent
- command: ["sh", "-c"]
- args:
- - |-
- if [ -e /builders/external/core.yaml.base64 ]; then
- cat /builders/external/core.yaml.base64 | base64 -d > $FABRIC_CFG_PATH/core.yaml
- fi
- cp /etc/hyperledger/fabric/NodeOUconfig/mspconfig /etc/hyperledger/fabric/crypto/msp/config.yaml
- export CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=`cat /etc/hyperledger/fabric/crypto/user_cred`
- version=$( echo ${PEER_IMAGE} | sed 's/.*://' | cut -d '.' -f -2 )
- if [ $version = "2.2" ] && [ ${IS_UPGRADE} = "true" ]
- then
- peer node upgrade-dbs
- fi
- peer node start
- ports:
- - name: grpc
- containerPort: 7051
- - name: events
- containerPort: 7053
- - name: operations
- containerPort: 9443
- env:
- - name: PEER_IMAGE
- value: "{{ $.Values.metadata.images.peer }}"
- - name: IS_UPGRADE
- value: "{{ $.Values.upgrade }}"
- envFrom:
- - configMapRef:
- name: {{ $.Values.peer.name }}-config
- volumeMounts:
- - name: datadir
- mountPath: /var/hyperledger/production
- - name: dockersocket
- mountPath: /host/var/run/docker.sock
- - name: certificates
- mountPath: /etc/hyperledger/fabric/crypto
- - name: {{ $.Values.peer.name }}-msp-config-volume
- mountPath: /etc/hyperledger/fabric/NodeOUconfig
- readOnly: true
- {{ if $.Values.peer.configpath }}
- - name: builders-config
- mountPath: /builders/external
- {{ end }}
- resources:
- requests:
- memory: {{ .Values.config.pod.resources.requests.memory }}
- cpu: {{ .Values.config.pod.resources.requests.cpu }}
- limits:
- memory: {{ .Values.config.pod.resources.limits.memory }}
- cpu: {{ .Values.config.pod.resources.limits.cpu }}
- - name: grpc-web
- image: "ghcr.io/hyperledger-labs/grpc-web:latest"
- imagePullPolicy: IfNotPresent
- ports:
- - name: grpc-web
- containerPort: 7443
- env:
- - name: BACKEND_ADDRESS
- value: "{{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}:{{ $.Values.service.ports.grpc.clusteripport }}"
- - name: SERVER_TLS_CERT_FILE
- value: /certs/tls/server.crt
- - name: SERVER_TLS_KEY_FILE
- value: /certs/tls/server.key
- - name: BACKEND_TLS_CA_FILES
- value: /certs/tls/ca.crt
- - name: SERVER_BIND_ADDRESS
- value: "0.0.0.0"
- - name: SERVER_HTTP_DEBUG_PORT
- value: "8080"
- - name: SERVER_HTTP_TLS_PORT
- value: "7443"
- - name: BACKEND_TLS
- value: "true"
- - name: SERVER_HTTP_MAX_WRITE_TIMEOUT
- value: 5m
- - name: SERVER_HTTP_MAX_READ_TIMEOUT
- value: 5m
- - name: USE_WEBSOCKETS
- value: "true"
- volumeMounts:
- - name: certificates
- mountPath: /certs
- volumes:
- {{ if .Values.vault.tls }}
- - name: vaultca
- secret:
- secretName: {{ $.Values.vault.tls }}
- items:
- - key: ca.crt.pem
- path: ca-certificates.crt
- {{ end }}
- {{ if $.Values.peer.configpath }}
- - name: builders-config
- configMap:
- name: builders-config
- {{ end }}
- - name: certificates
- emptyDir:
- medium: Memory
- - name: dockersocket
- hostPath:
- path: /var/run/docker.sock
- - name: {{ $.Values.peer.name }}-msp-config-volume
- configMap:
- name: {{ $.Values.peer.name }}-msp-config
- items:
- - key: mspconfig
- path: mspconfig
- - name: scripts-volume
- configMap:
- name: bevel-vault-script
- volumeClaimTemplates:
- #Lables are not being taken by Kubernetes as it dynamically creates PVC
- - metadata:
- name: datadir
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.pvc }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
- spec:
- accessModes: [ "ReadWriteOnce" ]
- storageClassName: {{ .Values.storage.peer.storageclassname }}
- resources:
- requests:
- storage: {{ .Values.storage.peer.storagesize }}
- - metadata:
- name: datadir-couchdb
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.pvc }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
- spec:
- accessModes: [ "ReadWriteOnce" ]
- storageClassName: {{ .Values.storage.couchdb.storageclassname }}
- resources:
- requests:
- storage: {{ .Values.storage.couchdb.storagesize }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/node-statefulset.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/node-statefulset.yaml
new file mode 100755
index 00000000000..221e18c0d10
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/node-statefulset.yaml
@@ -0,0 +1,383 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: {{ template "fabric-peernode.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ template "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ {{- include "labels.deployment" . | nindent 4 }}
+spec:
+ updateStrategy:
+ type: RollingUpdate
+ serviceName: {{ .Release.Name }}
+ replicas: 1
+ selector:
+ matchLabels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ template "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ template:
+ metadata:
+ annotations:
+ checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ template "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ {{- include "labels.deployment" . | nindent 8 }}
+ spec:
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ {{- if .Values.image.pullSecret }}
+ imagePullSecrets:
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ initContainers:
+ - name: certificates-init
+ image: {{ .Values.image.alpineUtils }}
+ imagePullPolicy: IfNotPresent
+ env:
+ - name: VAULT_ADDR
+ value: {{ .Values.global.vault.address }}
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: KUBERNETES_AUTH_PATH
+ value: {{ .Values.global.vault.authPath }}
+ - name: VAULT_APP_ROLE
+ value: {{ .Values.global.vault.role }}
+ - name: MOUNT_PATH
+ value: /secret
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
+ - name: PEER_NAME
+ value: {{ .Release.Name }}
+ command: ["sh", "-c"]
+ args:
+ - |-
+ #!/usr/bin/env sh
+
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . /scripts/bevel-vault.sh
+
+ # Calling a function to retrieve the vault token.
+ vaultBevelFunc "init"
+
+ function getPeerTlsSecret {
+ KEY=$1-tls
+
+ echo "Getting TLS certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/peers/${KEY}"
+ if [ "$SECRETS_AVAILABLE" == "yes" ]
+ then
+ TLS_CA_CERT=$(echo ${VAULT_SECRET} | jq -r '.["ca_crt"]')
+ TLS_SERVER_CERT=$(echo ${VAULT_SECRET} | jq -r '.["server_crt"]')
+ TLS_SERVER_KEY=$(echo ${VAULT_SECRET} | jq -r '.["server_key"]')
+
+ echo "${TLS_CA_CERT}" > ${OUTPUT_PATH}/ca.crt
+ echo "${TLS_SERVER_CERT}" > ${OUTPUT_PATH}/server.crt
+ echo "${TLS_SERVER_KEY}" > ${OUTPUT_PATH}/server.key
+ PEER_TLS_SECRET=true
+ else
+ PEER_TLS_SECRET=false
+ fi
+ }
+
+ function getPeerMspSecret {
+ KEY=$1-msp
+
+ echo "Getting MSP certificates from Vault."
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/peers/${KEY}"
+ if [ "$SECRETS_AVAILABLE" == "yes" ]
+ then
+ ADMINCERT=$(echo ${VAULT_SECRET} | jq -r '.["admincerts"]')
+ CACERTS=$(echo ${VAULT_SECRET} | jq -r '.["cacerts"]')
+ KEYSTORE=$(echo ${VAULT_SECRET} | jq -r '.["keystore"]')
+ SIGNCERTS=$(echo ${VAULT_SECRET} | jq -r '.["signcerts"]')
+ TLSCACERTS=$(echo ${VAULT_SECRET} | jq -r '.["tlscacerts"]')
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ PEER_MSP_SECRET=true
+ else
+ PEER_MSP_SECRET=false
+ fi
+ }
+
+{{- else }}
+ function getPeerTlsSecret {
+ KEY=$1-tls
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ PEER_TLS_SECRET=false
+ else
+ TLS_CA_CERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacrt' | base64 -d)
+ TLS_SERVER_CERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.servercrt' | base64 -d)
+ TLS_SERVER_KEY=$(echo ${KUBENETES_SECRET} | jq -r '.data.serverkey' | base64 -d)
+
+ echo "${TLS_CA_CERT}" > ${OUTPUT_PATH}/ca.crt
+ echo "${TLS_SERVER_CERT}" > ${OUTPUT_PATH}/server.crt
+ echo "${TLS_SERVER_KEY}" > ${OUTPUT_PATH}/server.key
+ PEER_TLS_SECRET=true
+ fi
+ }
+
+ function getPeerMspSecret {
+ KEY=$1-msp
+ KUBENETES_SECRET=$(kubectl get secret ${KEY} --namespace {{ .Release.Namespace }} -o json)
+ if [ "$KUBENETES_SECRET" = "" ]; then
+ PEER_MSP_SECRET=false
+ else
+ ADMINCERT=$(echo ${KUBENETES_SECRET} | jq -r '.data.admincerts' | base64 -d)
+ CACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.cacerts' | base64 -d)
+ KEYSTORE=$(echo ${KUBENETES_SECRET} | jq -r '.data.keystore' | base64 -d)
+ SIGNCERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.signcerts' | base64 -d)
+ TLSCACERTS=$(echo ${KUBENETES_SECRET} | jq -r '.data.tlscacerts' | base64 -d)
+
+ echo "${ADMINCERT}" > ${OUTPUT_PATH}/admincerts/admin.crt
+ echo "${CACERTS}" > ${OUTPUT_PATH}/cacerts/ca.crt
+ echo "${KEYSTORE}" > ${OUTPUT_PATH}/keystore/server.key
+ echo "${SIGNCERTS}" > ${OUTPUT_PATH}/signcerts/server.crt
+ echo "${TLSCACERTS}" > ${OUTPUT_PATH}/tlscacerts/tlsca.crt
+ PEER_MSP_SECRET=true
+ fi
+
+ }
+{{- end }}
+
+ COUNTER=1
+ while [ "$COUNTER" -le {{ .Values.peer.healthCheck.retries }} ]
+ do
+ OUTPUT_PATH="${MOUNT_PATH}/tls"
+ mkdir -p ${OUTPUT_PATH}
+ getPeerTlsSecret ${PEER_NAME}
+
+ OUTPUT_PATH="${MOUNT_PATH}/msp"
+ mkdir -p ${OUTPUT_PATH}/admincerts
+ mkdir -p ${OUTPUT_PATH}/cacerts
+ mkdir -p ${OUTPUT_PATH}/keystore
+ mkdir -p ${OUTPUT_PATH}/signcerts
+ mkdir -p ${OUTPUT_PATH}/tlscacerts
+ getPeerMspSecret ${PEER_NAME}
+
+ if [ "$PEER_TLS_SECRET" = "true" ] && [ "$PEER_MSP_SECRET" = "true" ]
+ then
+ echo "Peer certificates have been obtained correctly"
+ break
+ else
+ echo "Peer certificates have not been obtained, sleeping for {{ .Values.peer.healthCheck.sleepTimeAfterError }}"
+ sleep {{ .Values.peer.healthCheck.sleepTimeAfterError }}
+ COUNTER=`expr "$COUNTER" + 1`
+ fi
+ done
+
+ if [ "$COUNTER" -gt {{ .Values.peer.healthCheck.retries }} ]
+ then
+ echo "Retry attempted `expr $COUNTER - 1` times, The peer certificates have not been obtained."
+ exit 1
+ fi
+
+ volumeMounts:
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ mountPath: "/etc/ssl/certs/"
+ readOnly: true
+ {{ end }}
+ - name: certificates
+ mountPath: /secret
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
+ containers:
+ - name: couchdb
+ image: {{ .Values.image.couchdb }}:{{ .Values.global.version }}
+ imagePullPolicy: IfNotPresent
+ command: ["sh", "-c"]
+ args:
+ - |-
+ chown -R couchdb:couchdb /opt/couchdb
+ chmod -R 0770 /opt/couchdb/data
+ chmod 664 /opt/couchdb/etc/*.ini
+ chmod 664 /opt/couchdb/etc/local.d/*.ini
+ chmod 775 /opt/couchdb/etc/*.d
+ if [ -z $COUCHDB_USER ]
+ then
+ echo " Error! Please provide username for CouchDB."
+ exit 1
+ break
+ elif [ -z $COUCHDB_PASSWORD ]
+ then
+ echo " Error! Please provide password for username $COUCHDB_USER."
+ exit 1
+ break
+ fi
+ tini -- /docker-entrypoint.sh /opt/couchdb/bin/couchdb
+ ports:
+ - containerPort: 5984
+ env:
+ - name: COUCHDB_USER
+ value: "{{ .Values.peer.couchdb.username }}"
+ - name: COUCHDB_PASSWORD
+ value: "{{ .Values.peer.couchdb.password }}"
+ volumeMounts:
+ - name: datadir-couchdb
+ mountPath: /opt/couchdb/data
+ - name: certificates
+ mountPath: /etc/hyperledger/fabric/crypto
+ - name: {{ .Release.Name }}
+ image: {{ .Values.image.peer }}:{{ .Values.global.version }}
+ imagePullPolicy: IfNotPresent
+ command: ["sh", "-c"]
+ args:
+ - |-
+
+ if [ -e /builders/external/core.yaml ]; then
+ cp /builders/external/core.yaml $FABRIC_CFG_PATH/core.yaml
+ fi
+
+ cp /etc/hyperledger/fabric/NodeOUconfig/mspConfig /etc/hyperledger/fabric/crypto/msp/config.yaml
+ export CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD="{{ .Values.peer.couchdb.password }}"
+ version=$( echo ${PEER_IMAGE} | sed 's/.*://' | cut -d '.' -f -2 )
+ if [ $version = "2.2" ] && [ ${IS_UPGRADE} = "true" ]
+ then
+ peer node upgrade-dbs
+ fi
+ peer node start
+ ports:
+ - name: grpc
+ containerPort: 7051
+ - name: events
+ containerPort: 7053
+ - name: operations
+ containerPort: 9443
+ env:
+ - name: PEER_IMAGE
+ value: "{{ .Values.image.peer }}:{{ .Values.global.version }}"
+ - name: IS_UPGRADE
+ value: "{{ .Values.peer.upgrade }}"
+ envFrom:
+ - configMapRef:
+ name: {{ .Release.Name }}-config
+ volumeMounts:
+ - name: datadir
+ mountPath: /var/hyperledger/production
+ - name: dockersocket
+ mountPath: /host/var/run/docker.sock
+ - name: certificates
+ mountPath: /etc/hyperledger/fabric/crypto
+ - name: {{ .Release.Name }}-msp-config-volume
+ mountPath: /etc/hyperledger/fabric/NodeOUconfig
+ readOnly: true
+ - name: builders-config
+ mountPath: /builders/external
+ resources:
+ requests:
+ memory: {{ .Values.peer.resources.requests.memory }}
+ cpu: {{ .Values.peer.resources.requests.cpu }}
+ limits:
+ memory: {{ .Values.peer.resources.limits.memory }}
+ cpu: {{ .Values.peer.resources.limits.cpu }}
+ - name: grpc-web
+ image: "ghcr.io/hyperledger-labs/grpc-web:latest"
+ imagePullPolicy: IfNotPresent
+ ports:
+ - name: grpc-web
+ containerPort: 7443
+ env:
+ - name: BACKEND_ADDRESS
+ value: "{{ .Release.Name }}.{{ .Release.Namespace }}:{{ .Values.peer.ports.grpc.clusterIpPort }}"
+ - name: SERVER_TLS_CERT_FILE
+ value: /certs/tls/server.crt
+ - name: SERVER_TLS_KEY_FILE
+ value: /certs/tls/server.key
+ - name: BACKEND_TLS_CA_FILES
+ value: /certs/tls/ca.crt
+ - name: SERVER_BIND_ADDRESS
+ value: "0.0.0.0"
+ - name: SERVER_HTTP_DEBUG_PORT
+ value: "8080"
+ - name: SERVER_HTTP_TLS_PORT
+ value: "7443"
+ - name: BACKEND_TLS
+ value: "true"
+ - name: SERVER_HTTP_MAX_WRITE_TIMEOUT
+ value: 5m
+ - name: SERVER_HTTP_MAX_READ_TIMEOUT
+ value: 5m
+ - name: USE_WEBSOCKETS
+ value: "true"
+ volumeMounts:
+ - name: certificates
+ mountPath: /certs
+ volumes:
+ {{ if .Values.global.vault.tls }}
+ - name: vaultca
+ secret:
+ secretName: {{ .Values.global.vault.tls }}
+ items:
+ - key: ca.crt.pem
+ path: ca-certificates.crt
+ {{ end }}
+ - name: builders-config
+ configMap:
+ name: {{ .Release.Name }}-builders-config
+ - name: certificates
+ emptyDir:
+ medium: Memory
+ - name: dockersocket
+ hostPath:
+ path: /var/run/docker.sock
+ - name: {{ .Release.Name }}-msp-config-volume
+ configMap:
+ name: {{ .Release.Name }}-msp-config
+ items:
+ - key: mspConfig
+ path: mspConfig
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ volumeClaimTemplates:
+ #Lables are not being taken by Kubernetes as it dynamically creates PVC
+ - metadata:
+ name: datadir
+ labels:
+ {{- include "labels.pvc" . | nindent 8 }}
+ spec:
+ accessModes: [ "ReadWriteOnce" ]
+ storageClassName: storage-{{ .Release.Name }}
+ resources:
+ requests:
+ storage: {{ .Values.storage.peer }}
+ - metadata:
+ name: datadir-couchdb
+ labels:
+ {{- include "labels.pvc" . | nindent 8 }}
+ spec:
+ accessModes: [ "ReadWriteOnce" ]
+ storageClassName: storage-{{ .Release.Name }}
+ resources:
+ requests:
+ storage: {{ .Values.storage.couchdb }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/service.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/service.yaml
index 3b015f0aba2..e96eb0f4caf 100644
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/service.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/service.yaml
@@ -7,53 +7,47 @@
apiVersion: v1
kind: Service
metadata:
- name: {{ $.Values.peer.name }}
- namespace: {{ $.Values.metadata.namespace }}
- {{- if or $.Values.proxy (and $.Values.service.loadBalancerType (eq $.Values.service.loadBalancerType "Internal")) }}
- annotations:
- {{- if $.Values.annotations }}
- {{- range $key, $value := $.Values.annotations.service }}
- {{- range $k, $v := $value }}
- {{ $k }}: {{ $v | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
- {{- if and $.Values.service.loadBalancerType (eq $.Values.service.loadBalancerType "Internal") }}
+ name: {{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
+ {{- if or .Values.global.proxy (and .Values.peer.loadBalancerType (eq .Values.peer.loadBalancerType "Internal")) }}
+ {{- if and .Values.peer.loadBalancerType (eq .Values.peer.loadBalancerType "Internal") }}
cloud.google.com/load-balancer-type: "Internal"
{{- end }}
{{- end }}
labels:
- run: {{ $.Values.peer.name }}
- app.kubernetes.io/name: {{ $.Values.peer.name }}
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ run: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name }}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-peernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- {{- include "labels.custom" . | nindent 2 }}
+ {{- include "labels.service" . | nindent 4 }}
spec:
- type: {{ $.Values.service.servicetype }}
+ type: {{ .Values.peer.serviceType }}
selector:
- app: {{ $.Values.peer.name }}
+ app: {{ .Release.Name }}
ports:
- name: grpc
protocol: TCP
targetPort: 7051
- port: {{ $.Values.service.ports.grpc.clusteripport }}
- {{- if $.Values.service.ports.grpc.nodeport }}
- nodePort: {{ $.Values.service.ports.grpc.nodeport }}
+ port: {{ .Values.peer.ports.grpc.clusterIpPort }}
+ {{- if .Values.peer.ports.grpc.nodePort }}
+ nodePort: {{ .Values.peer.ports.grpc.nodePort }}
{{- end }}
- name: events
protocol: TCP
targetPort: 7053
- port: {{ $.Values.service.ports.events.clusteripport }}
- {{- if $.Values.service.ports.events.nodeport }}
- nodePort: {{ $.Values.service.ports.events.nodeport }}
+ port: {{ .Values.peer.ports.events.clusterIpPort }}
+ {{- if .Values.peer.ports.events.nodePort }}
+ nodePort: {{ .Values.peer.ports.events.nodePort }}
{{- end }}
- protocol: TCP
name: couchdb
targetPort: 5984
- port: {{ $.Values.service.ports.couchdb.clusteripport }}
- {{- if $.Values.service.ports.couchdb.nodeport }}
- nodePort: {{ $.Values.service.ports.couchdb.nodeport }}
+ port: {{ .Values.peer.ports.couchdb.clusterIpPort }}
+ {{- if .Values.peer.ports.couchdb.nodePort }}
+ nodePort: {{ .Values.peer.ports.couchdb.nodePort }}
{{- end }}
- name: grpc-web
protocol: TCP
@@ -62,64 +56,63 @@ spec:
- name: operations
protocol: TCP
targetPort: 9443
- port: {{ $.Values.service.ports.metrics.clusteripport }}
- {{- if (eq $.Values.service.servicetype "ClusterIP") }}
+ port: {{ .Values.peer.ports.metrics.clusterIpPort }}
+ {{- if (eq .Values.peer.serviceType "ClusterIP") }}
clusterIP: None
{{- end }}
- {{- if $.Values.service.loadBalancerIP }}
- loadBalancerIP: {{ $.Values.service.loadBalancerIP }}
+ {{- if .Values.peer.loadBalancerIP }}
+ loadBalancerIP: {{ .Values.peer.loadBalancerIP }}
{{- end }}
-{{- if eq $.Values.proxy.provider "haproxy" }}
+{{- if eq .Values.global.proxy.provider "haproxy" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: {{ $.Values.peer.name }}
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
annotations:
- kubernetes.io/ingress.class: "haproxy"
ingress.kubernetes.io/ssl-passthrough: "true"
spec:
+ ingressClassName: "haproxy"
rules:
- - host: {{ $.Values.peer.name }}.{{ $.Values.metadata.namespace }}.{{ $.Values.proxy.external_url_suffix }}
+ - host: {{ .Release.Name }}.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.peer.name }}
+ name: {{ .Release.Name }}
port:
- number: {{ $.Values.service.ports.grpc.clusteripport }}
- - host: {{ $.Values.peer.name }}-proxy.{{ $.Values.metadata.namespace }}.{{ $.Values.proxy.external_url_suffix }}
+ number: {{ .Values.peer.ports.grpc.clusterIpPort }}
+ - host: {{ .Release.Name }}-proxy.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.peer.name }}
+ name: {{ .Release.Name }}
port:
number: 7443
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: {{ $.Values.peer.name }}-ops
- namespace: {{ $.Values.metadata.namespace }}
- annotations:
- kubernetes.io/ingress.class: "haproxy"
+ name: {{ .Release.Name }}-ops
+ namespace: {{ .Release.Namespace }}
spec:
+ ingressClassName: "haproxy"
rules:
- - host: {{ $.Values.peer.name }}-ops.{{ $.Values.metadata.namespace }}.{{ $.Values.proxy.external_url_suffix }}
+ - host: {{ .Release.Name }}-ops.{{ .Release.Namespace }}.{{ .Values.global.proxy.externalUrlSuffix }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: {{ $.Values.peer.name }}
+ name: {{ .Release.Name }}
port:
number: 9443
{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/servicemonitor.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/servicemonitor.yaml
index 581d6be3294..5071e48f840 100644
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/templates/servicemonitor.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/templates/servicemonitor.yaml
@@ -1,14 +1,18 @@
-{{- if $.Values.service.ports.metrics.enabled }}
+{{- if .Values.peer.ports.metrics.enabled }}
{{- if $.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor" }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
- app: {{ $.Values.peer.name }}
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: {{ .Release.Name}}
+ app.kubernetes.io/component: fabric
+ app.kubernetes.io/part-of: {{ include "fabric-orderernode.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- name: {{ $.Values.peer.name }}
- namespace: {{ $.Values.metadata.namespace }}
+ name: {{ .Release.Name }}
+ namespace: {{ .Release.Namespace }}
spec:
jobLabel: {{ .Release.Name }}
endpoints:
@@ -16,10 +20,10 @@ spec:
port: operations
namespaceSelector:
matchNames:
- - {{ $.Values.metadata.namespace }}
+ - {{ .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
- run: {{ $.Values.peer.name }}
+ run: {{ .Release.Name }}
{{- end }}
{{- end }}
diff --git a/platforms/hyperledger-fabric/charts/fabric-peernode/values.yaml b/platforms/hyperledger-fabric/charts/fabric-peernode/values.yaml
index 4e6954c6648..16d943f2d9a 100644
--- a/platforms/hyperledger-fabric/charts/fabric-peernode/values.yaml
+++ b/platforms/hyperledger-fabric/charts/fabric-peernode/values.yaml
@@ -4,190 +4,226 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: org1-net
- namespace: org1-net
- images:
- #Provide the valid image name and version for fabric couchdb
- #Eg. couchdb: hyperledger/fabric-couchdb:0.4.14
- couchdb: ghcr.io/hyperledger/bevel-fabric-couchdb:2.2.2
- #Provide the valid image name and version for fabric peer
- #Eg. hyperledger/fabric-peer:2.2.2
- peer: ghcr.io/hyperledger/bevel-fabric-peer:2.2.2
- #Provide the valid image name and version to read certificates from vault server
- #Eg. alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- alpineutils: ghcr.io/hyperledger/bevel-alpine:latest
- #Provide the custom labels
- #NOTE: Provide labels other than name, release name , release service, chart version , chart name, run
- #These lables will not be applied to VolumeClaimTemplate of StatefulSet as labels are automatically picked up by Kubernetes
- #Eg. labels:
- # role: peer
- labels:
-annotations:
- #Extra annotations
- service: {}
- pvc: {}
- deployment: {}
+global:
+ # HLF Network Version
+ #Eg. version: 2.5.4
+ version: 2.5.4
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ #Provide the type of vault
+ #Eg. type: hashicorp
+ type: hashicorp
+ #Provide the vaultrole for an organization
+ #Eg. vaultrole: org1-vault-role
+ role: vault-role
+ #Provide the vault server address
+ #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
+ address:
+ #Provide the kubernetes auth backed configured in vault for an organization
+ #Eg. authpath: supplychain
+ authPath: supplychain
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/supplychain"
+ #Kuberenetes secret for vault ca.cert
+ #Enable or disable TLS for vault communication if value present or not
+ #Eg. tls: vaultca
+ tls:
+
+ proxy:
+ #This will be the proxy/ingress provider. Can have values "none" or "haproxy"
+ #Eg. provider: "haproxy"
+ provider: "haproxy"
+ #This field contains the external URL of the organization
+ #Eg. externalUrlSuffix: test.blockchaincloudpoc.com
+ externalUrlSuffix: test.blockchaincloudpoc.com
+ #This field contains the external port on haproxy
+ #Eg. port: 443
+ port: 443
+
+storage:
+ #Flag to create new storage class for organization. Set to false for existing storage class.
+ #Eg. enabled: true
+ enabled: true
+ #Provide storage size for Peer Volume
+ #Eg. peer: 512Mi
+ peer: 512Mi
+ #Provide storage size for CouchDB Volume
+ #Eg. couchdb: 512Mi
+ couchdb: 512Mi
+ # NOTE: when you set this to Retain, the volume WILL persist after the chart is delete and you need to manually delete it
+ reclaimPolicy: "Delete" # choose from: Delete | Retain
+ volumeBindingMode: Immediate # choose from: Immediate | WaitForFirstConsumer
+ allowedTopologies:
+ enabled: false
+
+certs:
+ # Flag indicating the creation of certificates.
+ generateCertificates: true
+ orgData:
+ caAddress: ca.supplychain-net:7051
+ caAdminUser: supplychain-admin
+ caAdminPassword: supplychain-adminpw
+ #Provide organization's name in lowercases
+ #Eg. orgName: supplychain
+ orgName: supplychain
+ #Provide organization's type (orderer or peer)
+ #Eg. component_type: orderer
+ type: peer
+ #Provide organization's subject
+ #Eg. "O=Orderer,L=51.50/-0.13/London,C=GB"
+ componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+
+ users:
+ # Generating User Certificates with custom attributes using Fabric CA in Bevel for Peer Organizations
+ # Eg.
+ # usersList:
+ # - user:
+ # identity: user1
+ # attributes:
+ # - key: "hf.Revoker"
+ # value: "true"
+ # - user:
+ # identity: user2
+ # attributes:
+ # - key: "hf.Revoker"
+ # value: "true"
+ usersList:
+ # - user:
+ # identity: user1
+ # attributes:
+ # - key: "hf.Revoker"
+ # value: "true"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: false
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: false
+ removeOrdererTlsOnDelete: false
+
+image:
+ #Provide the valid image repository for fabric couchdb
+ #Eg. couchdb: hyperledger/fabric-couchdb
+ couchdb: ghcr.io/hyperledger/bevel-fabric-couchdb
+ #Provide the valid repository for fabric peer
+ #Eg. peer: hyperledger/fabric-peer
+ peer: ghcr.io/hyperledger/bevel-fabric-peer
+ #Provide the valid image name and version to read certificates from vault server
+ #Eg. alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ alpineUtils: ghcr.io/hyperledger/bevel-alpine:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
+
peer:
- #Provide the name of the peer as per deployment yaml.
- #Eg. name: peer0
- name: peer0
- #Provide the url of gossipping peer and port to be mentioned is grpc cluster IP port
- #Eg. gossippeeraddress: peer1.org1-net.svc.cluster.local:7051
- gossippeeraddress: peer1.org1-net.svc.cluster.local:7051
- #Provide the url of gossip external endpoint and port to be mentioned is haproxy https service port
- #Eg. gossipexternalendpoint: peer1-ext.org1-net:443
- gossipexternalendpoint: peer0.org1-net.org1proxy.blockchaincloudpoc.com:443
- #Provide the localmspid for organization
- #Eg. localmspid: Org1MSP
- localmspid: Org1MSP
- #Provide the loglevel for organization's peer
- #Eg. loglevel: info
- loglevel: info
- #Provide the value for tlsstatus to be true or false for organization's peer
- #Eg. tlsstatus: true
- tlsstatus: true
+ #Provide the url of the gossipping peer. If empty, this peer's own address will be used
+ #Eg. gossipPeerAddress: peer1.supplychain-net:7051
+ gossipPeerAddress: peer1.supplychain-net:7051
+ #Provide the logLevel for organization's peer
+ #Eg. logLevel: info
+ logLevel: info
+ #Provide the localMspId for organization
+ #Eg. localMspId: supplychainMSP
+ localMspId: supplychainMSP
+ #Provide the value for tlsStatus to be true or false for organization's peer
+ #Eg. tlsStatus: true
+ tlsStatus: true
+ #Flag to enable CLI for this peer
+ #Eg. cliEnabled: true
+ cliEnabled: false
+ #Provide the address for orderer; optional is cliEnabled: false
+ #Eg. ordererAddress: orderer1.test.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net:7050
#Provide a valid chaincode builder image for Fabric
- #Eg. builder: hyperledger/fabric-ccenv:1.4.8
- builder: hyperledger/fabric-ccenv:2.2.2
+ #Eg. builder: hyperledger/fabric-ccenv
+ builder: hyperledger/fabric-ccenv
couchdb:
#Provide the username for couchdb login
- #If couchdb username is provided, it is mandatory to provide password for the same
- #Eg. username: org1-user
- username: org1-user
- configpath:
- core:
- mspconfig:
+ #Eg. username: supplychain-user
+ username: supplychain-user
+ #Provide the password for couchdb login
+ #Eg. password: supplychain-userpw
+ password: supplychain-userpw
+ mspConfig:
#Provide the members of the MSP in organizational unit identifiers
- #Eg.organizationalunitidentifiers:
+ #Eg.organizationalUnitIdentifiers:
# - client
# - peer
# following for 2.2.x
# - admin
# - orderer
- organizationalunitidentifiers:
+ organizationalUnitIdentifiers:
nodeOUs:
- clientOUidentifier:
- #Provide OU which will be used to identify node as client
- #Eg.organizationalunitidentifier: client
- organizationalunitidentifier: client
- peerOUidentifier:
- #Provide OU which will be used to identify node as peer
- #Eg.organizationalunitidentifier: peer
- organizationalunitidentifier: peer
+ #Provide OU which will be used to identify node as client
+ #Eg.clientOUIdentifier: client
+ clientOUIdentifier: client
+ #Provide OU which will be used to identify node as peer
+ #Eg.peerOUIdentifier: peer
+ peerOUIdentifier: peer
# following for 2.2.x
- adminOUidentifier:
- organizationalunitidentifier: admin
- ordererOUidentifier:
- organizationalunitidentifier: orderer
-
-storage:
- peer:
- #Provide the storageclassname for peer
- #Eg. storageclassname: aws-storage
- storageclassname: aws-storageclass
- #Provide the storagesize for storage class
- #Eg. storagesize: 512Mi
- storagesize: 512Mi
- couchdb:
- #Provide the storageclassname for couchdb
- #Eg. storageclassname: aws-storage
- storageclassname: aws-storageclass
- #Provide the storagesize for storage class
- #Eg. storagesize: 512Mi
- storagesize: 512Mi
-
-
-
-vault:
- #Provide the vaultrole for an organization
- #Eg. vaultrole: org1-vault-role
- role: vault-role
- #Provide the vault server address
- #Eg. vaultaddress: http://Vault-884963190.eu-west-1.elb.amazonaws.com
- address:
- #Provide the kubernetes auth backed configured in vault for an organization
- #Eg. authpath: devorg1-net-auth
- authpath: devorg1-net-auth
- #Provide the value for vault secretprefix
- #Eg. secretprefix: secretsv2/data/crypto/peerOrganizations/.../peers/...
- secretprefix: secretsv2/data/crypto/peerOrganizations/org1-net/peers/peer0.org1-net
- #Provide the serviceaccountname for vault
- #Eg. serviceaccountname: vault-auth
- serviceaccountname: vault-auth
- #Provide the type of vault
- #Eg. type: hashicorp
- type: hashicorp
- #Provide the imagesecretname for vault
- #Eg. imagesecretname: regcred
- imagesecretname: ""
- #Provide the vault path for secret couchdb password
- #Eg. secretcouchdbpass: secretsv2/data/credentials/org1-net/couchdb/org1?user
- secretcouchdbpass: secretsv2/data/credentials/org1-net/couchdb/org1?user
- #Kuberenetes secret for vault ca.cert
- #Enable or disable TLS for vault communication if value present or not
- #Eg. tls: vaultca
- tls:
-
-
-service:
- #Provide the servicetype for a peer
- #Eg. servicetype: NodePort
- servicetype: ClusterIP
+ #Provide OU which will be used to identify node as admin
+ #Eg.adminOUIdentifier: admin
+ adminOUIdentifier: admin
+ #Provide OU which will be used to identify node as orderer
+ #Eg.ordererOUIdentifier: orderer
+ ordererOUIdentifier: orderer
+ #Provide the serviceType for a peer
+ #Eg. serviceType: NodePort
+ serviceType: ClusterIP
loadBalancerType: ""
ports:
grpc:
- #Provide a nodeport for grpc service in the range of 30000-32767 (optional)
- #Eg. nodeport: 30001
- nodeport:
+ #Provide a nodePort for grpc service in the range of 30000-32767 (optional)
+ #Eg. nodePort: 30001
+ nodePort:
#Provide a cluster IP port for grpc service to be exposed
- #Eg. clusteripport: 7051
- clusteripport: 7051
+ #Eg. clusterIpPort: 7051
+ clusterIpPort: 7051
events:
- #Provide a nodeport for event service in the range of 30000-32767 (optional)
- #Eg. nodeport: 30002
- nodeport:
+ #Provide a nodePort for event service in the range of 30000-32767 (optional)
+ #Eg. nodePort: 30002
+ nodePort:
#Provide a cluster IP port for event service to be exposed
- #Eg. clusteripport: 7053
- clusteripport: 7053
+ #Eg. clusterIpPort: 7053
+ clusterIpPort: 7053
couchdb:
- #Provide a nodeport for couchdb service in the range of 30000-32767 (optional)
- #Eg. nodeport: 30003
- nodeport:
+ #Provide a nodePort for couchdb service in the range of 30000-32767 (optional)
+ #Eg. nodePort: 30003
+ nodePort:
#Provide a cluster IP port for couchdb service to be exposed
- #Eg. clusteripport: 5984
- clusteripport: 5984
+ #Eg. clusterIpPort: 5984
+ clusterIpPort: 5984
metrics:
enabled: false
- clusteripport: 9443
-
-proxy:
- #This will be the proxy/ingress provider. Can have values "none" or "haproxy"
- #Eg. provider: "haproxy"
- provider: "none"
- #This field contains the external URL of the organization
- #Eg. external_url_suffix: org1.blockchaincloudpoc.com
- external_url_suffix: org1proxy.blockchaincloudpoc.com
- #This field contains the external port on haproxy
- #Eg. port: 443
- port: 443
-
-config:
- # Set limits and requests of pod
- pod:
- resources:
- limits:
+ clusterIpPort: 9443
+ resources:
+ limits:
# Provide the limit memory for node
- # Eg. memory: 512M
- memory: 512M
+ # Eg. memory: 1Gi
+ memory: 1Gi
# Provide the limit cpu for node
# Eg. cpu: 1
- cpu: 1
- requests:
+ cpu: 1
+ requests:
# Provide the requests memory for node
# Eg. memory: 512M
- memory: 512M
+ memory: 512M
# Provide the requests cpu for node
# Eg. cpu: 0.25
- cpu: 0.25
+ cpu: 0.25
+ #Flag to be set to true when network is upgraded
+ upgrade: false
+ healthCheck:
+ retries: 20
+ sleepTimeAfterError: 15
+
+labels:
+ service: []
+ pvc: []
+ deployment: []
diff --git a/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/ca-orderer.yaml b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/ca-orderer.yaml
new file mode 100644
index 00000000000..9e3275732bb
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/ca-orderer.yaml
@@ -0,0 +1,20 @@
+#helm install supplychain-ca -f values/noproxy-and-novault/ca-server.yaml -n supplychain-net fabric-ca-server
+global:
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: kubernetes
+ proxy:
+ provider: none
+ externalUrlSuffix: supplychain-net
+
+storage:
+ size: 512Mi
+server:
+ removeCertsOnDelete: true
+ tlsStatus: true
+ adminUsername: supplychain-admin
+ adminPassword: supplychain-adminpw
+ subject: "/C=GB/ST=London/L=London/O=Orderer"
diff --git a/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/ca-peer.yaml b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/ca-peer.yaml
new file mode 100644
index 00000000000..ba145a003a2
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/ca-peer.yaml
@@ -0,0 +1,20 @@
+#helm install carrier-ca -f values/noproxy-and-novault/ca-server.yaml -n carrier-net fabric-ca-server
+global:
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: kubernetes
+ proxy:
+ provider: none
+ externalUrlSuffix: carrier-net
+
+storage:
+ size: 512Mi
+server:
+ removeCertsOnDelete: true
+ tlsStatus: true
+ adminUsername: carrier-admin
+ adminPassword: carrier-adminpw
+ subject: "/C=GB/ST=London/L=London/O=Carrier"
diff --git a/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/carrier.yaml b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/carrier.yaml
new file mode 100644
index 00000000000..87f053018e6
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/carrier.yaml
@@ -0,0 +1,52 @@
+#helm install pee0-carrier -f values/noproxy-and-novault/peer.yaml -n carrier-net fabric-peer
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ vault:
+ type: kubernetes
+
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+
+ proxy:
+ provider: "none"
+ externalUrlSuffix: carrier-net
+
+certs:
+ generateCertificates: true
+ orgData:
+ caAddress: ca.carrier-net:7054
+ caAdminUser: carrier-admin
+ caAdminPassword: carrier-adminpw
+ orgName: carrier
+ type: peer
+ componentSubject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
+ users:
+ usersList:
+ - user:
+ identity: user1
+ attributes:
+ - key: "hf.Revoker"
+ value: "true"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: true
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
+storage:
+ enabled: false
+peer:
+ gossipPeerAddress:
+ logLevel: info
+ localMspId: carrierMSP
+ tlsStatus: true
+ cliEnabled: true
+ ordererAddress: orderer1.supplychain-net:7050
+ builder: hyperledger/fabric-ccenv
+ couchdb:
+ username: carrier-user
+ password: carrier-userpw
+ upgrade: false
diff --git a/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/genesis.yaml b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/genesis.yaml
new file mode 100644
index 00000000000..bf48e007515
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/genesis.yaml
@@ -0,0 +1,45 @@
+#helm install ca-certs -f values/noproxy-and-novault/genesis.yaml -n supplychain-net fabric-genesis
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: kubernetes
+ proxy:
+ provider: none
+ externalUrlSuffix: supplychain-net
+
+organizations:
+ - name: supplychain
+ orderers:
+ - name: orderer1
+ ordererAddress: orderer1.supplychain-net:7050 # Internal/External URI of the orderer
+ - name: orderer2
+ ordererAddress: orderer2.supplychain-net:7050
+ - name: orderer3
+ ordererAddress: orderer3.supplychain-net:7050
+ peers:
+ - name: peer0
+ peerAddress: peer0.supplychain-net:7051 # Internal/External URI of the peer
+ - name: peer1
+ peerAddress: peer1.supplychain-net:7051
+
+ - name: carrier
+ peers:
+ - name: peer0
+ peerAddress: peer0.carrier-net:7051 # Internal/External URI of the peer
+
+consensus: raft
+channels:
+ - name: allchannel
+ consortium: SupplyChainConsortium
+ orderers:
+ - supplychain
+ participants:
+ - supplychain
+ - carrier
+
+settings:
+ removeConfigMapOnDelete: true
diff --git a/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/join-channel.yaml b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/join-channel.yaml
new file mode 100644
index 00000000000..39455b21a71
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/join-channel.yaml
@@ -0,0 +1,19 @@
+---
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ vault:
+ type: kubernetes
+
+peer:
+ name: peer0
+ type: anchor
+ address: peer0.carrier-net:7051
+ localMspId: carrierMSP
+ logLevel: info
+ tlsStatus: true
+ channelName: AllChannel
+ ordererAddress: orderer1.supplychain-net:7050
diff --git a/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/orderer.yaml b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/orderer.yaml
new file mode 100644
index 00000000000..8d07ca97ec5
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/orderer.yaml
@@ -0,0 +1,37 @@
+#helm install orderer1 -f values/noproxy-and-novault/orderer.yaml -n supplychain-net fabric-orderernode
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ vault:
+ type: kubernetes
+
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+
+ proxy:
+ provider: none
+ externalUrlSuffix: supplychain-net
+
+certs:
+ generateCertificates: true
+ orgData:
+ caAddress: ca.supplychain-net:7054
+ caAdminUser: supplychain-admin
+ caAdminPassword: supplychain-adminpw
+ orgName: supplychain
+ type: orderer
+ componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: true
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
+
+orderer:
+ consensus: raft
+ logLevel: info
+ localMspId: supplychainMSP
+ tlsstatus: true
diff --git a/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/peer.yaml b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/peer.yaml
new file mode 100644
index 00000000000..c660bc11f9f
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/noproxy-and-novault/peer.yaml
@@ -0,0 +1,51 @@
+#helm install pee0-carrier -f values/noproxy-and-novault/peer.yaml -n carrier-net fabric-peer
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ vault:
+ type: kubernetes
+
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+
+ proxy:
+ provider: "none"
+ externalUrlSuffix: supplychain-net
+
+certs:
+ generateCertificates: true
+ orgData:
+ caAddress: ca.supplychain-net:7054
+ caAdminUser: supplychain-admin
+ caAdminPassword: supplychain-adminpw
+ orgName: supplychain
+ type: peer
+ componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+ users:
+ usersList:
+ - user:
+ identity: user1
+ attributes:
+ - key: "hf.Revoker"
+ value: "true"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: false
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
+
+peer:
+ gossipPeerAddress: peer1.supplychain-net:7051
+ logLevel: info
+ localMspId: supplychainMSP
+ tlsStatus: true
+ cliEnabled: false
+ ordererAddress: orderer1.supplychain-net:7050
+ builder: hyperledger/fabric-ccenv
+ couchdb:
+ username: supplychain-user
+ password: supplychain-userpw
+ upgrade: false
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/ca-orderer.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/ca-orderer.yaml
new file mode 100644
index 00000000000..3416340af25
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/ca-orderer.yaml
@@ -0,0 +1,27 @@
+#helm install supplychain-ca -f values/proxy-and-vault/ca-server.yaml -n supplychain-net fabric-ca-server
+global:
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ kubernetesUrl: "https://yourkubernetes.com"
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: supplychain
+ secretEngine: secretsv2
+ secretPrefix: "data/supplychain"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+
+storage:
+ size: 512Mi
+server:
+ removeCertsOnDelete: true
+ tlsStatus: true
+ adminUsername: supplychain-admin
+ adminPassword: supplychain-adminpw
+ subject: "/C=GB/ST=London/L=London/O=Orderer"
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/ca-peer.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/ca-peer.yaml
new file mode 100644
index 00000000000..2de4727a807
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/ca-peer.yaml
@@ -0,0 +1,27 @@
+#helm install carrier-ca -f values/proxy-and-vault/ca-server.yaml -n carrier-net fabric-ca-server
+global:
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ kubernetesUrl: "https://yourkubernetes.com"
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: carrier
+ secretEngine: secretsv2
+ secretPrefix: "data/carrier"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+
+storage:
+ size: 512Mi
+server:
+ removeCertsOnDelete: true
+ tlsStatus: true
+ adminUsername: carrier-admin
+ adminPassword: carrier-adminpw
+ subject: /C=GB/ST=London/L=London/O=Carrier
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/carrier.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/carrier.yaml
new file mode 100644
index 00000000000..c16adb871b2
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/carrier.yaml
@@ -0,0 +1,56 @@
+#helm install pee0-carrier -f values/noproxy-and-novault/peer.yaml -n carrier-net fabric-peer
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: carrier
+ secretEngine: secretsv2
+ secretPrefix: "data/carrier"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+
+certs:
+ generateCertificates: true
+ orgData:
+ caAddress: ca.carrier-net.test.yourdomain.com
+ caAdminUser: carrier-admin
+ caAdminPassword: carrier-adminpw
+ orgName: carrier
+ type: peer
+ componentSubject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
+ users:
+ usersList:
+ - user:
+ identity: user1
+ attributes:
+ - key: "hf.Revoker"
+ value: "true"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: true
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
+storage:
+ enabled: false
+peer:
+ gossipPeerAddress:
+ logLevel: info
+ localMspId: carrierMSP
+ tlsStatus: true
+ cliEnabled: true
+ ordererAddress: orderer1.supplychain-net.test.yourdomain.com:443
+ builder: hyperledger/fabric-ccenv
+ couchdb:
+ username: carrier-user
+ password: carrier-userpw
+ upgrade: false
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/create-channel.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/create-channel.yaml
new file mode 100644
index 00000000000..7e5e5db3f0c
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/create-channel.yaml
@@ -0,0 +1,27 @@
+global:
+ version: 2.2.2
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: carrier
+ secretEngine: secretsv2
+ secretPrefix: "data/carrier"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+
+peer:
+ name: peer0
+ type: anchor
+ address: peer0.carrier-net.test.yourdomain.com:443
+ localMspId: carrierMSP
+ logLevel: info
+ tlsStatus: true
+ channelName: AllChannel
+ ordererAddress: orderer1.supplychain-net.test.yourdomain.com:443
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/genesis.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/genesis.yaml
new file mode 100644
index 00000000000..2facfc098c1
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/genesis.yaml
@@ -0,0 +1,50 @@
+#helm install ca-certs -f values/proxy-and-vault/genesis.yaml -n supplychain-net fabric-genesis
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: supplychain
+ secretEngine: secretsv2
+ secretPrefix: "data/supplychain"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+
+organizations:
+ - name: supplychain
+ orderers:
+ - name: orderer1
+ ordererAddress: orderer1.supplychain-net.test.yourdomain.com:443
+ - name: orderer2
+ ordererAddress: orderer2.supplychain-net.test.yourdomain.com:443
+ - name: orderer3
+ ordererAddress: orderer3.supplychain-net.test.yourdomain.com:443
+ peers:
+ - name: peer0
+ peerAddress: peer0.supplychain-net.test.yourdomain.com:443 # Internal/External URI of the peer
+ - name: peer1
+ peerAddress: peer1.supplychain-net.test.yourdomain.com:443
+
+ - name: carrier
+ peers:
+ - name: peer0
+ peerAddress: peer0.carrier-net.test.yourdomain.com:443 # External URI of the peer
+consensus: raft
+channels:
+ - name: allchannel
+ consortium: SupplyChainConsortium
+ orderers:
+ - supplychain
+ participants:
+ - supplychain
+ - carrier
+
+settings:
+ removeConfigMapOnDelete: true
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/join-channel.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/join-channel.yaml
new file mode 100644
index 00000000000..be85234b3a0
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/join-channel.yaml
@@ -0,0 +1,24 @@
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: supplychain
+ secretEngine: secretsv2
+ secretPrefix: "data/supplychain"
+ tls: false
+
+peer:
+ name: peer0
+ type: anchor
+ address: peer0.supplychain-net.test.yourdomain.com:443
+ localMspId: supplychainMSP
+ logLevel: info
+ tlsStatus: true
+ channelName: AllChannel
+ ordererAddress: orderer1.supplychain-net.test.yourdomain.com:443
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/orderer.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/orderer.yaml
new file mode 100644
index 00000000000..f3980f05b25
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/orderer.yaml
@@ -0,0 +1,41 @@
+#helm install orderer1 -f values/proxy-and-vault/orderer.yaml -n supplychain-net fabric-orderernode
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: supplychain
+ secretEngine: secretsv2
+ secretPrefix: "data/supplychain"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+
+certs:
+ generateCertificates: true
+ orgData:
+ caAddress: ca.supplychain-net.test.yourdomain.com
+ caAdminUser: supplychain-admin
+ caAdminPassword: supplychain-adminpw
+ orgName: supplychain
+ type: orderer
+ componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: true
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
+
+orderer:
+ consensus: raft
+ logLevel: info
+ localMspId: supplychainMSP
+ tlsstatus: true
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/osn-create-channel.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/osn-create-channel.yaml
new file mode 100644
index 00000000000..62ab1d0dcba
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/osn-create-channel.yaml
@@ -0,0 +1,24 @@
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: supplychain
+ secretEngine: secretsv2
+ secretPrefix: "data/supplychain"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+orderers:
+ - name: orderer1
+ adminAddress: orderer1.supplychain-net:7055 # Internal URI of the orderer ONS Admin service
+ - name: orderer2
+ adminAddress: orderer2.supplychain-net:7055
+ - name: orderer3
+ adminAddress: orderer3.supplychain-net:7055
diff --git a/platforms/hyperledger-fabric/charts/values/proxy-and-vault/peer.yaml b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/peer.yaml
new file mode 100644
index 00000000000..ab684308fd4
--- /dev/null
+++ b/platforms/hyperledger-fabric/charts/values/proxy-and-vault/peer.yaml
@@ -0,0 +1,55 @@
+#helm install pee0 -f values/proxy-and-vault/orderer.yaml -n carrier-net fabric-orderernode
+global:
+ version: 2.5.4
+ serviceAccountName: vault-auth
+ cluster:
+ provider: azure
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ role: vault-role
+ address: http://vault.url:8200
+ authPath: supplychain
+ secretEngine: secretsv2
+ secretPrefix: "data/supplychain"
+ tls: false
+ proxy:
+ provider: haproxy
+ externalUrlSuffix: test.yourdomain.com
+
+certs:
+ generateCertificates: true
+ orgData:
+ caAddress: ca.supplychain-net:7054
+ caAdminUser: supplychain-admin
+ caAdminPassword: supplychain-adminpw
+ orgName: supplychain
+ type: peer
+ componentSubject: "O=Orderer,L=51.50/-0.13/London,C=GB"
+ users:
+ usersList:
+ - user:
+ identity: user1
+ attributes:
+ - key: "hf.Revoker"
+ value: "true"
+ settings:
+ #Flag to create configmaps for the organization. This flag must be set to true when installing the first orderer/peer in organization and false for others.
+ createConfigMaps: false
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
+
+peer:
+ gossipPeerAddress: peer1.supplychain-net.test.yourdomain.com:443
+ logLevel: info
+ localMspId: supplychainMSP
+ tlsStatus: true
+ cliEnabled: false
+ ordererAddress: orderer1.supplychain-net.test.yourdomain.com:443
+ builder: hyperledger/fabric-ccenv
+ couchdb:
+ username: supplychain-user
+ password: supplychain-userpw
+ upgrade: false
diff --git a/platforms/hyperledger-fabric/configuration/add-new-channel.yaml b/platforms/hyperledger-fabric/configuration/add-new-channel.yaml
index e88c97a1d9e..86adf495296 100644
--- a/platforms/hyperledger-fabric/configuration/add-new-channel.yaml
+++ b/platforms/hyperledger-fabric/configuration/add-new-channel.yaml
@@ -24,45 +24,16 @@
file:
path: "./build"
state: absent
-
- # Create generate_crypto script for each organization
- - include_role:
- name: "create/crypto_script"
- vars:
- component_type: "{{ item.type | lower}}"
- orderers: "{{ item.services.orderers }}"
- loop: "{{ network['organizations'] }}"
-
- # Creating channel artifacts
- # This role creates configtx.yaml file as the requirements mentioned in network.yaml
- # which is then consumed by configtxgen tool
- - include_role:
- name: "create/configtx"
- vars:
- config_file: "./build/configtx.yaml"
-
- # This role generate channeltx
- - include_role:
- name: "create/channel_artifacts"
- vars:
- build_path: "./build"
- genesis: "{{ item.genesis }}"
- channel_name: "{{ item.channel_name | lower}}"
- profile_name: "{{ item.channel_name }}"
- add_new_org: 'false'
- fetch_certs: "true"
- loop: "{{ network['channels'] }}"
- when: item.channel_status == 'new'
-
+
- name: "Create genesis block"
include_role:
name: "create/genesis"
vars:
- build_path: "./build"
- genesis: "{{ item.genesis }}"
- channel_name: "{{ item.channel_name | lower }}"
- loop: "{{ network['channels'] }}"
- when: item.channel_status == 'new' and '2.5.' in network.version
+ org: "{{ network['organizations'] | first }}"
+ docker_url: "{{ network.docker.url }}"
+ kubernetes: "{{ org.k8s }}"
+ generateGenisis: false
+ when: genererate_configtx is defined and genererate_configtx == 'true'
# This role creates the value file for creating channel from creator organization
# to the vault.
@@ -72,6 +43,7 @@
build_path: "./build"
participants: "{{ item.participants }}"
docker_url: "{{ network.docker.url }}"
+ channel_name: "{{ item.channel_name | lower }}"
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new' and ('2.2.' in network.version or '1.4.' in network.version)
@@ -97,20 +69,9 @@
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new'
- # This role creates the value file for anchor peer update over channel for
- # each organization which is the part of the channel.
- - include_role:
- name: "create/anchorpeer"
- vars:
- build_path: "./build"
- participants: "{{ item.participants }}"
- docker_url: "{{ network.docker.url }}"
- loop: "{{ network['channels'] }}"
- when: item.channel_status == 'new'
-
vars: #These variables can be overriden from the command line
- privilege_escalate: false #Default to NOT escalate to root privledges
- install_os: "linux" #Default to linux OS
- install_arch: "amd64" #Default to amd64 architecture
- bin_install_dir: "~/bin" #Default to /bin install directory for binaries
+ privilege_escalate: false # Default to NOT escalate to root privledges
+ install_os: "linux" # Default to linux OS
+ install_arch: "amd64" # Default to amd64 architecture
+ bin_install_dir: "~/bin" # Default to /bin install directory for binaries
add_new_org: 'false' # Default to false as this is for main network creation
diff --git a/platforms/hyperledger-fabric/configuration/add-orderer-organization.yaml b/platforms/hyperledger-fabric/configuration/add-orderer-organization.yaml
index f504915daaa..9c419172fbb 100644
--- a/platforms/hyperledger-fabric/configuration/add-orderer-organization.yaml
+++ b/platforms/hyperledger-fabric/configuration/add-orderer-organization.yaml
@@ -36,6 +36,19 @@
release_dir: "{{ playbook_dir }}/../../../{{ item.gitops.release_dir }}/{{ item.name | lower }}"
loop: "{{ network['organizations'] }}"
when: item.org_status == 'new'
+
+ # Setup script for Vault and OS Package Manager
+ - name: "Setup script for Vault and OS Package Manager"
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/setup/scripts"
+ vars:
+ namespace: "{{ org.name | lower }}-net"
+ network_type: "{{ network.type | lower }}"
+ kubernetes: "{{ org.k8s }}"
+ loop: "{{ network['organizations'] }}"
+ loop_control:
+ loop_var: org
+ when: org.org_status == 'new'
# Setup Vault-Kubernetes accesses and Regcred for docker registry for new organization
- name: "Create vault-auth for new org"
@@ -78,6 +91,7 @@
component: "{{ item.name | lower}}"
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
+ sc_name: "{{ component }}-bevel-storageclass"
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
ca: "{{ item.services.ca }}"
@@ -102,6 +116,7 @@
component: "{{ item.name | lower}}"
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
+ sc_name: "{{ component }}-bevel-storageclass"
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
ca: "{{ item.services.ca }}"
@@ -109,7 +124,7 @@
gitops: "{{ item.gitops }}"
values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
loop: "{{ network['organizations'] }}"
- when: item.type == 'orderer'
+ when: item.type == 'orderer' and item.org_status == 'new'
# Creating channel artifacts and putting them in vault
# This role creates configtx.yaml file as the requirements mentioned in network.yaml
@@ -146,7 +161,7 @@
loop: "{{ network.organizations }}"
loop_control:
loop_var: neworg
- when: neworg.type == 'orderer' and neworg.org_status == 'new'
+ when: neworg.type == 'orderer' and neworg.org_status == 'new' and '2.5.' not in network.version
# This role creates value file for zk-kafka (if kafka consensus is chosen) and orderer
- name: Create all orderers
@@ -157,6 +172,7 @@
namespace: "{{ item.name | lower}}-net"
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
+ sys_channel_name: "syschannel"
vault: "{{ item.vault }}"
git_protocol: "{{ item.gitops.git_protocol }}"
git_url: "{{ item.gitops.git_url }}"
@@ -180,7 +196,7 @@
loop: "{{ network.organizations }}"
loop_control:
loop_var: neworg
- when: neworg.type == 'orderer' and neworg.org_status == 'new'
+ when: neworg.type == 'orderer' and neworg.org_status == 'new' and '2.5.' not in network.version
# This role adds the new org to the existing chnanel and updates the block with the application channel
- name: "Modify the application channel with tls and address information of new orderer"
diff --git a/platforms/hyperledger-fabric/configuration/cleanup.yaml b/platforms/hyperledger-fabric/configuration/cleanup.yaml
index 68079c0386a..6aa92898092 100644
--- a/platforms/hyperledger-fabric/configuration/cleanup.yaml
+++ b/platforms/hyperledger-fabric/configuration/cleanup.yaml
@@ -36,7 +36,7 @@
component_name: "{{ item.name | lower }}-net"
loop: "{{ network['organizations'] }}"
when:
- - item.type == "orderer"
+ - item.services.orderers is defined and item.services.orderers | length > 0
- network.env.type != 'operator'
- include_role:
diff --git a/platforms/hyperledger-fabric/configuration/deploy-network.yaml b/platforms/hyperledger-fabric/configuration/deploy-network.yaml
index 42875f68745..b3370ab63fb 100644
--- a/platforms/hyperledger-fabric/configuration/deploy-network.yaml
+++ b/platforms/hyperledger-fabric/configuration/deploy-network.yaml
@@ -29,79 +29,45 @@
include_role:
name: "create/namespace"
vars:
- component_name: "{{ item.name | lower }}-net"
- component_type_name: "{{ item.type | lower }}"
- kubernetes: "{{ item.k8s }}"
- release_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
- loop: "{{ network['organizations'] }}"
-
- # Setup script for Vault and OS Package Manager
- - name: "Setup script for Vault and OS Package Manager"
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/setup/scripts"
- vars:
- namespace: "{{ org.name | lower }}-net"
+ component_name: "{{ org.name | lower }}-net"
kubernetes: "{{ org.k8s }}"
+ release_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
loop: "{{ network['organizations'] }}"
loop_control:
loop_var: org
-
- # Setup Vault-Kubernetes accesses and Regcred for docker registry
- - name: Setup Vault Kubernetes for each organization
- include_role:
- name: "{{playbook_dir}}/../../shared/configuration/roles/setup/vault_kubernetes"
+
+ # Create necessary secrets
+ - name: "Create k8s secrets"
+ include_role:
+ name: create/secrets
vars:
- name: "{{ org.name | lower }}"
- component_name: "{{ org.name | lower }}-vaultk8s-job"
- component_type: "{{ org.type | lower }}"
component_ns: "{{ org.name | lower }}-net"
- component_auth: "{{ org.k8s.cluster_id | default('')}}{{ network.env.type }}{{ name }}"
kubernetes: "{{ org.k8s }}"
vault: "{{ org.vault }}"
- gitops: "{{ org.gitops }}"
loop: "{{ network['organizations'] }}"
loop_control:
loop_var: org
-
- # Create Storageclass
- - name: Create storageclass for each organization
- include_role:
- name: "{{ playbook_dir }}/../../../platforms/shared/configuration/roles/setup/storageclass"
- vars:
- org_name: "{{ org.name | lower }}"
- sc_name: "{{ org_name }}-bevel-storageclass"
- region: "{{ org.k8s.region | default('eu-west-1') }}"
- loop: "{{ network['organizations'] }}"
- loop_control:
- loop_var: org
-
+ when:
+ - org.org_status is not defined or org.org_status == 'new'
+
# Create CA Server helm-value files and check-in
- name: Create CA server for each organization
include_role:
name: "create/ca_server"
vars:
- component_name: "{{ item.name | lower}}-net"
- component: "{{ item.name | lower}}"
- component_type: "{{ item.type | lower}}"
- component_services: "{{ item.services }}"
- sc_name: "{{ component }}-bevel-storageclass"
- kubernetes: "{{ item.k8s }}"
- vault: "{{ item.vault }}"
- ca: "{{ item.services.ca }}"
+ component_ns: "{{ org.name | lower}}-net"
+ component: "{{ org.name | lower}}"
+ component_services: "{{ org.services }}"
+ kubernetes: "{{ org.k8s }}"
+ vault: "{{ org.vault }}"
+ ca: "{{ org.services.ca }}"
docker_url: "{{ network.docker.url }}"
- gitops: "{{ item.gitops }}"
- values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
- loop: "{{ network['organizations'] }}"
- when: item.services.ca is defined
-
- # Create generate_crypto script for each organization
- - name: Create generate_crypto.sh for each organization
- include_role:
- name: "create/crypto_script"
- vars:
- component_type: "{{ item.type | lower }}"
- orderers: "{{ item.services.orderers }}"
+ gitops: "{{ org.gitops }}"
+ values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
loop: "{{ network['organizations'] }}"
+ loop_control:
+ loop_var: org
+ when: org.services.ca is defined
#Creating a pause so that the client certificates are valid
# You can continue if the CA-server pods are running for more than 5 minutes
@@ -109,92 +75,28 @@
prompt: "Sleeping... so that the client certificates are valid"
minutes: 6
- # Create CA Tools helm-value files and check-in
- - name: Create CA tools for each organization
- include_role:
- name: "create/ca_tools/orderer"
- vars:
- component_name: "{{ item.name | lower }}-net"
- component: "{{ item.name | lower }}"
- component_type: "{{ item.type | lower }}"
- component_services: "{{ item.services }}"
- sc_name: "{{ component }}-bevel-storageclass"
- kubernetes: "{{ item.k8s }}"
- vault: "{{ item.vault }}"
- ca: "{{ item.services.ca }}"
- docker_url: "{{ network.docker.url }}"
- gitops: "{{ item.gitops }}"
- values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
- loop: "{{ network['organizations'] }}"
- when: item.type == 'orderer'
-
- # Create CA Tools helm-value files and check-in
- - name: Create CA tools for each organization
- include_role:
- name: "create/ca_tools/peer"
- vars:
- component_name: "{{ item.name | lower}}-net"
- component: "{{ item.name | lower}}"
- component_type: "{{ item.type | lower}}"
- component_services: "{{ item.services }}"
- orderer_org: "{{ item.orderer_org | lower }}"
- sc_name: "{{ component }}-bevel-storageclass"
- kubernetes: "{{ item.k8s }}"
- vault: "{{ item.vault }}"
- ca: "{{ item.services.ca }}"
- docker_url: "{{ network.docker.url }}"
- gitops: "{{ item.gitops }}"
- values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
- loop: "{{ network['organizations'] }}"
- when: item.type == 'peer'
-
- # Creating channel artifacts and putting them in vault
- # This role creates configtx.yaml file as the requirements mentioned in network.yaml
- # which is then consumed by configtxgen tool
- - name: Create configtx.yaml
- include_role:
- name: "create/configtx"
- vars:
- config_file: "./build/configtx.yaml"
-
- # This role generate genesis block and channeltx
- - name: Create channel artifacts for all channels
- include_role:
- name: "create/channel_artifacts"
- vars:
- build_path: "./build"
- channel_name: "{{ item.channel_name | lower}}"
- profile_name: "{{ item.channel_name }}"
- fetch_certs: "false"
- loop: "{{ network['channels'] }}"
-
- - name: "Create genesis block"
- include_role:
- name: "create/genesis"
- vars:
- build_path: "./build"
- genesis: "{{ item.genesis }}"
- channel_name: "{{ item.channel_name | lower }}"
- loop: "{{ network['channels'] }}"
-
# This role creates value file for zk-kafka (if kafka consensus is chosen) and orderer
- name: Create all orderers
include_role:
name: "create/orderers"
vars:
build_path: "./build"
- namespace: "{{ item.name | lower}}-net"
- component_type: "{{ item.type | lower}}"
- component_services: "{{ item.services }}"
- vault: "{{ item.vault }}"
- git_protocol: "{{ item.gitops.git_protocol }}"
- git_url: "{{ item.gitops.git_url }}"
- git_branch: "{{ item.gitops.branch }}"
+ namespace: "{{ org.name | lower}}-net"
+ org_name: "{{ org.name | lower }}"
+ component_services: "{{ org.services }}"
+ kubernetes: "{{ org.k8s }}"
+ vault: "{{ org.vault }}"
+ sys_channel_name: "syschannel"
+ git_protocol: "{{ org.gitops.git_protocol }}"
+ git_url: "{{ org.gitops.git_url }}"
+ git_branch: "{{ org.gitops.branch }}"
docker_url: "{{ network.docker.url }}"
- charts_dir: "{{ item.gitops.chart_source }}"
- values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
+ charts_dir: "{{ org.gitops.chart_source }}"
+ values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
loop: "{{ network['organizations'] }}"
- when: item.type == 'orderer'
+ loop_control:
+ loop_var: org
+ when: org.services.orderers is defined and org.services.orderers | length > 0
# This role creates the value file for peers of organisations and write couch db credentials
# to the vault.
@@ -203,75 +105,30 @@
name: "create/peers"
vars:
build_path: "./build"
- namespace: "{{ item.name | lower}}-net"
- component_type: "{{ item.type | lower}}"
- component_services: "{{ item.services }}"
- vault: "{{ item.vault }}"
- git_protocol: "{{ item.gitops.git_protocol }}"
- git_url: "{{ item.gitops.git_url }}"
- git_branch: "{{ item.gitops.branch }}"
+ namespace: "{{ org.name | lower}}-net"
+ component_type: "{{ org.type | lower}}"
+ component_services: "{{ org.services }}"
+ kubernetes: "{{ org.k8s }}"
+ vault: "{{ org.vault }}"
+ git_protocol: "{{ org.gitops.git_protocol }}"
+ git_url: "{{ org.gitops.git_url }}"
+ git_branch: "{{ org.gitops.branch }}"
docker_url: "{{ network.docker.url }}"
- charts_dir: "{{ item.gitops.chart_source }}"
- values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
+ charts_dir: "{{ org.gitops.chart_source }}"
+ values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
loop: "{{ network['organizations'] }}"
- when: item.type == 'peer'
-
- # This role creates the value file for creating channel from creator organization
- # to the vault.
- - name: Create all create-channel jobs
- include_role:
- name: "create/channels"
- vars:
- build_path: "./build"
- participants: "{{ item.participants }}"
- docker_url: "{{ network.docker.url }}"
- loop: "{{ network['channels'] }}"
- when: add_new_org == 'false' and ('2.2.' in network.version or '1.4.' in network.version)
-
- # This role creates the value file for creating channel from creator organization
- # to the vault.
- - name: Create all create-channel jobs
- include_role:
- name: "create/osnchannels"
- vars:
- build_path: "./build"
- docker_url: "{{ network.docker.url }}"
- loop: "{{ network['channels'] }}"
- when: add_new_org == 'false' and '2.5.' in network.version
-
- # This role creates the value file for joining channel from each participating peer
- # to the vault.
- - name: Create all join-channel jobs
- include_role:
- name: "create/channels_join"
- vars:
- build_path: "./build"
- participants: "{{ item.participants }}"
- docker_url: "{{ network.docker.url }}"
- loop: "{{ network['channels'] }}"
-
- # This role creates the value file for anchor peer update over channel for
- # each organization which is the part of the channel.
- - name: Create all anchor-peer jobs
- include_role:
- name: "create/anchorpeer"
- vars:
- build_path: "./build"
- participants: "{{ item.participants }}"
- docker_url: "{{ network.docker.url }}"
- loop: "{{ network['channels'] }}"
+ loop_control:
+ loop_var: org
+ when: org.services.peers is defined and org.services.peers | length > 0
- # Create CLI pod for peers with cli option enabled
- - name: Create CLI pod for each peer with it enabled
- include_role:
- name: "create/cli_pod"
+ - name: "Create genesis block"
+ include_role:
+ name: "create/genesis"
vars:
- peers: "{{ org.services.peers }}"
+ org: "{{ network['organizations'] | first }}"
docker_url: "{{ network.docker.url }}"
- loop: "{{ network.organizations }}"
- loop_control:
- loop_var: org
- when: org.type == "peer" and org.org_status == "new"
+ kubernetes: "{{ org.k8s }}"
+ generateGenisis: true
vars: #These variables can be overriden from the command line
privilege_escalate: false #Default to NOT escalate to root privledges
diff --git a/platforms/hyperledger-fabric/configuration/external-chaincode-ops.yaml b/platforms/hyperledger-fabric/configuration/external-chaincode-ops.yaml
index 831628ba575..3ff73511ba9 100644
--- a/platforms/hyperledger-fabric/configuration/external-chaincode-ops.yaml
+++ b/platforms/hyperledger-fabric/configuration/external-chaincode-ops.yaml
@@ -1,5 +1,5 @@
-# This playbook executes required tasks to install and instantiate external chaincode
-# on existing Kubernetes clusters. The Kubernetes clusters should already be created and the infomation
+# This playbook executes required tasks to install and instantiate external chaincode
+# on existing Kubernetes clusters. The Kubernetes clusters should already be created and the infomation
# to connect to the clusters be updated in the network.yaml file that is used as an input to this playbook
###########################################################################################
# To Run this playbook from this directory, use the following command (network.yaml also in this directory)
@@ -77,7 +77,7 @@
- item.type == 'peer'
############################################################################################
- # This task generates the crypto material by executing the generate-crypto-peer-chaincode.sh script
+ # This task generates the crypto material by executing the generate-crypto-peer-chaincode.sh script
- name: Generate crypto material for peer to interact with external chaincode servers
include_role:
name: "create/chaincode/peer_certs"
@@ -94,7 +94,7 @@
ca_server_url: "{{ item.ca_data.url }}"
setup_user_env: true
loop: "{{ network['organizations'] }}"
- when:
+ when:
- item.type == 'peer'
############################################################################################
@@ -115,7 +115,7 @@
ca_server_url: "{{ item.ca_data.url }}"
setup_user_env: true
loop: "{{ network['organizations'] }}"
- when:
+ when:
- item.type == 'peer'
############################################################################################
@@ -140,7 +140,7 @@
charts_dir: "{{ item.gitops.chart_source }}"
values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
loop: "{{ network['organizations'] }}"
- when:
+ when:
- item.type == 'peer'
- item.org_status == 'new'
@@ -165,8 +165,8 @@
charts_dir: "{{ item.gitops.chart_source }}"
values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
loop: "{{ network['organizations'] }}"
- when:
- - item.type == 'peer'
+ when:
+ - item.type == 'peer'
- item.org_status == 'new'
############################################################################################
@@ -202,11 +202,11 @@
docker_url: "{{ network.docker.url }}"
approvers: "{{ item.endorsers | default('', true) }}"
loop: "{{ network['channels'] }}"
- when: add_new_org == 'true' or '2.' in network.version
+ when: add_new_org == 'true' or '2.' in network.version
vars: #These variables can be overriden from the command line
- privilege_escalate: false #Default to NOT escalate to root privledges
- install_os: "linux" #Default to linux OS
- install_arch: "amd64" #Default to amd64 architecture
- bin_install_dir: "~/bin" #Default to /bin install directory for binaries
- add_new_org: "false" # Default to false as this is for main network creation
+ privilege_escalate: false #Default to NOT escalate to root privledges
+ install_os: "linux" #Default to linux OS
+ install_arch: "amd64" #Default to amd64 architecture
+ bin_install_dir: "~/bin" #Default to /bin install directory for binaries
+ add_new_org: 'false' # Default to false as this is for main network creation
diff --git a/platforms/hyperledger-fabric/configuration/manage-user-certificate.yaml b/platforms/hyperledger-fabric/configuration/manage-user-certificate.yaml
index 46f7fa7d1cb..770a0d93aca 100644
--- a/platforms/hyperledger-fabric/configuration/manage-user-certificate.yaml
+++ b/platforms/hyperledger-fabric/configuration/manage-user-certificate.yaml
@@ -54,30 +54,22 @@
loop: "{{ network['organizations'] }}"
############################################################################################
- # This task generates the crypto material by running the ca_tools/peer playbook
+ # This task generates the crypto material by executing the generate-user-crypto.sh script file
+ # present in the Organization's CA Tools CLI
- name: Generate crypto material for user
include_role:
- name: "create/ca_tools/peer"
+ name: "create/users"
vars:
component_name: "{{ item.name | lower}}-net"
- component: "{{ item.name | lower}}"
component_type: "{{ item.type | lower}}"
- component_services: "{{ item.services }}"
- orderer_org: "{{ item.orderer_org | lower }}"
- sc_name: "{{ component }}-bevel-storageclass"
+ org_name: "{{ item.name }}"
+ services: "{{ item.services }}"
+ subject: "{{ item.subject }}"
+ cert_subject: "{{ item.subject | regex_replace('/', ';') | regex_replace(',', '/') | regex_replace(';', ',') }}" # replace , to / and / to , for certpath
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
- ca: "{{ item.services.ca }}"
- docker_url: "{{ network.docker.url }}"
- gitops: "{{ item.gitops }}"
- values_dir: "{{ playbook_dir }}/../../../{{ item.gitops.release_dir }}/{{ item.name | lower }}"
+ users: "{{ item.users }}"
+ proxy: "{{ network.env.proxy }}"
+ ca_url: "{{ item.ca_data.url }}"
loop: "{{ network['organizations'] }}"
- when: item.type == 'peer'
-
- vars: #These variables can be overriden from the command line
- privilege_escalate: false #Default to NOT escalate to root privledges
- install_os: "linux" #Default to linux OS
- install_arch: "amd64" #Default to amd64 architecture
- refresh_user_cert: 'true' #Default for this playbook is true
- bin_install_dir: "~/bin" #Default to ~/bin install directory for binaries
- add_new_org: "false"
+ when: item.type == 'peer' and item.users is defined
diff --git a/platforms/hyperledger-fabric/configuration/refresh-certificates.yaml b/platforms/hyperledger-fabric/configuration/refresh-certificates.yaml
index 568a5dca276..617a80bf99b 100644
--- a/platforms/hyperledger-fabric/configuration/refresh-certificates.yaml
+++ b/platforms/hyperledger-fabric/configuration/refresh-certificates.yaml
@@ -47,7 +47,6 @@
component: "{{ item.name | lower}}"
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
- sc_name: "{{ item.name | lower}}-bevel-storageclass"
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
ca: "{{ item.services.ca }}"
@@ -82,7 +81,6 @@
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
orderer_org: "{{ item.orderer_org | lower }}"
- sc_name: "{{ item.name | lower}}-bevel-storageclass"
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
ca: "{{ item.services.ca }}"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_server/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_server/tasks/main.yaml
index c094c4d0538..16cdc3413bf 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_server/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/ca_server/tasks/main.yaml
@@ -9,105 +9,38 @@
# Also, creates the value file for Certificate Authority (CA)
#############################################################################################
-# Create the folder to store crypto material
-- name: "creating the directory ./build/crypto-config/{{ component_type }}Organizations/{{ component_name }}/ca"
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/directory"
- vars:
- path: "./build/crypto-config/{{ component_type }}Organizations/{{ component_name }}/ca"
-
-- name: Check if CA key already exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "{{ component_name }}-CA.key"
- vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ component }}/{{ component_type }}Organizations/{{ component_name }}/ca"
- check: "certs_created"
-
-# Generate cacerts helmrelease file.
-- name: "Create value file for cacerts job"
- include_role:
- name: helm_component
- vars:
- name: "{{ component }}"
- type: "cacerts_job"
- component_name: "{{ component }}-cacerts-job"
- component_ns: "{{ component }}-net"
- subject: "{{ ca.subject }}"
- git_protocol: "{{ gitops.git_protocol }}"
- git_url: "{{ gitops.git_url }}"
- git_branch: "{{ gitops.branch }}"
- charts_dir: "{{ gitops.chart_source }}"
- vault: "{{ item.vault }}"
- values_dir: "{{playbook_dir}}/../../../{{ gitops.release_dir }}/{{ component }}"
- when: certs_created.failed == True
-
-# Git Push : Push the above generated files to git directory
-- name: Git Push
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
- vars:
- GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ item.gitops }}"
- msg: "[ci skip] Pushing CA server files"
- when: certs_created.failed == True
- tags:
- - notest
-
-# Check if cacerts-job is completed
-- name: Check if cacerts-job job is completed
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component"
- vars:
- component_type: Job
- namespace: "{{ component }}-net"
- component_name: "{{ component }}-cacerts-job"
- kubernetes: "{{ item.k8s }}"
- when: certs_created.failed == True
- tags:
- - notest
-
# Copy custom config for fabric-ca server
- name: Copy custom config for fabric-ca server
shell: |
cp {{ ca.configpath }} ../../../{{ gitops.chart_source }}/ca/conf/fabric-ca-server-config-{{ component }}.yaml
when: ca.configpath is defined
-# Create the CA value file for Orderer
-- name: "Create CA server values for Orderer"
- include_role:
- name: helm_component
- vars:
- name: "{{ ca.name }}"
- type: "ca-orderer"
- git_protocol: "{{ gitops.git_protocol }}"
- git_url: "{{ gitops.git_url }}"
- git_branch: "{{ gitops.branch }}"
- charts_dir: "{{ gitops.chart_source }}"
- external_url_suffix: "{{ item.external_url_suffix }}"
- when: component_type == 'orderer'
+- name: Get the kubernetes server url
+ shell: |
+ KUBECONFIG={{ kubernetes.config_file }} kubectl config view --minify | grep server | cut -f 2- -d ":" | tr -d " "
+ register: kubernetes_server_url
-# Create the CA value file for Organizations
-- name: "Create CA server values organizations"
+# Create the CA value file
+- name: "Create CA server values"
include_role:
name: helm_component
vars:
- name: "{{ ca.name }}"
- type: "ca-peer"
+ type: "ca-server"
+ name: "ca"
+ component_name: "{{ ca.name | lower }}"
git_protocol: "{{ gitops.git_protocol }}"
git_url: "{{ gitops.git_url }}"
git_branch: "{{ gitops.branch }}"
charts_dir: "{{ gitops.chart_source }}"
- external_url_suffix: "{{ item.external_url_suffix }}"
- when: component_type == 'peer'
+ subject: "{{ ca.subject | quote }}"
+ external_url_suffix: "{{ org.external_url_suffix }}"
+ kubernetes_url: "{{ kubernetes_server_url.stdout }}"
-# Git Push : Push the above generated files to git directory
+# Git Push: Push the above generated files to git directory
- name: Git Push
include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
vars:
GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ item.gitops }}"
- msg: "[ci skip] Pushing CA server files"
- tags:
- - notest
+ gitops: "{{ org.gitops }}"
+ msg: "[ci skip] Pushing CA Server files"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/orderer/tasks/delete_old_certs.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/orderer/tasks/delete_old_certs.yaml
deleted file mode 100644
index be8b4ef733b..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/orderer/tasks/delete_old_certs.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-#############################################################################################
-# This role creates value file for the deployment of CA Tools CLI
-#############################################################################################
-
-# Delete crypto materials from vault
-- name: Delete Crypto for orderers
- shell: |
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/orderers/{{orderer.name}}.{{ component_name }}/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/orderers/{{orderer.name}}.{{ component_name }}/msp
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/msp
- loop: "{{ item.services.orderers }}"
- loop_control:
- loop_var: orderer
- environment:
- VAULT_ADDR: "{{ item.vault.url }}"
- VAULT_TOKEN: "{{ item.vault.root_token }}"
- when: component_type == 'orderer'
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/orderer/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/orderer/tasks/main.yaml
deleted file mode 100644
index 0aa47a881f9..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/orderer/tasks/main.yaml
+++ /dev/null
@@ -1,195 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-#############################################################################################
-# This role creates value file for the deployment of CA Tools CLI
-#############################################################################################
-
-# Check if CA server is available
-- name: "waiting for the CA server to be created in {{ item.name | lower }}-net"
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component"
- vars:
- component_type: "Pod"
- namespace: "{{ item.name | lower }}-net"
- component_name: "{{ component_services.ca.name }}"
- label_selectors:
- - name = {{ component_name }}
- when: add_peer is not defined or add_peer != 'true'
-
-# Reset ca-tools pod
-- name: "Reset ca-tools pod"
- include_role:
- name: create/refresh_certs/reset_pod
- vars:
- pod_name: "ca-tools"
- file_path: "{{ values_dir }}/{{ pod_name }}/{{ component_name }}.yaml"
- gitops_value: "{{ item.gitops }}"
- component_ns: "{{ component_name }}"
- kubernetes: "{{ item.k8s }}"
- hr_name: "{{ component_name }}-ca-tools"
- when: refresh_cert is defined and refresh_cert == 'true'
-
-- name: "Delete old certificates"
- include_tasks: delete_old_certs.yaml
- vars:
- org_name: "{{ item.name | lower }}"
- when: refresh_cert is defined and refresh_cert == 'true'
-
-# Create the CA-tools value files
-- name: "Create CA-tools Values for orderer"
- include_role:
- name: helm_component
- vars:
- name: "ca-tools"
- type: "ca-tools"
- org_name: "{{ item.name | lower }}"
- component_type: "{{ item.type | lower }}"
- vault: "{{ item.vault }}"
- external_url_suffix: "{{ item.external_url_suffix }}"
- component_subject: "{{ item.subject }}"
- cert_subject: "{{ item.subject | regex_replace('/', ';') | regex_replace(',', '/') | regex_replace(';', ',') }}" # replace , to / and / to , for certpath
- component_country: "{{ item.country }}"
- component_state: "{{ item.state }}"
- component_location: "{{ item.location }}"
- ca_url: "{{ item.ca_data.url }}"
- proxy: "{{ network.env.proxy }}"
- git_protocol: "{{ gitops.git_protocol }}"
- git_url: "{{ gitops.git_url }}"
- git_branch: "{{ gitops.branch }}"
- charts_dir: "{{ gitops.chart_source }}"
- orderers_list: "{{ item.services.orderers }}"
-
-# Git Push : Push the above generated files to git directory
-- name: Git Push
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
- vars:
- GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ item.gitops }}"
- msg: "[ci skip] Pushing CA-tools files"
-
-# Wait for key certs exists in vault.
-- name: Wait for CA key exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "{{ component_name }}-CA.key"
- vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/ca"
- check: "crypto_materials"
-
-# Wait for admin tls exists in vault.
-- name: Wait for admin tls exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "client.key"
- vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/users/admin/tls"
- check: "crypto_materials"
-
-# Wait for orderers tls exists in vault.
-- name: Wait for orderers tls exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "server.key"
- vault_path: "{{ vault.secret_path | default('secretv2') }}/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/orderers/{{ orderer.name }}.{{ component_name}}/tls"
- check: "crypto_materials"
- loop: "{{ item.services.orderers }}"
- loop_control:
- loop_var: orderer
-
-# Copy the msp admincerts from vault
-- name: Fetch the msp admincerts from vault
- shell: |
- vault kv get -field=admincerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/msp > Admin@{{ component_name }}-cert.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/admincerts/
- mv Admin@{{ component_name }}-cert.pem ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/admincerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
-
-# Copy the msp cacerts from vault
-- name: Fetch the msp cacerts from vault
- shell: |
- vault kv get -field=cacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.external_url_suffix }}.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/cacerts/
- mv ca-{{ component_name }}-{{ item.external_url_suffix }}.pem ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/cacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy != 'none'
-
-# Copy the msp tlscacerts from vault
-- name: Fetch the msp tlscacerts from vault
- shell: |
- vault kv get -field=tlscacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.external_url_suffix }}.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/tlscacerts/
- mv ca-{{ component_name }}-{{ item.external_url_suffix }}.pem ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/tlscacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy != 'none'
-
-# Copy the msp cacerts from vault proxy is none
-- name: Fetch the msp cacerts from vault
- shell: |
- vault kv get -field=cacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/cacerts/
- mv ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/cacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy == 'none'
-
-# Copy the msp tlscacerts from vault when proxy is none
-- name: Fetch the msp tlscacerts from vault
- shell: |
- vault kv get -field=tlscacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/tlscacerts/
- mv ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem ./build/crypto-config/ordererOrganizations/{{ component_name }}/msp/tlscacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy == 'none'
-
-# Copy the tls server.crt from vault to the build directory
-- name: Fetch the tls server.crt from vault
- shell: |
- vault kv get -field=server.crt {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/orderers/{{ orderer.name }}.{{ component_name }}/tls > server.crt
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ component_name }}/orderers/{{ orderer.name }}.{{ component_name }}/tls
- mv server.crt ./build/crypto-config/ordererOrganizations/{{ component_name }}/orderers/{{ orderer.name }}.{{ component_name }}/tls/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- loop: "{{ item.services.orderers }}"
- loop_control:
- loop_var: orderer
-
-# Create the certs directory if it does not exist
-- name: Create the certs directory if it does not exist
- file:
- path: "{{ orderer.certificate | dirname }}"
- state: directory
- loop: "{{ network.orderers }}"
- loop_control:
- loop_var: orderer
- when: add_new_org == 'false' and add_peer is not defined
-
-# Copy the tls ca.crt file from the respective CA Tools CLI to the address specified in network.yaml
-- name: Fetch the tls ca.crt file from vault
- shell: |
- vault kv get -field=ca.crt {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/orderers/{{ orderer.name }}.{{ component_name }}/tls > ca.crt
- mv ca.crt {{ orderer.certificate }}
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- loop: "{{ network.orderers }}"
- loop_control:
- loop_var: orderer
- when:
- - add_new_org == 'false' and add_peer is not defined
- - component == orderer.org_name
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/delete_old_certs.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/delete_old_certs.yaml
deleted file mode 100644
index d2631cb3169..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/delete_old_certs.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-#############################################################################################
-# This role creates value file for the deployment of CA Tools CLI
-#############################################################################################
-
-# Delete crypto materials from vault
-- name: Delete Crypto for peers
- shell: |
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/msp
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/orderer/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/msp/config
- {% for peer in peers %}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/peers/{{peer.name}}.{{ component_name }}/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/peers/{{peer.name}}.{{ component_name }}/msp
- {% endfor %}
- {% for user in users %}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/{{user.identity}}/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/{{user.identity}}/msp
- {% endfor %}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/credentials/{{ component_name }}/couchdb/{{ org_name }}
- vars:
- peers: "{{ item.services.peers }}"
- environment:
- VAULT_ADDR: "{{ item.vault.url }}"
- VAULT_TOKEN: "{{ item.vault.root_token }}"
- when: component_type == 'peer' and refresh_cert is defined and refresh_cert == 'true'
-
-# Delete crypto materials from vault only for users
-- name: Delete Crypto for peers
- shell: |
- {% for user in users %}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/{{user.identity}}/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/{{user.identity}}/msp
- {% endfor %}
- vars:
- peers: "{{ item.services.peers }}"
- environment:
- VAULT_ADDR: "{{ item.vault.url }}"
- VAULT_TOKEN: "{{ item.vault.root_token }}"
- when: component_type == 'peer' and refresh_user_cert is defined and refresh_user_cert == 'true'
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/main.yaml
deleted file mode 100644
index 337533ade06..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/main.yaml
+++ /dev/null
@@ -1,245 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-#############################################################################################
-# This role creates value file for the deployment of CA Tools CLI
-#############################################################################################
-
-# Check if CA server is available
-- name: "waiting for the CA server to be created in {{ item.name | lower }}-net"
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component"
- vars:
- component_type: "Pod"
- namespace: "{{ item.name | lower }}-net"
- component_name: "{{ component_services.ca.name }}"
- label_selectors:
- - name = {{ component_name }}
- when: add_peer is not defined or add_peer != 'true'
-
-# Reset ca-tools pod
-- name: "Reset ca-tools pod"
- include_role:
- name: create/refresh_certs/reset_pod
- vars:
- pod_name: "ca-tools"
- file_path: "{{ values_dir }}/{{ pod_name }}/{{ component_name }}.yaml"
- gitops_value: "{{ item.gitops }}"
- component_ns: "{{ component_name }}"
- kubernetes: "{{ item.k8s }}"
- hr_name: "{{ component_name }}-ca-tools"
- when: (add_peer is defined and add_peer == 'true') or (refresh_cert is defined and refresh_cert == 'true') or (refresh_user_cert is defined and refresh_user_cert == 'true')
-
-# Delete old certificates
-- name: "Delete old certificates"
- include_tasks: delete_old_certs.yaml
- vars:
- org_name: "{{ item.name | lower }}"
- users: "{{ item.users }}"
- when: (refresh_cert is defined and refresh_cert == 'true') or (refresh_user_cert is defined and refresh_user_cert == 'true')
-
-# Get Orderer certificates
-- name: "Get Orderer certificates"
- include_tasks: nested_orderers.yaml
- loop: "{{ network.orderers }}"
- loop_control:
- loop_var: orderer
-
-# Create the certs directory if it does not exist
-- name: Create the certs directory if it does not exist
- file:
- path: "{{ playbook_dir }}/../charts/fabric-catools/certs"
- state: directory
-
-- set_fact:
- new_peer_list: []
-
-# Loop over the peers and finds the number of new peers
-- name: Count new peers
- set_fact:
- new_peer_list={{ new_peer_list + [ {'peer_name':peer.name } ] }}
- loop: "{{ item.services.peers }}"
- loop_control:
- loop_var: peer
- when:
- - peer.peerstatus is defined and peer.peerstatus == 'new'
- - add_peer is defined and add_peer == 'true'
-
-# Initialize the list new_peer_list
-- name: Count new peers
- set_fact:
- new_peer_list={{ item.services.peers }}
- when:
- - add_peer is not defined or add_peer == 'false'
-
-- set_fact:
- new_orderer_list: []
-
-# Loop over the orderers and get orderers from the organization provided in the network.yaml
-- name: Get orderers from the organization provided in the network.yaml
- set_fact:
- new_orderer_list={{ new_orderer_list + [orderer] }}
- loop: "{{ network.orderers }}"
- loop_control:
- loop_var: orderer
- when:
- - orderer_org == orderer.org_name | lower
-
-# Create the CA-tools value files
-- name: "Create CA-tools Values for peer"
- include_role:
- name: helm_component
- vars:
- name: "ca-tools"
- type: "ca-tools"
- org_name: "{{ item.name | lower }}"
- component_type: "{{ item.type | lower }}"
- vault: "{{ item.vault }}"
- external_url_suffix: "{{ item.external_url_suffix }}"
- component_subject: "{{ item.subject }}"
- cert_subject: "{{ item.subject | regex_replace('/', ';') | regex_replace(',', '/') | regex_replace(';', ',') }}" # Replace '/', ',', and ':' with ';', ',', and ',' respectively for certpath
- component_country: "{{ item.country }}"
- component_state: "{{ item.state }}"
- component_location: "{{ item.location }}"
- ca_url: "{{ item.ca_data.url }}"
- refresh_cert_value: "{{ refresh_cert | default(false) | quote }}"
- refresh_user_cert_value: "{{ refresh_user_cert | default(false) | quote }}"
- proxy: "{{ network.env.proxy }}"
- git_protocol: "{{ item.gitops.git_protocol }}"
- git_url: "{{ gitops.git_url }}"
- git_branch: "{{ gitops.branch }}"
- charts_dir: "{{ gitops.chart_source }}"
- peers_list: "{{ item.services.peers }}"
- orderers_list: "{{ new_orderer_list }}"
- peer_count: "{{ item.services.peers | length }}"
- add_peer_value: "{{ add_peer | default(false) | quote }}"
- new_peer_count: "{{ new_peer_list | length }}"
- user_list: "{{ item.users }}"
-
-# Git Push : Push the above generated files to git directory
-- name: Git Push
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
- vars:
- GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ item.gitops }}"
- msg: "[ci skip] Pushing CA-tools files"
-
-# Wait for CA key exists in vault.
-- name: Wait for CA key exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "{{ component_name }}-CA.key"
- vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/ca"
- check: "crypto_materials"
-
-# Wait for admin tls exists in vault.
-- name: Wait for admin tls exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "client.key"
- vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/users/admin/tls"
- check: "crypto_materials"
-
-# Wait for orderers tls exists in vault.
-- name: Wait for peers tls exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "server.key"
- vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/peers/{{ peer.name }}.{{ component_name }}/tls"
- check: "crypto_materials"
- loop: "{{ item.services.peers }}"
- loop_control:
- loop_var: peer
-
-# Wait for users tls exists in vault.
-- name: Wait for users tls exists in vault.
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- vault_field: "client.key"
- vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/{{ user.identity }}/tls"
- check: "crypto_materials"
- loop: "{{ item.users }}"
- loop_control:
- loop_var: user
- when: item.users is defined
-
-# Copy msp cacerts to given path
-- name: "Copy msp cacerts to given path"
- include_tasks: nested_endorsers.yaml
- vars:
- org_name: "{{ item.name |lower }}"
- approvers: "{{ channel.endorsers }}"
- loop: "{{ network.channels }}"
- loop_control:
- loop_var: channel
-
-# Fetch msp admincerts from vault
-- name: Fetch the msp admincerts from vault
- shell: |
- vault kv get -field=admincerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/msp > Admin@{{ component_name }}-cert.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/admincerts/
- mv Admin@{{ component_name }}-cert.pem ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/admincerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
-
-# Fetch msp cacerts from vault
-- name: Fetch the msp cacerts from vault
- shell: |
- vault kv get -field=cacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.external_url_suffix }}.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/cacerts/
- mv ca-{{ component_name }}-{{ item.external_url_suffix }}.pem ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/cacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy != 'none'
-
-# Fetch msp tlscacerts from vault
-- name: Fetch the msp tlscacerts from vault
- shell: |
- vault kv get -field=tlscacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.external_url_suffix }}.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/tlscacerts/
- mv ca-{{ component_name }}-{{ item.external_url_suffix }}.pem ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/tlscacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy != 'none'
-
-# Fetch msp cacerts from vault when proxy is none
-- name: Fetch the msp cacerts from vault
- shell: |
- vault kv get -field=cacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/cacerts/
- mv ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/cacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy == 'none'
-
-# Fetch msp tlscacerts from vault when proxy is none
-- name: Fetch the msp tlscacerts from vault
- shell: |
- vault kv get -field=tlscacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/msp > ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/tlscacerts/
- mv ca-{{ component_name }}-{{ item.services.ca.grpc.port }}.pem ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/tlscacerts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: network.env.proxy == 'none'
-
-# Fetch msp config.yaml file from vault
-- name: Fetch msp config.yaml file from vault
- shell: |
- vault kv get -field=configfile {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/msp/config > config.yaml
- mv config.yaml ./build/crypto-config/peerOrganizations/{{ component_name }}/msp/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_endorsers.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_endorsers.yaml
deleted file mode 100644
index fcd36c9975c..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_endorsers.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-# Get endorsers data
-- name: Get endorsers data
- include_tasks: nested_peers.yaml
- vars:
- org_peers: "{{ item.services.peers }}"
- endorsers_peers: "{{ endorser.peers }}"
- loop: "{{ approvers }}"
- loop_control:
- loop_var: endorser
- when: org_name == endorser.name
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_orderers.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_orderers.yaml
deleted file mode 100644
index b64c55d312a..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_orderers.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-# Check orderer-certificate file exists
-- name: Check that orderer-certificate file exists
- stat:
- path: "{{ orderer.certificate }}"
- register: orderer_file_result
- failed_when: add_new_org == 'true' and not orderer_file_result.stat.exists # Fail the task if new_org is added and orderer-cert does not exist
- tags:
- - notest
-
-# Check if Orderer certs exists in vault. If yes, get the certificate
-- name: Check if Orderer certs exist in Vault
- shell: |
- vault kv get -field=ca.crt {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/orderer/tls
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- register: orderer_certs_result
- ignore_errors: yes
- changed_when: false
- when:
- - not orderer_file_result.stat.exists
- tags:
- - notest
-
-# Save Orderer certs if not in Vault
-- name: Save Orderer certs if not in Vault
- local_action: copy content="{{ orderer_certs_result.results[0].stdout }}" dest="{{ orderer.certificate }}"
- when:
- - not orderer_file_result.stat.exists
- - orderer_certs_result.results[0].failed == False
- tags:
- - notest
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_peers.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_peers.yaml
deleted file mode 100644
index 23771ceee3e..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/nested_peers.yaml
+++ /dev/null
@@ -1,32 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-# Set a variable
-- set_fact:
- endorsers_peers_data: []
-
-# Get peers from the endorser
-- name: Get endorsers peers
- set_fact:
- endorsers_peers_data={{ endorsers_peers_data + [ {'name':peer.name | lower, 'certificate':peer.certificate } ] }}
- loop: "{{ endorsers_peers }}"
- loop_control:
- loop_var: peer
- when: peer.certificate is defined
-
-# Copy the certificates in the path provided in the network.yaml
-- name: "Copy certificates"
- include_tasks: write.yaml
- vars:
- endorsers_peers: "{{ endorsers_peers_data }}"
- loop: "{{ org_peers }}"
- loop_control:
- loop_var: org_peer
- when:
- - org_name == endorser.name
- - endorsers_peers_data is defined
- - endorsers_peers_data|length > 0
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/write.yaml b/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/write.yaml
deleted file mode 100644
index 80a3ed56388..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/ca_tools/peer/tasks/write.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
----
-# Create the certs directory if it does not exist
-- name: Create the certs directory if it does not exist
- file:
- path: "{{ peer.certificate | dirname }}"
- state: directory
- loop: "{{ endorsers_peers }}"
- loop_control:
- loop_var: peer
- when:
- - item.org_status == 'new'
- - org_peer.peerstatus is not defined or org_peer.peerstatus == 'new'
- - org_peer.name == peer.name
-
-# Get msp config.yaml file from vault
-- name: Get msp cacerts
- shell: |
- vault kv get -field=cacerts {{ vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/peers/{{ peer.name }}.{{ component_name }}/msp > {{ peer.certificate }}
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- loop: "{{ endorsers_peers }}"
- loop_control:
- loop_var: peer
- when:
- - item.org_status == 'new'
- - org_peer.peerstatus is not defined or org_peer.peerstatus == 'new'
- - org_peer.name == peer.name
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/channel_artifacts/tasks/fetch_orderers_certs.yaml b/platforms/hyperledger-fabric/configuration/roles/create/channel_artifacts/tasks/fetch_orderers_certs.yaml
deleted file mode 100644
index 1129576aec2..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/channel_artifacts/tasks/fetch_orderers_certs.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-# Fetch msp files from Vault
-- name: Check if orderers tls certs already created
- shell: |
- vault kv get -field=server.crt {{ organization.vault.secret_path | default('secretsv2') }}/{{ organization.name | lower }}/ordererOrganizations/{{ organization.name | lower }}-net/orderers/{{ orderer.name }}.{{ organization.name | lower }}-net/tls > server.crt
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/orderers/{{ orderer.name }}.{{ organization.name | lower }}-net/tls
- mv server.crt ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/orderers/{{ orderer.name }}.{{ organization.name | lower }}-net/tls
- environment:
- VAULT_ADDR: "{{ organization.vault.url }}"
- VAULT_TOKEN: "{{ organization.vault.root_token }}"
- loop: "{{ orderers }}"
- loop_control:
- loop_var: orderer
-
-# Fetch msp files from Vault
-- name: Check if msp admincerts already created
- shell: |
- vault kv get -field=admincerts {{ organization.vault.secret_path | default('secretsv2') }}/{{ organization.name | lower }}/ordererOrganizations/{{ organization.name | lower }}-net/users/admin/msp > Admin@{{ organization.name | lower }}-net-cert.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/msp/admincerts/
- mv Admin@{{ organization.name | lower }}-net-cert.pem ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/msp/admincerts/
- environment:
- VAULT_ADDR: "{{ organization.vault.url }}"
- VAULT_TOKEN: "{{ organization.vault.root_token }}"
-
-# Fetch msp files from Vault
-- name: Check if msp cacerts already created
- shell: |
- vault kv get -field=cacerts {{ organization.vault.secret_path | default('secretsv2') }}/{{ organization.name | lower }}/ordererOrganizations/{{ organization.name | lower }}-net/users/admin/msp > ca-{{ organization.name | lower }}-net-{{ organization.services.ca.grpc.port }}.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/msp/cacerts/
- mv ca-{{ organization.name | lower }}-net-{{ organization.services.ca.grpc.port }}.pem ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/msp/cacerts/
- environment:
- VAULT_ADDR: "{{ organization.vault.url }}"
- VAULT_TOKEN: "{{ organization.vault.root_token }}"
-
-# Fetch msp files from Vault
-- name: Check if msp tlscacerts already created
- shell: |
- vault kv get -field=tlscacerts {{ organization.vault.secret_path | default('secretsv2') }}/{{ organization.name | lower }}/ordererOrganizations/{{ organization.name | lower }}-net/users/admin/msp > ca-{{ organization.name | lower }}-net-{{ organization.services.ca.grpc.port }}.pem
- mkdir -p ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/msp/tlscacerts/
- mv ca-{{ organization.name | lower }}-net-{{ organization.services.ca.grpc.port }}.pem ./build/crypto-config/ordererOrganizations/{{ organization.name | lower }}-net/msp/tlscacerts/
- environment:
- VAULT_ADDR: "{{ organization.vault.url }}"
- VAULT_TOKEN: "{{ organization.vault.root_token }}"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/channel_artifacts/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/channel_artifacts/tasks/main.yaml
deleted file mode 100644
index da5a05fa56f..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/channel_artifacts/tasks/main.yaml
+++ /dev/null
@@ -1,169 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-##############################################################################################
-# This task ensures that the directory exists, and creates it, if it does not exist
-##############################################################################################
-
-# Create the build directory if it does not exist
-- name: Create build directory if it does not exist
- file:
- path: "./build"
- state: directory
-
-# Check configtxgen
-- name: Check configtxgen
- stat:
- path: "{{ build_path }}/configtxgen"
- register: config_stat_result
-
-# Register temporary directory
-- name: Register temporary directory
- tempfile:
- state: directory
- register: tmp_directory
-
-# Fetch orderers files from Vault
-- name: "Check if orderers certs already created"
- include_tasks: fetch_orderers_certs.yaml
- vars:
- orderers: "{{ organization.services.orderers }}"
- loop: "{{ network['organizations'] }}"
- loop_control:
- loop_var: organization
- when:
- - fetch_certs == 'true' and '2.5.' in network.version
- - organization.name == item.osn_creator_org.name
-
-# Fetch msp files from Vault
-- name: Check if msp admincerts already created
- vars:
- query: "organizations[?name=='{{organization.name}}'].services.ca.grpc.port"
- query_vault_url: "organizations[?name=='{{organization.name}}'].vault.url"
- query_vault_token: "organizations[?name=='{{organization.name}}'].vault.root_token"
- query_vault_secretPath: "organizations[?name=='{{organization.name}}'].vault.secret_path"
- shell: |
- vault kv get -field=admincerts {{ network | json_query(query_vault_secretPath) | first | default('secretsv2') }}/{{ organization.name | lower }}/peerOrganizations/{{ organization.name | lower }}-net/users/admin/msp > Admin@{{ organization.name | lower }}-net-cert.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ organization.name | lower }}-net/msp/admincerts/
- mv Admin@{{ organization.name | lower }}-net-cert.pem ./build/crypto-config/peerOrganizations/{{ organization.name | lower }}-net/msp/admincerts/
- environment:
- VAULT_ADDR: "{{ network | json_query(query_vault_url) | first }}"
- VAULT_TOKEN: "{{ network | json_query(query_vault_token) | first }}"
- loop: "{{ item['participants'] }}"
- loop_control:
- loop_var: organization
- when: fetch_certs == 'true'
-
-# Fetch msp files from Vault
-- name: Check if msp cacerts already created
- vars:
- query: "organizations[?name=='{{organization.name}}'].services.ca.grpc.port"
- query_vault_url: "organizations[?name=='{{organization.name}}'].vault.url"
- query_vault_token: "organizations[?name=='{{organization.name}}'].vault.root_token"
- query_vault_secretPath: "organizations[?name=='{{organization.name}}'].vault.secret_path"
- shell: |
- vault kv get -field=cacerts {{ network | json_query(query_vault_secretPath) | first | default('secretsv2') }}/{{ organization.name | lower }}/peerOrganizations/{{ organization.name | lower }}-net/users/admin/msp > ca-{{ organization.name | lower }}-net-{{ network | json_query(query) | first }}.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ organization.name | lower }}-net/msp/cacerts/
- mv ca-{{ organization.name | lower }}-net-{{ network | json_query(query) | first }}.pem ./build/crypto-config/peerOrganizations/{{ organization.name | lower }}-net/msp/cacerts/
- environment:
- VAULT_ADDR: "{{ network | json_query(query_vault_url) | first }}"
- VAULT_TOKEN: "{{ network | json_query(query_vault_token) | first }}"
- loop: "{{ item['participants'] }}"
- loop_control:
- loop_var: organization
- when: fetch_certs == 'true'
-
-# Fetch msp files from Vault
-- name: Check if msp tlscacerts already created
- vars:
- query: "organizations[?name=='{{organization.name}}'].services.ca.grpc.port"
- query_vault_url: "organizations[?name=='{{organization.name}}'].vault.url"
- query_vault_token: "organizations[?name=='{{organization.name}}'].vault.root_token"
- query_vault_secretPath: "organizations[?name=='{{organization.name}}'].vault.secret_path"
- shell: |
- vault kv get -field=tlscacerts {{ network | json_query(query_vault_secretPath) | first | default('secretsv2') }}/{{ organization.name | lower }}/peerOrganizations/{{ organization.name | lower }}-net/users/admin/msp > ca-{{ organization.name | lower }}-net-{{ network | json_query(query) | first }}.pem
- mkdir -p ./build/crypto-config/peerOrganizations/{{ organization.name | lower }}-net/msp/tlscacerts/
- mv ca-{{ organization.name | lower }}-net-{{ network | json_query(query) | first }}.pem ./build/crypto-config/peerOrganizations/{{ organization.name | lower }}-net/msp/tlscacerts/
- environment:
- VAULT_ADDR: "{{ network | json_query(query_vault_url) | first }}"
- VAULT_TOKEN: "{{ network | json_query(query_vault_token) | first }}"
- loop: "{{ item['participants'] }}"
- loop_control:
- loop_var: organization
- when: fetch_certs == 'true'
-
-############################################################################################
-# Fetch the configtx gen tar file from the mentioned URL
-- name: "Getting the configtxgen binary tar"
- get_url:
- url: https://github.com/hyperledger/fabric/releases/download/v{{network.version}}/hyperledger-fabric-{{install_os}}-{{install_arch}}-{{network.version}}.tar.gz
- dest: "{{ tmp_directory.path }}"
- when: config_stat_result.stat.exists == False
-
-
-############################################################################################
-# Unzip the above downloaded tar file
-- name: "Unziping the downloaded file"
- unarchive:
- src: "{{ tmp_directory.path }}/hyperledger-fabric-{{install_os}}-{{install_arch}}-{{network.version}}.tar.gz"
- dest: "{{ tmp_directory.path }}"
- when: config_stat_result.stat.exists == False
-
-############################################################################################
-# Extract the configtxgen binary and place it at appropriate path
-- name: "Moving the configtxgen from the extracted folder and place in it path"
- copy:
- src: "{{ tmp_directory.path }}/bin/configtxgen"
- dest: "{{ build_path }}/configtxgen"
- mode: 0755
- when: config_stat_result.stat.exists == False
-
-############################################################################################
-# Create the channel-artifacts folder
-- name: "Creating channel-artifacts folder"
- file:
- path: "{{ build_path }}/channel-artifacts"
- state: directory
-
-# Remove old channel block
-- name: Remove old channel block
- file:
- path: "{{ build_path }}/channel-artifacts/{{channel_name}}.tx"
- state: absent
- when: add_new_org == 'false'
-
-############################################################################################
-# Create channel by consuming the configtx.yaml file
-- name: "Creating channels"
- shell: |
- cd {{ build_path }}
- ./configtxgen -profile {{ profile_name }} -outputCreateChannelTx ./channel-artifacts/{{channel_name}}.tx -channelID {{channel_name}}
- cat ./channel-artifacts/{{channel_name}}.tx | base64 > ./channel-artifacts/{{channel_name}}.tx.base64
- when: add_new_org == 'false'
-
-############################################################################################
-# Create the anchortx files
-- name: "Creating Anchor artifacts"
- shell: |
- cd {{ build_path }}
- ./configtxgen -profile {{ profile_name }} -outputAnchorPeersUpdate ./channel-artifacts/{{channel_name}}{{participant.name}}MSPAnchor.tx -channelID {{channel_name}} -asOrg {{participant.name}}MSP -configPath ./
- cat ./channel-artifacts/{{channel_name}}{{participant.name}}MSPAnchor.tx | base64 > ./channel-artifacts/{{channel_name}}{{participant.name}}MSPAnchor.tx.base64
- loop: "{{ item.participants }}"
- loop_control:
- loop_var: participant
- when: add_new_org == 'false'
-
-# Create the channel by consuming the configtx.yaml file
-- name: "Creating JSON configuration for new organization"
- shell: |
- cd {{ build_path }}
- export FABRIC_CFG_PATH=$PWD
- ./configtxgen -printOrg {{ participant.name }}MSP > ./channel-artifacts/{{ channel_name | lower }}.json
- loop: "{{ item.participants }}"
- loop_control:
- loop_var: participant
- register: result
- when: participant.org_status == 'new' and add_new_org == 'true'
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/peercheck.yaml b/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/peercheck.yaml
index 1fd57b7d56b..21c738e9dc8 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/peercheck.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/peercheck.yaml
@@ -4,6 +4,11 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
+# Set Variable charts_dir
+- name: "Set Variable charts_dir"
+ set_fact:
+ charts_dir: "{{ org.gitops.chart_source }}"
+
# Waiting for the creation of peer pod
- name: "Waiting for peer pod {{ peer_name }} in {{ org.name | lower }}-net"
include_role:
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/valuefile.yaml b/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/valuefile.yaml
index 4eabac444a9..a51483a20b8 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/valuefile.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/channels/tasks/valuefile.yaml
@@ -19,7 +19,7 @@
loop: "{{ network['organizations'] }}"
loop_control:
loop_var: ordererorg
- when: ordererorg.type == 'orderer'
+ when: ordererorg.services.orderers is defined and ordererorg.services.orderers | length > 0
# Check or wait for the peer
- name: "Check peer pod is up"
@@ -31,10 +31,38 @@
loop_control:
loop_var: org
+# Get channeltx file from configmap obtener los datos del ordener en un task a aprte y despeus ahcer esto
+- name: Get channeltx file from config map
+ kubernetes.core.k8s_info:
+ kubeconfig: "{{ orderer_kubeconfig }}"
+ kind: ConfigMap
+ name: "{{ channel_name }}-channeltx"
+ namespace: "{{ orderer_namespace}}"
+ loop: "{{ network['organizations'] }}"
+ loop_control:
+ loop_var: ordererorg
+ vars:
+ orderer_namespace: "{{ ordererorg.name | lower }}-net"
+ orderer_kubeconfig: "{{ ordererorg.k8s.config_file }}"
+ orderer_context: "{{ ordererorg.k8s.context }}"
+ register: channeltx_data
+
+# Create the certs directory if it does not existt
+- name: Create the certs directory if it does not exist
+ file:
+ path: "{{playbook_dir}}/../../../{{ charts_dir }}/fabric-channel-create/files"
+ state: directory
+
+- name: Save channeltx file locally for {{ channel_name }}
+ shell: |
+ echo '{{ channeltx_data.results[0].resources[0].data[channel_name ~ "-channeltx_base64"] | to_nice_json }}' > {{ files_loc }}/channeltx.json
+ vars:
+ files_loc: "{{playbook_dir}}/../../../{{ charts_dir }}/fabric-channel-create/files"
+
# Create the value file for creator Organization
- name: "Create Create_Channel value file"
include_role:
- name: helm_component
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/create/job_component"
loop: "{{ network | json_query(org_query) }}"
loop_control:
loop_var: org
@@ -43,16 +71,18 @@
name: "{{ org.name | lower }}"
type: "create_channel_job"
component_name: "{{item.channel_name|lower}}"
+ channel_name: "{{item.channel_name}}"
component_ns: "{{ peer.name | lower}}-net"
peer_name: "{{ peer | json_query('peers[*].name') | first }}"
+ peer_adress: "{{ peer | json_query('peers[*].peerAddress') | first }}"
git_protocol: "{{ org.gitops.git_protocol }}"
git_url: "{{ org.gitops.git_url }}"
git_branch: "{{ org.gitops.branch }}"
charts_dir: "{{ org.gitops.chart_source }}"
- vault: "{{ org.vault }}"
- k8s: "{{ org.k8s }}"
- channeltx: "{{ lookup('file', '{{ build_path }}/channel-artifacts/{{item.channel_name|lower}}.tx.base64') }}"
values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
+ provider: "{{ org.cloud_provider }}"
+ vault: "{{ org.vault }}"
+ kubernetes: "{{ org.k8s }}"
# Git Push : Push the above generated files to git directory
- name: Git Push
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/check.yaml b/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/check.yaml
index 88cfa4e5326..b73cc89987e 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/check.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/check.yaml
@@ -15,8 +15,7 @@
vars:
component_type: "Job"
namespace: "{{ participant.name | lower }}-net"
- component_name: "joinchannel-{{ peer.name }}-{{ channel_name }}"
- kubernetes: "{{ org.k8s }}"
+ component_name: "{{ channel_name }}-{{ participant.name }}-{{ peer.name }}"
loop: "{{ participant.peers }}"
loop_control:
loop_var: peer
@@ -29,7 +28,6 @@
vars:
namespace: "{{ participant.name | lower }}-net"
pod_name: "{{ peer.name }}-0"
- kubernetes: "{{ org.k8s }}"
loop: "{{ participant.peers }}"
loop_control:
loop_var: peer
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/main.yaml
index e9f6eced5ee..0fb48627fe6 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/main.yaml
@@ -11,6 +11,7 @@
channel_name: "{{ item.channel_name | lower }}"
org_query: "organizations[?name=='{{participant.name}}']"
org: "{{ network | json_query(org_query) | first }}"
+ kubernetes: "{{ org.k8s }}"
loop: "{{ participants }}"
loop_control:
loop_var: participant
@@ -24,6 +25,7 @@
channel_name: "{{ item.channel_name | lower }}"
org_query: "organizations[?name=='{{participant.name}}']"
org: "{{ network | json_query(org_query) | first }}"
+ kubernetes: "{{ org.k8s }}"
loop: "{{ participants }}"
loop_control:
loop_var: participant
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/nested_channel_join.yaml b/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/nested_channel_join.yaml
index 326ea32d05b..e318dffba2c 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/nested_channel_join.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/channels_join/tasks/nested_channel_join.yaml
@@ -14,21 +14,57 @@
vars:
component_type: "Job"
namespace: "{{ participant.name | lower}}-net"
- component_name: "createchannel-{{ channel_name }}"
+ component_name: "{{ channel_name }}"
kubernetes: "{{ org.k8s }}"
when:
- participant.type == 'creator' and ('2.2.' in network.version or '1.4.' in network.version)
- participant.org_status is not defined or participant.org_status == 'new'
+# Get anchortx file from configmap obtener los datos del ordener en un task a aprte y despeus ahcer esto
+- name: Get anchortx file from config map
+ kubernetes.core.k8s_info:
+ kubeconfig: "{{ orderer_kubeconfig }}"
+ kind: ConfigMap
+ name: "{{ channel_name }}-{{ participant.name | lower }}-anchortx"
+ namespace: "{{ orderer_namespace}}"
+ loop: "{{ network['organizations'] }}"
+ loop_control:
+ loop_var: ordererorg
+ vars:
+ orderer_namespace: "{{ ordererorg.name | lower }}-net"
+ orderer_kubeconfig: "{{ ordererorg.k8s.config_file }}"
+ orderer_context: "{{ ordererorg.k8s.context }}"
+ register: anchortx_data
+ when:
+ - (participant.org_status is not defined or participant.org_status == 'new') and ('2.2.' in network.version or '1.4.' in network.version)
+
+# Create the certs directory if it does not existt
+- name: Create the certs directory if it does not exist
+ file:
+ path: "{{playbook_dir}}/../../../{{ charts_dir }}/fabric-channel-join/files"
+ state: directory
+ when:
+ - (participant.org_status is not defined or participant.org_status == 'new') and ('2.2.' in network.version or '1.4.' in network.version)
+
+- name: Save anchortx file locally for {{ channel_name }}
+ shell: |
+ echo '{{ anchortx_data.results[0].resources[0].data[field_name ~ "-anchortx_base64"] | to_nice_json }}' > {{ files_loc }}/anchortx.json
+ vars:
+ files_loc: "{{playbook_dir}}/../../../{{ charts_dir }}/fabric-channel-join/files"
+ field_name: "{{ channel_name }}-{{ participant.name | lower}}"
+ when:
+ - (participant.org_status is not defined or participant.org_status == 'new') and ('2.2.' in network.version or '1.4.' in network.version)
+
# Create the join channel value file for each participating peer
- name: "join channel {{ channel_name }}"
include_role:
- name: helm_component
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/create/job_component"
vars:
name: "{{ participant.name }}"
type: "join_channel_job"
- component_name: "join-{{ channel_name }}-{{ participant.name }}-{{ peer.name }}"
+ component_name: "{{ channel_name }}-{{ participant.name }}-{{ peer.name }}"
peer_name: "{{ peer.name }}"
+ peer_type: "{{ peer.type }}"
component_ns: "{{ participant.name | lower}}-net"
git_protocol: "{{ org.gitops.git_protocol }}"
git_url: "{{ org.gitops.git_url }}"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/cli_pod/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/cli_pod/tasks/main.yaml
deleted file mode 100644
index bac5f7132ff..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/cli_pod/tasks/main.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-#############################################################################################
-# This role creates value file for Cli pods
-############################################################################################
-# CREATE CLI POD #
-############################################################################################
-
-# Reset peers pods
-- name: "Reset peers pods"
- include_role:
- name: create/refresh_certs/reset_pod
- vars:
- pod_name: "cli"
- file_path: "{{ values_dir }}/{{ pod_name }}/{{ peer.name | lower}}-{{ org.name | lower }}-cli.yaml"
- gitops_value: "{{ org.gitops }}"
- component_ns: "{{ org.name | lower}}-net"
- kubernetes: "{{ org.k8s }}"
- hr_name: "{{ peer.name | lower}}-{{ org.name | lower }}-cli"
- loop: "{{ peers }}"
- loop_control:
- loop_var: peer
- when:
- - refresh_cert is defined and refresh_cert == 'true'
- - peer.cli is defined
- - peer.cli == "enabled"
-
-# Create the value file for the cli pod as per requirements mentioned in network.yaml
-- name: "Create Value file for CLI Pod"
- include_role:
- name: helm_component
- vars:
- name: "cli"
- component_name: "{{ peer.name | lower}}-{{ org.name | lower }}-cli"
- orderer: "{{ network.orderers | first }}"
- component_ns: "{{ org.name | lower}}-net"
- git_protocol: "{{ org.gitops.git_protocol }}"
- git_url: "{{ org.gitops.git_url }}"
- git_branch: "{{ org.gitops.branch }}"
- charts_dir: "{{ org.gitops.chart_source }}"
- vault: "{{ org.vault }}"
- sc_name: "{{ org.name | lower }}-bevel-storageclass"
- values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
- type: "cli"
- external_url_suffix: "{{ org.external_url_suffix }}"
- loop: "{{ peers }}"
- loop_control:
- loop_var: peer
- when:
- - peer.peerstatus is not defined or peer.peerstatus == 'new'
- - peer.cli is defined
- - peer.cli == "enabled"
-
-# Git Push : Push the above generated files to git directory
-- name: Git Push
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
- vars:
- GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ org.gitops }}"
- msg: "[ci skip] Pushing CLI value files"
- loop: "{{ peers }}"
- loop_control:
- loop_var: peer
- when: peer.cli is defined and peer.cli == "enabled"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/configtx/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/configtx/tasks/main.yaml
deleted file mode 100644
index a6d99caa40c..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/configtx/tasks/main.yaml
+++ /dev/null
@@ -1,125 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-##############################################################################################
-# This role creates configtx.yaml file which is consumed by configtxgen tool
-##############################################################################################
-
-##############################################################################################
-# Create the configtx.yaml file as the requirements mentioned in network.yaml
-# file. The configtx.yaml file is consumed by the configtxgen binary to generate the
-# genesis block and channels.
-##############################################################################################
-
-# Create the build directory if it does not exist
-- name: Create build directory if it does not exist
- file:
- path: "./build"
- state: directory
-
-# Remove old configtx file
-- name: "Remove old configtx file"
- file:
- path: "{{ config_file }}"
- state: absent
-
-# The tasks add the required data patch by patch to the configtx.yaml file to generate it.
-- name: "create configtx.yaml file"
- file:
- path: "{{ config_file }}"
- state: touch
-
-# Copy custom files if present
-- name: "Copy custom files if present"
- copy:
- src: "{{ network.configtx.folder_path }}"
- dest: ./roles/create/configtx/templates
- when: network.configtx is defined and network.configtx.custom == true
-
-# Checking if custom init patch to configtx.yaml exists
-- name: "Checking if custom init patch to configtx.yaml exists"
- stat:
- path: "{{ network.configtx.folder_path }}configtxinit_custom.tpl"
- register: cfinit
- when: network.configtx is defined and network.configtx.custom == true
-
-# Add init patch to configtx.yaml
-- name: "Adding init patch to configtx.yaml"
- blockinfile:
- dest: "{{ config_file }}"
- block: "{{ lookup('template', filename) }}"
- marker: "#"
- vars:
- consensus: "{{ org.services.consensus }}"
- org_query: "organizations[?type=='orderer']"
- org: "{{ network | json_query(org_query) | first }}"
- filename: configtxinit_{{ 'custom' if network.configtx is defined and network.configtx.custom == true and cfinit.stat.exists else 'default' }}.tpl
-
-# Check if custom init patch to configtx.yaml exists
-- name: "Checking if custom init patch to configtx.yaml exists"
- stat:
- path: "{{ network.configtx.folder_path }}configtxOrg_custom.tpl"
- register: cforg
- when: network.configtx is defined and network.configtx.custom == true
-
-# Add organization patch to configtx.yaml
-- name: "Adding organization patch to configtx.yaml"
- blockinfile:
- dest: "{{ config_file }}"
- block: "{{ lookup('template', filename) }}"
- marker: "#"
- vars:
- component_name: "{{ item.name }}"
- component_ns: "{{ item.name | lower }}-net"
- component_type: "{{ item.type | lower }}"
- orderers: "{{ network.orderers }}"
- provider: "{{ network.env.proxy }}"
- filename: configtxOrg_{{ 'custom' if network.configtx is defined and network.configtx.custom == true and cforg.stat.exists else 'default' }}.tpl
- loop: "{{ network['organizations'] }}"
-
-# Check if custom init patch to configtx.yaml exists
-- name: "Checking if custom init patch to configtx.yaml exists"
- stat:
- path: "{{ network.configtx.folder_path }}configtxOrderer_custom.tpl"
- register: cford
- when: network.configtx is defined and network.configtx.custom == true
-
-# Add orderer patch to configtx.yaml
-- name: "Adding orderer patch to configtx.yaml"
- blockinfile:
- dest: "{{ config_file }}"
- block: "{{ lookup('template', filename) }}"
- marker: "#"
- vars:
- orderers: "{{ network.orderers }}"
- consensus: "{{ network.consensus }}"
- provider: "{{ network.env.proxy }}"
- filename: configtxOrderer_{{ 'custom' if network.configtx is defined and network.configtx.custom == true and cford.stat.exists else 'default' }}.tpl
-
-# Check if custom init patch to configtx.yaml exists
-- name: "Checking if custom init patch to configtx.yaml exists"
- stat:
- path: "{{ network.configtx.folder_path }}configtxProfile_custom.tpl"
- register: cfprofile
- when: network.configtx is defined and network.configtx.custom == true
-
-# Add profile patch to configtx.yaml
-- name: "Adding profile patch to configtx.yaml"
- blockinfile:
- dest: "{{ config_file }}"
- block: "{{ lookup('template', filename) }}"
- marker: "#"
- vars:
- orderers: "{{ network.orderers }}"
- consensus: "{{ network.consensus }}"
- provider: "{{ network.env.proxy }}"
- filename: configtxProfile_{{ 'custom' if network.configtx is defined and network.configtx.custom == true and cfprofile.stat.exists else 'default' }}.tpl
- when: network.channels is defined
-
-# Display configtx file contents
-- name: Display configtx file contents
- debug:
- msg: "The configtx file is: {{ lookup('file', './build/configtx.yaml') }}"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxOrderer_default.tpl b/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxOrderer_default.tpl
deleted file mode 100644
index 18245f54937..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxOrderer_default.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-Orderer: &OrdererDefaults
-{% if consensus.name == 'raft' %}
- OrdererType: etcdraft
-{% else %}
- OrdererType: {{ consensus.name }}
-{% endif %}
- Addresses:
-{% for orderer in orderers %}
-{% if provider == 'none' %}
- - {{ orderer.name }}.{{ orderer.org_name | lower }}-net:7050
-{% else %}
- - {{ orderer.uri }}
-{% endif %}
-{% endfor %}
- BatchTimeout: 2s
- BatchSize:
- MaxMessageCount: 10
- AbsoluteMaxBytes: 98 MB
- PreferredMaxBytes: 1024 KB
-{% if consensus.name == 'kafka' %}
- Kafka:
- Brokers:
-{% for org in network.organizations %}
-{% if org.services.orderers is defined and org.services.orderers|length > 0 %}
-{% for i in range(consensus.replicas) %}
- - {{ consensus.name }}-{{ i }}.{{ consensus.type }}.{{ org.name |lower }}-net.svc.cluster.local:{{ consensus.grpc.port }}
-{% endfor %}
-{% endif %}
-{% endfor %}
-{% endif %}
-{% if consensus.name == 'raft' %}
- EtcdRaft:
- Consenters:
-{% for orderer in orderers %}
-{% set component_ns = orderer.org_name.lower() + '-net' %}
-{% if provider == 'none' %}
- - Host: {{orderer.name}}.{{ component_ns }}
- Port: 7050
-{% else %}
-{% set path = orderer.uri.split(':') %}
- - Host: {{ path[0] }}
- Port: {{ path[1] }}
-{% endif %}
- ClientTLSCert: ./crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name }}.{{ component_ns }}/tls/server.crt
- ServerTLSCert: ./crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name }}.{{ component_ns }}/tls/server.crt
-{% endfor %}
-{% endif %}
- Organizations:
- Policies:
- Readers:
- Type: ImplicitMeta
- Rule: "ANY Readers"
- Writers:
- Type: ImplicitMeta
- Rule: "ANY Writers"
- Admins:
- Type: ImplicitMeta
- Rule: "MAJORITY Admins"
- BlockValidation:
- Type: ImplicitMeta
- Rule: "ANY Writers"
- Capabilities:
- <<: *OrdererCapabilities
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxOrg_default.tpl b/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxOrg_default.tpl
deleted file mode 100644
index ffc192806db..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxOrg_default.tpl
+++ /dev/null
@@ -1,45 +0,0 @@
- - &{{ component_name }}Org
- Name: {{ component_name }}MSP
- ID: {{ component_name }}MSP
- MSPDir: ./crypto-config/{{ component_type }}Organizations/{{ component_ns }}/msp
- Policies:
- Readers:
- Type: Signature
- Rule: "OR('{{ component_name }}MSP.member')"
- Writers:
- Type: Signature
- Rule: "OR('{{ component_name }}MSP.member')"
- Admins:
- Type: Signature
- Rule: "OR('{{ component_name }}MSP.admin')"
- Endorsement:
- Type: Signature
- Rule: "OR('{{ component_name }}MSP.member')"
-{% if component_type == 'peer' and '2.5' not in network.version %}
- AnchorPeers:
- # AnchorPeers defines the location of peers which can be used
- # for cross org gossip communication. Note, this value is only
- # encoded in the genesis block in the Application section context
-{% for peer in item.services.peers %}
-{% if peer.type == 'anchor' %}
-{% if provider == 'none' %}
- - Host: {{ peer.name }}.{{ component_ns }}
- Port: 7051
-{% else %}
-{% set path = peer.peerAddress.split(':') %}
- - Host: {{ path[0] }}
- Port: {{ path[1] }}
-{% endif %}
-{% endif %}
-{% endfor %}
-{% endif %}
-{% if component_type == 'orderer' %}
- OrdererEndpoints:
-{% for orderer in orderers %}
-{% if provider == 'none' %}
- - {{ orderer.name }}.{{ orderer.org_name | lower }}-net:7050
-{% else %}
- - {{ orderer.uri }}
-{% endif %}
-{% endfor %}
-{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxProfile_default.tpl b/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxProfile_default.tpl
deleted file mode 100644
index bccfbba8670..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxProfile_default.tpl
+++ /dev/null
@@ -1,51 +0,0 @@
-Profiles:
-{% for channel in network.channels %}
- {{channel.genesis.name}}:
- <<: *ChannelDefaults
- Orderer:
- <<: *OrdererDefaults
-{% if consensus.name == 'raft' %}
- OrdererType: etcdraft
- EtcdRaft:
- Consenters:
-{% for orderer in orderers %}
-{% set component_ns = orderer.org_name.lower() + '-net' %}
-{% if provider == 'none' %}
- - Host: {{orderer.name}}.{{ component_ns }}
- Port: 7050
-{% else %}
-{% set path = orderer.uri.split(':') %}
- - Host: {{ path[0] }}
- Port: {{ path[1] }}
-{% endif %}
- ClientTLSCert: ./crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name }}.{{ component_ns }}/tls/server.crt
- ServerTLSCert: ./crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name }}.{{ component_ns }}/tls/server.crt
-{% endfor %}
-{% endif %}
- Organizations:
-{% for orderer in channel.orderers %}
- - *{{ orderer }}Org
-{% endfor %}
-{% if '2.5' not in network.version %}
- Consortiums:
- {{channel.consortium}}:
- Organizations:
-{% for org in network.organizations %}
-{% if org.type != 'orderer' %}
- - *{{org.name}}Org
-{% endif %}
-{% endfor %}
- {{channel.channel_name}}:
- <<: *ChannelDefaults
- Consortium: {{channel.consortium}}
-{% endif %}
- Application:
- <<: *ApplicationDefaults
- Organizations:
-{% for org in channel.participants %}
- - *{{org.name}}Org
-{% endfor %}
-{% if '2.5' in network.version %}
- Capabilities: *ApplicationCapabilities
-{% endif %}
-{% endfor %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxinit_default.tpl b/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxinit_default.tpl
deleted file mode 100644
index 9d3948012f4..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/configtx/templates/configtxinit_default.tpl
+++ /dev/null
@@ -1,73 +0,0 @@
----
-Capabilities:
-{% if '2.' in network.version %}
- Channel: &ChannelCapabilities
- V2_0: true
- Orderer: &OrdererCapabilities
- V2_0: true
- Application: &ApplicationCapabilities
-{% if '2.5' in network.version %}
- V2_5: true
-{% else %}
- V2_0: true
-{% endif %}
-{% endif %}
-{% if '1.4' in network.version %}
-{% if consensus.name == 'kafka' %}
- Global: &ChannelCapabilities
- V1_1: true
- Orderer: &OrdererCapabilities
- V1_1: true
- Application: &ApplicationCapabilities
- V1_1: true
-{% endif %}
-{% if consensus.name == 'raft' %}
- Global: &ChannelCapabilities
- V1_4_3: true
- Orderer: &OrdererCapabilities
- V1_4_2: true
- Application: &ApplicationCapabilities
- V1_4_2: true
-{% endif %}
-{% endif %}
-
-Application: &ApplicationDefaults
- Organizations:
-{% if '2.' in network.version %}
- Policies: &ApplicationDefaultPolicies
- LifecycleEndorsement:
- Type: ImplicitMeta
- Rule: "MAJORITY Endorsement"
- Endorsement:
- Type: ImplicitMeta
- Rule: "MAJORITY Endorsement"
- Readers:
- Type: ImplicitMeta
- Rule: "ANY Readers"
- Writers:
- Type: ImplicitMeta
- Rule: "ANY Writers"
- Admins:
- Type: ImplicitMeta
- Rule: "MAJORITY Admins"
-{% endif %}
- Capabilities:
- <<: *ApplicationCapabilities
-
-Channel: &ChannelDefaults
-{% if '2.' in network.version %}
- Policies:
- Readers:
- Type: ImplicitMeta
- Rule: "ANY Readers"
- Writers:
- Type: ImplicitMeta
- Rule: "ANY Writers"
- Admins:
- Type: ImplicitMeta
- Rule: "MAJORITY Admins"
-{% endif %}
- Capabilities:
- <<: *ChannelCapabilities
-
-Organizations:
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/console_assets/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/console_assets/tasks/main.yaml
index 7de25f29f49..c76b64154d0 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/console_assets/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/console_assets/tasks/main.yaml
@@ -18,7 +18,7 @@
# Get CA info from public url
- name: Get CA data info
uri:
- url: "https://{{ item.ca_data.url }}"
+ url: "https://{{ item.ca_data.url }}/cainfo"
validate_certs: no
return_content: yes
register: url_output
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/tasks/main.yaml
deleted file mode 100644
index 31595836185..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/tasks/main.yaml
+++ /dev/null
@@ -1,68 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-#############################################################################################
-# This role creates the generate_crypto.sh script for orderers and organizations.
-#############################################################################################
-
-# Create the build directory if it does not exist
-- name: Create build directory if it does not exist
- file:
- path: "./build"
- state: directory
-
-# Create the generate_crypto.sh file for orderers
-- name: Create generate_crypto script file for orderers
- template:
- src: "orderer_script.tpl"
- dest: "./build/generate-crypto-{{ component_name }}-{{ peer_name }}.sh"
- vars:
- component_name: "{{ item.name | lower }}"
- component_ns: "{{ item.name | lower }}-net"
- component_country: "{{ item.country }}"
- component_subject: "{{ item.subject }}"
- component_state: "{{ item.state }}"
- component_location: "{{ item.location }}"
- ca_url: "{{ item.ca_data.url }}"
- peer_name: "{{ orderer.name }}"
- proxy: "{{ network.env.proxy }}"
- loop: "{{ orderers }}"
- loop_control:
- loop_var: orderer
- when: component_type == 'orderer'
-
-# Create the generate-crypto-{{ component_name }}.sh file for orderer organizations
-- name: Create generate_crypto script file for orderer organisation
- template:
- src: "orderer_organisation_script.tpl"
- dest: "./build/generate-crypto-{{ component_name }}.sh"
- vars:
- component_name: "{{ item.name | lower }}"
- component_ns: "{{ item.name | lower }}-net"
- component_subject: "{{ item.subject }}"
- component_country: "{{ item.country }}"
- component_state: "{{ item.state }}"
- component_location: "{{ item.location }}"
- ca_url: "{{ item.ca_data.url }}"
- proxy: "{{ network.env.proxy }}"
- when: component_type == 'orderer'
-
-# Create the generate_crypto.sh file for organizations
-- name: Create generate_crypto script file for organisations
- template:
- src: "organisation_script.tpl"
- dest: "./build/generate-crypto-{{ component_name }}.sh"
- vars:
- component_name: "{{ item.name | lower }}"
- component_ns: "{{ item.name | lower }}-net"
- component_subject: "{{ item.subject }}"
- component_country: "{{ item.country }}"
- component_state: "{{ item.state }}"
- component_location: "{{ item.location }}"
- ca_url: "{{ item.ca_data.url }}"
- peer_count: "{{ item.services.peers | length }}"
- proxy: "{{ network.env.proxy }}"
- when: component_type == 'peer'
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/orderer_organisation_script.tpl b/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/orderer_organisation_script.tpl
deleted file mode 100644
index 31ad7014d99..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/orderer_organisation_script.tpl
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-
-set -x
-
-CURRENT_DIR=${PWD}
-FULLY_QUALIFIED_ORG_NAME="{{ component_ns }}"
-EXTERNAL_URL_SUFFIX="{{ item.external_url_suffix }}"
-ALTERNATIVE_ORG_NAMES=("{{ item.external_url_suffix }}")
-ORG_NAME="{{ component_name }}"
-SUBJECT="C={{ component_country }},ST={{ component_state }},L={{ component_location }},O={{ component_name }}"
-SUBJECT_PEER="{{ component_subject }}"
-CA="{{ ca_url }}"
-CA_ADMIN_USER="${ORG_NAME}-admin"
-CA_ADMIN_PASS="${ORG_NAME}-adminpw"
-
-ORG_ADMIN_USER="Admin@${FULLY_QUALIFIED_ORG_NAME}"
-ORG_ADMIN_PASS="Admin@${FULLY_QUALIFIED_ORG_NAME}-pw"
-
-ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
-
-ROOT_TLS_CERT="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
-
-CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
-ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
-
-## Enroll CA administrator for Org. This user will be used to create other identities
-fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT_PEER}"
-
-## Get the CA cert and store in Org MSP folder
-fabric-ca-client getcacert -d -u https://${CA} --tls.certfiles ${ROOT_TLS_CERT} -M ${ORG_CYPTO_FOLDER}/msp
-
-if [ "{{ proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
-fi
-mkdir ${ORG_CYPTO_FOLDER}/msp/tlscacerts
-cp ${ORG_CYPTO_FOLDER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/msp/tlscacerts
-
-## Register and enroll admin for Org and populate admincerts for MSP
-fabric-ca-client register -d --id.name ${ORG_ADMIN_USER} --id.secret ${ORG_ADMIN_PASS} --id.type admin --csr.names "${SUBJECT_PEER}" --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.AffiliationMgr=true,hf.GenCRL=true,admin=true:ecert,abac.init=true:ecert" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
-
-fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT_PEER}"
-
-mkdir -p ${ORG_CYPTO_FOLDER}/msp/admincerts
-cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
-
-mkdir ${ORG_HOME}/admin/msp/admincerts
-cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_HOME}/admin/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
-
-mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
-cp -R ${ORG_HOME}/admin/msp ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
-
-if [ "{{ proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
-fi
-
-# Get TLS cert for admin and copy to appropriate location
-fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
-# Copy the TLS key and cert to the appropriate place
-mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls
-cp ${ORG_HOME}/admin/tls/keystore/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.key
-cp ${ORG_HOME}/admin/tls/signcerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.crt
-cp ${ORG_HOME}/admin/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/ca.crt
-
-cd ${CURRENT_DIR}
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/orderer_script.tpl b/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/orderer_script.tpl
deleted file mode 100644
index 90be7a7afed..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/orderer_script.tpl
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-
-set -x
-
-CURRENT_DIR=${PWD}
-FULLY_QUALIFIED_ORG_NAME="{{ component_ns }}"
-EXTERNAL_URL_SUFFIX="{{ item.external_url_suffix }}"
-ALTERNATIVE_ORG_NAMES=("{{ item.external_url_suffix }}")
-ORG_NAME="{{ component_name }}"
-SUBJECT="C={{ component_country }},ST={{ component_state }},L={{ component_location }},O={{ component_name }}"
-SUBJECT_PEER="{{ component_subject }}"
-CA="{{ ca_url }}"
-CA_ADMIN_USER="${ORG_NAME}-admin"
-CA_ADMIN_PASS="${ORG_NAME}-adminpw"
-
-ORG_ADMIN_USER="Admin@${FULLY_QUALIFIED_ORG_NAME}"
-ORG_ADMIN_PASS="Admin@${FULLY_QUALIFIED_ORG_NAME}-pw"
-
-ORG_CYPTO_FOLDER="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
-
-ROOT_TLS_CERT="/crypto-config/ordererOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
-
-CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
-ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
-
-## Register and enroll node and populate its MSP folder
-PEER="{{ peer_name }}.${FULLY_QUALIFIED_ORG_NAME}"
-CSR_HOSTS=${PEER}
-for i in "${ALTERNATIVE_ORG_NAMES[@]}"
-do
- CSR_HOSTS="${CSR_HOSTS},{{ peer_name }}.${i}"
-done
-echo "Registering and enrolling $PEER with csr hosts ${CSR_HOSTS}"
-
-
-# Register the peer
-fabric-ca-client register -d --id.name ${PEER} --id.secret ${PEER}-pw --id.type orderer --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
-
-# Enroll to get peers TLS cert
-fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/orderers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
-# Copy the TLS key and cert to the appropriate place
-mkdir -p ${ORG_CYPTO_FOLDER}/orderers/${PEER}/tls
-cp ${ORG_HOME}/cas/orderers/tls/keystore/* ${ORG_CYPTO_FOLDER}/orderers/${PEER}/tls/server.key
-cp ${ORG_HOME}/cas/orderers/tls/signcerts/* ${ORG_CYPTO_FOLDER}/orderers/${PEER}/tls/server.crt
-cp ${ORG_HOME}/cas/orderers/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/orderers/${PEER}/tls/ca.crt
-
-rm -rf ${ORG_HOME}/cas/orderers/tls
-
-# Enroll again to get the peer's enrollment certificate (default profile)
-fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
-
-# Create the TLS CA directories of the MSP folder if they don't exist.
-mkdir ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/tlscacerts
-
-if [ "{{ proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
-fi
-cp ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/tlscacerts
-
-# Copy the peer org's admin cert into target MSP directory
-mkdir -p ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/admincerts
-
-cp ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem ${ORG_CYPTO_FOLDER}/orderers/${PEER}/msp/admincerts
-
-cd ${CURRENT_DIR}
\ No newline at end of file
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/organisation_script.tpl b/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/organisation_script.tpl
deleted file mode 100644
index 1d7d0ecd89b..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/crypto_script/templates/organisation_script.tpl
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/bin/bash
-
-set -x
-
-CURRENT_DIR=${PWD}
-FULLY_QUALIFIED_ORG_NAME="{{ component_ns }}"
-ALTERNATIVE_ORG_NAMES=("{{ component_ns }}.svc.cluster.local" "{{ component_name }}.net" "{{ component_ns }}.{{ item.external_url_suffix }}")
-ORG_NAME="{{ component_name }}"
-EXTERNAL_URL_SUFFIX="{{ item.external_url_suffix }}"
-AFFILIATION="{{ component_name }}"
-SUBJECT="C={{ component_country }},ST={{ component_state }},L={{ component_location }},O={{ component_name }}"
-SUBJECT_PEER="{{ component_subject }}"
-CA="{{ ca_url }}"
-CA_ADMIN_USER="${ORG_NAME}-admin"
-CA_ADMIN_PASS="${ORG_NAME}-adminpw"
-
-ORG_ADMIN_USER="Admin@${FULLY_QUALIFIED_ORG_NAME}"
-ORG_ADMIN_PASS="Admin@${FULLY_QUALIFIED_ORG_NAME}-pw"
-
-ORG_CYPTO_FOLDER="/crypto-config/peerOrganizations/${FULLY_QUALIFIED_ORG_NAME}"
-
-ROOT_TLS_CERT="/crypto-config/peerOrganizations/${FULLY_QUALIFIED_ORG_NAME}/ca/ca.${FULLY_QUALIFIED_ORG_NAME}-cert.pem"
-
-CAS_FOLDER="${HOME}/ca-tools/cas/ca-${ORG_NAME}"
-ORG_HOME="${HOME}/ca-tools/${ORG_NAME}"
-
-NO_OF_PEERS={{ peer_count | e }}
-
-## Enroll CA administrator for Org. This user will be used to create other identities
-fabric-ca-client enroll -d -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER} --csr.names "${SUBJECT_PEER}"
-
-## Get the CA cert and store in Org MSP folder
-fabric-ca-client getcacert -d -u https://${CA} --tls.certfiles ${ROOT_TLS_CERT} -M ${ORG_CYPTO_FOLDER}/msp
-
-if [ "{{ proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
-fi
-mkdir ${ORG_CYPTO_FOLDER}/msp/tlscacerts
-cp ${ORG_CYPTO_FOLDER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/msp/tlscacerts
-
-# Add affiliation for organisation
-fabric-ca-client affiliation add ${AFFILIATION} -u https://${CA_ADMIN_USER}:${CA_ADMIN_PASS}@${CA} --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
-## Register and enroll admin for Org and populate admincerts for MSP
-fabric-ca-client register -d --id.name ${ORG_ADMIN_USER} --id.secret ${ORG_ADMIN_PASS} --id.type admin --csr.names "${SUBJECT_PEER}" --id.affiliation ${AFFILIATION} --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.AffiliationMgr=true,hf.GenCRL=true,admin=true:ecert,abac.init=true:ecert" --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
-
-fabric-ca-client enroll -d -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} --id.affiliation ${AFFILIATION} --tls.certfiles ${ROOT_TLS_CERT} --home ${ORG_HOME}/admin --csr.names "${SUBJECT_PEER}"
-
-mkdir -p ${ORG_CYPTO_FOLDER}/msp/admincerts
-cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
-
-mkdir ${ORG_HOME}/admin/msp/admincerts
-cp ${ORG_HOME}/admin/msp/signcerts/* ${ORG_HOME}/admin/msp/admincerts/${ORG_ADMIN_USER}-cert.pem
-
-mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
-cp -R ${ORG_HOME}/admin/msp ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}
-
-if [ "{{ proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
-fi
-
-# Get TLS cert for admin and copy to appropriate location
-fabric-ca-client enroll -d --enrollment.profile tls -u https://${ORG_ADMIN_USER}:${ORG_ADMIN_PASS}@${CA} -M ${ORG_HOME}/admin/tls --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
-# Copy the TLS key and cert to the appropriate place
-mkdir -p ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls
-cp ${ORG_HOME}/admin/tls/keystore/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.key
-cp ${ORG_HOME}/admin/tls/signcerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/client.crt
-cp ${ORG_HOME}/admin/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/users/${ORG_ADMIN_USER}/tls/ca.crt
-
-## Register and enroll peers and populate their MSP folder
-COUNTER=0
-while [ ${COUNTER} -lt ${NO_OF_PEERS} ]; do
- PEER="peer${COUNTER}.${FULLY_QUALIFIED_ORG_NAME}"
- CSR_HOSTS=${PEER}
- for i in "${ALTERNATIVE_ORG_NAMES[@]}"
- do
- CSR_HOSTS="${CSR_HOSTS},peer${COUNTER}.${i}"
- done
- echo "Registering and enrolling $PEER with csr hosts ${CSR_HOSTS}"
-
- # Register the peer
- fabric-ca-client register -d --id.name ${PEER} --id.secret ${PEER}-pw --id.type peer --tls.certfiles ${ROOT_TLS_CERT} --home ${CAS_FOLDER}
-
- # Enroll to get peers TLS cert
- fabric-ca-client enroll -d --enrollment.profile tls -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_HOME}/cas/peers/tls --csr.hosts "${CSR_HOSTS}" --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
- # Copy the TLS key and cert to the appropriate place
- mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls
- cp ${ORG_HOME}/cas/peers/tls/keystore/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/server.key
- cp ${ORG_HOME}/cas/peers/tls/signcerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/server.crt
- cp ${ORG_HOME}/cas/peers/tls/tlscacerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/tls/ca.crt
-
- rm -rf ${ORG_HOME}/cas/peers/tls
-
- # Enroll again to get the peer's enrollment certificate (default profile)
- fabric-ca-client enroll -d -u https://${PEER}:${PEER}-pw@${CA} -M ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp --tls.certfiles ${ROOT_TLS_CERT} --csr.names "${SUBJECT_PEER}"
-
- # Create the TLS CA directories of the MSP folder if they don't exist.
- mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
-
- # Copy the peer org's admin cert into target MSP directory
- mkdir -p ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
- if [ "{{ proxy }}" != "none" ]; then
- mv ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/*.pem ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/ca-${FULLY_QUALIFIED_ORG_NAME}-${EXTERNAL_URL_SUFFIX}.pem
- fi
- cp ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/cacerts/* ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/tlscacerts
- cp ${ORG_CYPTO_FOLDER}/msp/admincerts/${ORG_ADMIN_USER}-cert.pem ${ORG_CYPTO_FOLDER}/peers/${PEER}/msp/admincerts
-
- let COUNTER=COUNTER+1
-done
-
-cd ${CURRENT_DIR}
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_certificates.yaml b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_certificates.yaml
new file mode 100644
index 00000000000..37468b01d95
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_certificates.yaml
@@ -0,0 +1,24 @@
+# Fetch peer msp config
+- name: Fetch peer msp config
+ include_tasks: get_peer_msp_config.yaml
+ vars:
+ peer_name: "{{ peer.name }}"
+ loop: "{{ peers }}"
+ loop_control:
+ loop_var: peer
+
+# Get admin msp certificates from secret
+- name: Get admin msp certificates from secret
+ kubernetes.core.k8s_info:
+ kubeconfig: "{{ org.k8s.config_file }}"
+ kind: Secret
+ name: "admin-msp"
+ namespace: "{{ org_name }}-net"
+ register: msp_cert_data
+
+- name: Save admin-msp cert locally for genesis
+ copy:
+ content: "{{ msp_cert_data.resources[0] | to_nice_json }}"
+ dest: "{{ files_loc }}/{{ org_name }}.json"
+ vars:
+ files_loc: "{{ playbook_dir }}/../../../{{ charts_dir }}/fabric-genesis/files"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_channel.yaml b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_channel.yaml
new file mode 100644
index 00000000000..8047ee8bf28
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_channel.yaml
@@ -0,0 +1,13 @@
+# Set Variable channel_name_value
+- name: Set Variable channel_name_value
+ include_tasks: valuefile.yaml
+ loop: "{{ channel.orderers }}"
+ loop_control:
+ loop_var: ord_org
+ when:
+ - ord_org == org.name and ('2.2.' in network.version or '1.4.' in network.version)
+
+# Set Variable channel_name_value
+- name: Set Variable channel_name_value
+ include_tasks: valuefile.yaml
+ when: channel.osn_creator_org.name == org.name and '2.5.' in network.version
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_channel_creator.yaml b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_channel_creator.yaml
new file mode 100644
index 00000000000..8047ee8bf28
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_channel_creator.yaml
@@ -0,0 +1,13 @@
+# Set Variable channel_name_value
+- name: Set Variable channel_name_value
+ include_tasks: valuefile.yaml
+ loop: "{{ channel.orderers }}"
+ loop_control:
+ loop_var: ord_org
+ when:
+ - ord_org == org.name and ('2.2.' in network.version or '1.4.' in network.version)
+
+# Set Variable channel_name_value
+- name: Set Variable channel_name_value
+ include_tasks: valuefile.yaml
+ when: channel.osn_creator_org.name == org.name and '2.5.' in network.version
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_peer_msp_config.yaml b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_peer_msp_config.yaml
new file mode 100644
index 00000000000..89d2af742e6
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/get_peer_msp_config.yaml
@@ -0,0 +1,35 @@
+# Get config file from configmap
+- name: Get config file from config map
+ kubernetes.core.k8s_info:
+ kubeconfig: "{{ org.k8s.config_file }}"
+ kind: ConfigMap
+ name: "{{ peer_name }}-msp-config"
+ namespace: "{{ org_name }}-net"
+ register: config_file_data
+
+# Create the certs directory if it does not exist
+- name: Create the certs directory if it does not exist
+ file:
+ path: "{{ playbook_dir }}/../../../{{ charts_dir }}/fabric-genesis/files"
+ state: directory
+
+# Find old .json files
+- name: Find .json files
+ find:
+ paths: "{{ playbook_dir }}/../../../{{ charts_dir }}/fabric-genesis/files"
+ patterns: "*.json"
+ register: json_files
+
+# Delete old .json files
+- name: Delete .json files
+ file:
+ path: "{{ item.path }}"
+ state: absent
+ loop: "{{ json_files.files }}"
+
+- name: Save config peer msp config locally for genesis
+ copy:
+ content: "{{ config_file_data.resources[0] | to_nice_json }}"
+ dest: "{{ files_loc }}/{{ org_name }}-config-file.json"
+ vars:
+ files_loc: "{{ playbook_dir }}/../../../{{ charts_dir }}/fabric-genesis/files"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/main.yaml
index 32b19b74838..12349da003f 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/main.yaml
@@ -5,40 +5,45 @@
##############################################################################################
############################################################################################
-# Create the channel-artifacts folder
-- name: "Creating channel-artifacts folder"
- file:
- path: "{{ build_path }}/channel-artifacts"
- state: directory
-# Remove old genesis block
-- name: Remove old genesis block
- file:
- path: "{{ build_path }}/channel-artifacts/{{ channel_name }}.genesis.block"
- state: absent
-# Create the genesis block by consuming the configtx.yaml file
-- name: "Create genesis block"
- shell: |
- cd {{ build_path }}
- {% if '2.5' in network.version %}
- ./configtxgen -profile {{ genesis.name }} -channelID {{ channel_name }} -outputBlock ./channel-artifacts/{{ channel_name }}.genesis.block
- {% elif '2.2' in network.version %}
- ./configtxgen -profile {{ genesis.name }} -channelID syschannel -outputBlock ./channel-artifacts/{{ channel_name }}.genesis.block
- {% else %}
- ./configtxgen -profile {{ genesis.name }} -channelID syschannel -outputBlock ./channel-artifacts/{{ channel_name }}.genesis.block
- {% endif %}
- cat ./channel-artifacts/{{ channel_name }}.genesis.block | base64 > ./channel-artifacts/{{ channel_name }}.genesis.block.base64
- when: add_new_org == 'false'
+# Remove all Helm releases of organization except genesis
+- name: Delete Helm releases
+ kubernetes.core.helm:
+ kubeconfig: "{{ kubernetes.config_file }}"
+ name: "genesis"
+ release_namespace: "{{ org.name | lower }}-net"
+ state: absent
+ when: genererate_configtx is defined and genererate_configtx == 'true'
-# Write genesis block to Vault
-- name: "Write genesis block to Vault"
- shell: |
- vault kv put {{ org.vault.secret_path | default('secretsv2') }}/{{ org.name | lower }}/ordererOrganizations/{{ org.name }}-net/{{ channel_name }} {{ network.env.type }}GenesisBlock=@{{build_path}}/channel-artifacts/{{ channel_name }}.genesis.block.base64
- environment:
- VAULT_ADDR: "{{ org.vault.url }}"
- VAULT_TOKEN: "{{ org.vault.root_token }}"
+# Fetch peers cetificates
+- name: Fetch peers cetificates
+ include_tasks: get_certificates.yaml
+ vars:
+ charts_dir: "{{ organization.gitops.chart_source }}"
+ org_name: "{{ organization.name | lower }}"
+ peers: "{{ organization.services.peers }}"
loop: "{{ network['organizations'] }}"
loop_control:
- loop_var: org
- when: add_new_org == 'false' and org.type == "orderer"
+ loop_var: organization
+ when:
+ - organization.services.peers is defined and organization.services.peers | length > 0
+ - organization.name != org.name
+
+# Get channel_name
+- name: Get channel_name
+ include_tasks: get_channel_creator.yaml
+ vars:
+ channel_orgs: "{{ channel.orderers}}"
+ loop: "{{ network['channels'] }}"
+ loop_control:
+ loop_var: channel
+
+# Check or wait for the join channel job to complete
+- name: "waiting for genesis"
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component"
+ vars:
+ component_type: "Job"
+ namespace: "{{ org.name | lower }}-net"
+ component_name: "genesis"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/valuefile.yaml b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/valuefile.yaml
new file mode 100644
index 00000000000..5c0cf4c9380
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/create/genesis/tasks/valuefile.yaml
@@ -0,0 +1,24 @@
+# Create Value files for Genesis
+- name: Create Value files for Genesis
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/create/job_component"
+ vars:
+ name: "{{ org.name | lower }}"
+ component_ns: "{{ org.name | lower }}-net"
+ component_name: "genesis"
+ consensus: "{{ network.consensus }}"
+ type: "fabric_genesis"
+ kubernetes: "{{ org.k8s }}"
+ vault: "{{ org.vault }}"
+ charts_dir: "{{ org.gitops.chart_source }}"
+ values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
+ generateGenisisBLock: "{{ generateGenisis }}"
+
+# Git Push: Push the above generated files to git directory
+- name: Git Push
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
+ vars:
+ GIT_DIR: "{{ playbook_dir }}/../../../"
+ gitops: "{{ org.gitops }}"
+ msg: "[ci skip] Pushing Genesis files"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/k8s_secrets/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/k8s_secrets/tasks/main.yaml
deleted file mode 100644
index 6d843717a6c..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/create/k8s_secrets/tasks/main.yaml
+++ /dev/null
@@ -1,106 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-#############################################################################################
-# This role creates the secrets and docker credentials
-#############################################################################################
-
-# Check if root token secret exist of every organization in their namespace
-- name: Check if root token exists in the namespace
- k8s_info:
- kind: Secret
- namespace: "{{ namespace }}"
- name: "roottoken"
- kubeconfig: "{{ kubernetes.config_file }}"
- context: "{{ kubernetes.context }}"
- register: root_token_secret
- when: check == "token_secret"
-
-# Put root token of every organization in their namespace
-- name: Put root token of every organization
- k8s:
- definition:
- apiVersion: v1
- kind: Secret
- metadata:
- name: "roottoken"
- namespace: "{{ namespace }}"
- stringData:
- config.yaml: |-
- token: "{{ vault.root_token }}"
- state: present
- kubeconfig: "{{ kubernetes.config_file }}"
- context: "{{ kubernetes.context }}"
- when: check == "token_secret" and root_token_secret.resources|length == 0
-
-# Check if Docker credentials exist already
-- name: "Checking if the docker credentials already exists"
- include_role:
- name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
- vars:
- check: "docker_credentials"
- register: get_regcred
- when: check == "docker_credentials"
-
-# Set a variable
-- set_fact:
- auth: "{{network.docker.username}}:{{network.docker.password}}"
- when: check == "docker_credentials" and get_regcred.resources|length == 0
-
-# Set a variable
-- set_fact:
- auth_64: "{{auth | b64encode}}"
- when: check == "docker_credentials" and get_regcred.resources|length == 0
-
-# Set a variable
-- set_fact:
- dockerconfigjson: "{\"auths\":{\"{{network.docker.url}}\":{\"username\":\"{{network.docker.username}}\",\"password\":\"{{network.docker.password}}\",\"email\":\"test@abc.mail\",\"auth\":\"{{auth_64}}\"}}}"
- when: check == "docker_credentials" and get_regcred.resources|length == 0
-
-# Create the docker pull credentials for image registry
-- name: Create the docker pull credentials
- k8s:
- definition:
- apiVersion: v1
- kind: Secret
- metadata:
- name: "regcred"
- namespace: "{{ namespace }}"
- type: kubernetes.io/dockerconfigjson
- data:
- .dockerconfigjson: "{{ dockerconfigjson | to_json | b64encode }}"
- state: present
- kubeconfig: "{{ kubernetes.config_file }}"
- context: "{{ kubernetes.context }}"
- when: check == "docker_credentials" and get_regcred.resources|length == 0
-
-# Check if endorser certs secret exists in the namespace
-- name: Check if endorser certs secret exists in the namespace
- k8s_info:
- kind: Secret
- namespace: "{{ namespace }}"
- name: "{{ org_name }}-endorser-cert"
- kubeconfig: "{{ kubernetes.config_file }}"
- context: "{{ kubernetes.context }}"
- register: endorser_certs_secret
- when: check == "endorser_certs"
-
-# Create endorser certs secret exists in the namespace
-- name: Create endorser certs secret exists in the namespace
- k8s:
- definition:
- apiVersion: v1
- kind: Secret
- metadata:
- name: "{{ org_name }}-endorser-cert"
- namespace: "{{ namespace }}"
- stringData:
- config.yaml: |-
- certificate: "{{ cert }}"
- state: present
- kubeconfig: "{{ kubernetes.config_file }}"
- context: "{{ kubernetes.context }}"
- when: check == "endorser_certs" and endorser_certs_secret.resources|length == 0
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/namespace/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/namespace/tasks/main.yaml
index aa8e6565909..3f4a15a6dfe 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/namespace/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/namespace/tasks/main.yaml
@@ -9,12 +9,12 @@
#############################################################################################
# Check if namespace created
-- name: "Checking if the namespace {{ item.name | lower }}-net already exists"
+- name: "Checking if the namespace {{ org.name | lower }}-net already exists"
include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/check/k8_component"
vars:
component_type: "Namespace"
- component_name: "{{ item.name | lower }}-net"
+ component_name: "{{ org.name | lower }}-net"
type: "no_retry"
register: get_namespace
tags:
@@ -39,7 +39,7 @@
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
vars:
GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ item.gitops }}"
+ gitops: "{{ org.gitops }}"
msg: "[ci skip] Pushing deployment files for namespace, service accounts and clusterrolebinding"
tags:
- notest
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/appchannel/templates/update_channel_script.tpl b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/appchannel/templates/update_channel_script.tpl
index 1fe4b633293..db28cfd371b 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/appchannel/templates/update_channel_script.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/appchannel/templates/update_channel_script.tpl
@@ -3,9 +3,19 @@
set -x
CURRENT_DIR=${PWD}
+NETWORK_VERSION="{{ version }}"
-echo "installing jq "
-apt-get install -y jq
+if [ "$NETWORK_VERSION" != "2.5.4" ]; then
+ echo "installing jq "
+ . /scripts/package-manager.sh
+ packages_to_install="jq"
+ install_packages "$packages_to_install"
+else
+ echo "installing jq and wget"
+ . /scripts/package-manager.sh
+ packages_to_install="jq wget"
+ install_packages "$packages_to_install"
+fi
echo "installing configtxlator"
mkdir temp
cd temp/
@@ -17,11 +27,16 @@ rm -r temp
configtxlator proto_decode --input {{ channel_name }}_config_block.pb --type common.Block | jq .data.data[0].payload.data.config > {{ channel_name }}_config_block.json
-jq -s '.[0] * {"channel_group":{"groups":{"Orderer":{"groups": {"{{ component_name }}MSP":.[1]}}}}}' {{ channel_name }}_config_block.json ./config.json > config1.json
-jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"{{ component_name }}MSP":.[1]}}}}}' config1.json ./config.json > config2.json
-cat config2.json | jq '.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters += ['$(cat ./orderer-tls)']' > config3.json
-cat config3.json | jq '.channel_group.values.OrdererAddresses.value.addresses += ['$(cat ./orderer)'] ' > {{ channel_name }}_modified_config.json
-
+if [ "$NETWORK_VERSION" != "2.5.4" ]; then
+ jq -s '.[0] * {"channel_group":{"groups":{"Orderer":{"groups": {"{{ component_name }}MSP":.[1]}}}}}' {{ channel_name }}_config_block.json ./config.json > config1.json
+ jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"{{ component_name }}MSP":.[1]}}}}}' config1.json ./config.json > config2.json
+ cat config2.json | jq '.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters += ['$(cat ./orderer-tls)']' > config3.json
+ cat config3.json | jq '.channel_group.values.OrdererAddresses.value.addresses += ['$(cat ./orderer)'] ' > {{ channel_name }}_modified_config.json
+else
+ jq -s '.[0] * {"channel_group":{"groups":{"Orderer":{"groups": {"{{ component_name }}MSP":.[1]}}}}}' {{ channel_name }}_config_block.json ./config.json > config1.json
+ cat config1.json | jq '.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters += ['$(cat ./orderer-tls)']' > config2.json
+ cat config2.json | jq '.channel_group.values.OrdererAddresses.value.addresses += ['$(cat ./orderer)'] ' > {{ channel_name }}_modified_config.json
+fi
echo "converting the channel_config.json and channel_modified_config.json to .pb files"
configtxlator proto_encode --input {{ channel_name }}_config_block.json --type common.Config --output {{ channel_name }}_config.pb
configtxlator proto_encode --input {{ channel_name }}_modified_config.json --type common.Config --output {{ channel_name }}_modified_config.pb
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/create_orderer.yaml b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/create_orderer.yaml
index 7fc1adb6ac7..011f7bac5e5 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/create_orderer.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/create_orderer.yaml
@@ -77,6 +77,7 @@
kubernetes: "{{ org.k8s }}"
ordererAddress: "{{ orderer.ordererAddress }}"
when: network.env.proxy != 'none'
+
- name: fetch, modify, sign and copy the configuration block from the blockchain for proxy none
shell: |
export PEER_CLI=$(KUBECONFIG={{ org.k8s.config_file }} kubectl get po -n {{ component_ns }} | grep "cli" | head -n 1 | awk '{print $1}')
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/main.yaml
index 5f148a453b4..cc4713e8f49 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/main.yaml
@@ -5,7 +5,7 @@
##############################################################################################
############################################################################################
-## Adding the New Orderer to the json file that will be used inside the orderer cli
+# Adding the New Orderer to the json file that will be used inside the orderer cli
- name: "Creating JSON configuration for new organization"
shell: |
cd {{ build_path }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/nested_main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/nested_main.yaml
index c8ec09595a7..0d13c92bc41 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/nested_main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/tasks/nested_main.yaml
@@ -45,7 +45,7 @@
then
echo -n "{\"client_tls_cert\":\"$(cat {{ build_path }}/crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name }}.{{ component_ns }}/tls/server.crt | base64 -w 0)\",\"host\":\"{{ orderer.name }}.{{ component_ns }}\",\"port\":{{ orderer.grpc.port }},\"server_tls_cert\":\"$(cat {{ build_path }}/crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name }}.{{ component_ns }}/tls/server.crt | base64 -w 0)\"}" >> {{ build_path }}/channel-artifacts/{{ channel_name }}-consenter
else
- echo -n "{\"client_tls_cert\":\"$(cat {{ build_path }}/crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name|lower }}.{{ component_ns }}/tls/server.crt | base64 -w 0)\",\"host\":\"{{ orderer.ordererAddress.split(":")[0] | to_json }}\",\"port\":\"{{ orderer.ordererAddress.split(":")[1] | to_json }}\",\"server_tls_cert\":\"$(cat {{ build_path }}/crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name|lower }}.{{ component_ns }}/tls/server.crt | base64 -w 0)\"}" >> {{ build_path }}/channel-artifacts/{{ channel_name | lower}}-orderer-tls
+ echo -n "{\"client_tls_cert\":\"$(cat {{ build_path }}/crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name|lower }}.{{ component_ns }}/tls/server.crt | base64 -w 0)\",\"host\":\"{{ orderer.ordererAddress.split(":")[0] | to_json }}\",\"port\":{{ orderer.ordererAddress.split(":")[1] | to_json }},\"server_tls_cert\":\"$(cat {{ build_path }}/crypto-config/ordererOrganizations/{{ component_ns }}/orderers/{{ orderer.name|lower }}.{{ component_ns }}/tls/server.crt | base64 -w 0)\"}" >> {{ build_path }}/channel-artifacts/{{ channel_name }}-consenter
fi
when: update_type == "tls"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/orderer_org.tpl b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/orderer_org.tpl
index f2ee66a9191..7b7c2bdbee3 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/orderer_org.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/orderer_org.tpl
@@ -5,7 +5,10 @@ set -x
CURRENT_DIR=${PWD}
echo "installing jq "
-apt-get install -y jq
+. /scripts/package-manager.sh
+packages_to_install="jq"
+install_packages "$packages_to_install"
+
echo "installing configtxlator"
mkdir temp
cd temp/
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/syschannel_update_address_script.tpl b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/syschannel_update_address_script.tpl
index 19f504e1620..d0ca0c456e1 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/syschannel_update_address_script.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/orderer_org/syschannel/templates/syschannel_update_address_script.tpl
@@ -5,7 +5,10 @@ set -x
CURRENT_DIR=${PWD}
echo "installing jq "
-apt-get install -y jq
+. /scripts/package-manager.sh
+packages_to_install="jq"
+install_packages "$packages_to_install"
+
echo "installing configtxlator"
mkdir temp
cd temp/
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/orderers/tasks/get_channel.yaml b/platforms/hyperledger-fabric/configuration/roles/create/orderers/tasks/get_channel.yaml
new file mode 100644
index 00000000000..e0de6087d02
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/create/orderers/tasks/get_channel.yaml
@@ -0,0 +1,8 @@
+# Set Variable channel_name_value
+- name: Set Variable channel_name_value
+ set_fact:
+ channel_name_value: "{{ channel.channel_name | lower }}"
+ loop: "{{ channel.orderers }}"
+ loop_control:
+ loop_var: ord_org
+ when: ord_org == org.name
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/orderers/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/orderers/tasks/main.yaml
index ed1c13d4e7b..ffd9e9455ed 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/orderers/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/orderers/tasks/main.yaml
@@ -8,24 +8,22 @@
# This role creates value file for zkKafka and orderer
#############################################################################################
+# Check if CA server is available
+- name: "waiting for the CA server to be created in {{ org.name | lower }}-net"
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component"
+ vars:
+ component_type: "Pod"
+ namespace: "{{ org.name | lower }}-net"
+ component_name: "{{ component_services.ca.name }}"
+ label_selectors:
+ - app = {{ component_name }}
+ when: add_peer is not defined or add_peer != 'true'
-
-# Set Variable channel_name
-- name: "Set Variable channel_name"
+# Set Variable first_orderer
+- name: "Set Variable first_orderer"
set_fact:
- channel_name: "{{ network['channels'] | map(attribute='channel_name') | first | lower }}"
- when: item.type == 'orderer' and ('2.2.' in network.version or '1.4.' in network.version or '2.5.' in network.version)
-
-# Fetch the genesis block from vault to the build directory
-- name: Fetch the genesis block from vault
- shell: |
- vault kv get -field={{ network.env.type }}GenesisBlock {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ item.name | lower }}-net > {{ channel_name }}.genesis.block.base64
- mkdir -p ./build/channel-artifacts
- mv {{ channel_name}}.genesis.block.base64 ./build/channel-artifacts/
- environment:
- VAULT_ADDR: "{{ vault.url }}"
- VAULT_TOKEN: "{{ vault.root_token }}"
- when: refresh_cert is defined and refresh_cert == 'true'
+ first_orderer: "{{ component_services.orderers | map(attribute='name') | first }}"
# Reset peers pods
- name: "Reset peers pods"
@@ -33,12 +31,12 @@
name: create/refresh_certs/reset_pod
vars:
pod_name: "{{ orderer.name | lower }}"
- name: "{{ item.name | lower }}"
- file_path: "{{ values_dir }}/orderer/{{ orderer.name | lower }}-{{ item.name | lower }}.yaml"
- gitops_value: "{{ item.gitops }}"
+ name: "{{ org.name | lower }}"
+ file_path: "{{ values_dir }}/orderer/{{ orderer.name | lower }}-{{ org.name | lower }}.yaml"
+ gitops_value: "{{ org.gitops }}"
component_ns: "{{ namespace }}"
- kubernetes: "{{ item.k8s }}"
- hr_name: "{{ item.name | lower }}-{{ orderer.name }}"
+ kubernetes: "{{ org.k8s }}"
+ hr_name: "{{ org.name | lower }}-{{ orderer.name }}"
loop: "{{ component_services.orderers }}"
loop_control:
loop_var: orderer
@@ -50,7 +48,7 @@
name: helm_component
vars:
name: "orderer"
- org_name: "{{ item.name | lower }}"
+ org_name: "{{ org.name | lower }}"
sc_name: "{{ org_name }}-bevel-storageclass"
component_name: "zkkafka"
type: "zkkafka"
@@ -63,36 +61,18 @@
name: helm_component
vars:
name: "orderer"
- org_name: "{{ item.name | lower }}"
- sc_name: "{{ org_name }}-bevel-storageclass"
- component_name: "{{ orderer.name }}-{{ org_name }}"
- type: "orderers"
- consensus: "{{component_services.consensus}}"
- genesis: "{{ lookup('file', '{{ build_path }}/channel-artifacts/{{ channel_name}}.genesis.block.base64') }}"
- loop: "{{ component_services.orderers }}"
- loop_control:
- loop_var: orderer
- when:
- - component_services.orderers is defined and component_services.consensus is defined
- - (orderer.status is not defined or orderer.status == 'new') and '2.5.' not in network.version
-
-# Create the value file for the Orderers as per requirements mentioned in network.yaml
-- name: "create orderers"
- include_role:
- name: helm_component
- vars:
- name: "orderer"
- org_name: "{{ item.name | lower }}"
- sc_name: "{{ org_name }}-bevel-storageclass"
- component_name: "{{ orderer.name }}-{{ org_name }}"
+ org_name: "{{ org.name | lower }}"
+ component_name: "{{ orderer.name | lower }}"
type: "orderers"
consensus: "{{component_services.consensus}}"
+ component_subject: "{{ org.subject | quote }}"
+ create_configmaps: "{{ true if first_orderer == orderer.name else false }}"
loop: "{{ component_services.orderers }}"
loop_control:
loop_var: orderer
when:
- component_services.orderers is defined and component_services.consensus is defined
- - (orderer.status is not defined or orderer.status == 'new') and '2.5.' in network.version
+ - orderer.status is not defined or orderer.status == 'new'
# Git Push: Push the above generated files to git directory
- name: Git Push
@@ -100,7 +80,37 @@
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
vars:
GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ item.gitops }}"
+ gitops: "{{ org.gitops }}"
msg: "[ci skip] Pushing Orderer files"
tags:
- notest
+
+# Wait for key certs exists in vault.
+- name: Wait for CA key exists in vault
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
+ vars:
+ vault_field: "rootca_key"
+ vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/ca"
+ check: "crypto_materials"
+
+# Wait for admin tls exists in vault.
+- name: Wait for admin tls exists in vault.
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
+ vars:
+ vault_field: "client_key"
+ vault_path: "{{ vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/users/admin-tls"
+ check: "crypto_materials"
+
+# Wait for orderers tls exists in vault.
+- name: Wait for orderers tls exists in vault.
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/check/setup"
+ vars:
+ vault_field: "server_key"
+ vault_path: "{{ vault.secret_path | default('secretv2') }}/{{ network.env.type }}{{ org_name }}/orderers/{{ orderer.name }}-tls"
+ check: "crypto_materials"
+ loop: "{{ org.services.orderers }}"
+ loop_control:
+ loop_var: orderer
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/main.yaml
index 714f89a8a2b..6c9fde965c3 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/main.yaml
@@ -17,7 +17,8 @@
vars:
org_creator_channels: "{{ item.osn_creator_org.name }}"
channel_name: "{{ item.channel_name | lower }}"
+ kubernetes: "{{ org.k8s }}"
loop: "{{ network['organizations'] }}"
loop_control:
loop_var: org
- when: org.type == 'orderer' and org_creator_channels == org.name
+ when: (org.services.orderers is defined and org.services.orderers | length > 0) and org_creator_channels == org.name
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/valuefile.yaml b/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/valuefile.yaml
index d146f724195..3f51ae92dc3 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/valuefile.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/osnchannels/tasks/valuefile.yaml
@@ -33,7 +33,7 @@
# Create the value file for creator Organization
- name: "Create Create_Channel value file osnadmin"
include_role:
- name: helm_component
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/create/job_component"
vars:
name: "{{ org.name | lower }}"
type: "osn_create_channel_job"
@@ -46,7 +46,6 @@
vault: "{{ org.vault }}"
k8s: "{{ org.k8s }}"
orderers_list: "{{ org.services.orderers }}"
- genesis: "{{ lookup('file', '{{ build_path }}/channel-artifacts/{{ channel_name }}.genesis.block.base64') }}"
values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
add_orderer_value: "{{ add_orderer | default('false') }}"
when: add_orderer is not defined or add_orderer == false
@@ -54,7 +53,7 @@
# Create the value file for creator Organization
- name: "Create Create_Channel value file osnadmin"
include_role:
- name: helm_component
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/create/job_component"
vars:
name: "{{ org.name | lower }}"
type: "osn_create_channel_job"
@@ -82,6 +81,7 @@
gitops: "{{ org.gitops }}"
msg: "[ci skip] Pushing channel-create files"
+
# Check or wait for the create channel job to complete
- name: "waiting for {{ org.name }} to create channel {{ channel_name }}"
include_role:
@@ -89,5 +89,5 @@
vars:
component_type: "Job"
namespace: "{{ org.name | lower}}-net"
- component_name: "osn-createchannel-{{ channel_name }}"
+ component_name: "{{ channel_name }}"
kubernetes: "{{ org.k8s }}"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/main.yaml
index 70916bc512e..9cafa57600a 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/main.yaml
@@ -22,17 +22,22 @@
name: create/refresh_certs/reset_pod
vars:
pod_name: "{{ peer.name | lower }}"
- name: "{{ item.name | lower }}"
+ name: "{{ org.name | lower }}"
file_path: "{{ values_dir }}/{{ name }}/values-{{ peer.name }}.yaml"
- gitops_value: "{{ item.gitops }}"
+ gitops_value: "{{ org.gitops }}"
component_ns: "{{ namespace }}"
- kubernetes: "{{ item.k8s }}"
- hr_name: "{{ item.name | lower }}-{{ peer.name }}"
+ kubernetes: "{{ org.k8s }}"
+ hr_name: "{{ org.name | lower }}-{{ peer.name }}"
loop: "{{ component_services.peers }}"
loop_control:
loop_var: peer
when: (refresh_cert is defined and refresh_cert == 'true') or peer.configpath is defined
+# Set Variable first_orderer
+- name: "Set Variable first_peer"
+ set_fact:
+ first_peer: "{{ component_services.peers | map(attribute='name') | first }}"
+
# Create the value file for peers of organisations
- name: This role creates the value file for peers of organisations
include_tasks: nested_main.yaml
@@ -46,45 +51,21 @@
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
vars:
GIT_DIR: "{{ playbook_dir }}/../../../"
- gitops: "{{ item.gitops }}"
+ gitops: "{{ org.gitops }}"
msg: "[ci skip] Pushing Peer files"
- tags:
- - notest
-
-# Wait for the peer HelmRelease
-- name: 'Wait for {{ peer.name }} HelmRelease in {{ namespace }}'
- k8s_info:
- api_version: "helm.toolkit.fluxcd.io/v2beta1"
- kind: "HelmRelease"
- namespace: "{{ item.name | lower }}-net"
- kubeconfig: "{{ item.k8s.config_file }}"
- context: "{{ item.k8s.context }}"
- name: "{{ item.name | lower }}-{{ peer.name }}"
- field_selectors:
- - status.conditions=Ready
- register: component_data
- retries: "{{ network.env.retry_count}}"
- delay: 30
- until: component_data.resources|length > 0
- loop: "{{ component_services.peers }}"
- loop_control:
- loop_var: peer
- when: (refresh_cert is defined and refresh_cert == 'true') or peer.configpath is defined
# Wait for peer pods to be in the state of running
-- name: "Waiting for peer pod {{ peer.name }} in {{ item.name | lower }}-net"
+- name: "Waiting for peer pod {{ peer.name }} in {{ org.name | lower }}-net"
include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component"
vars:
component_type: "Pod"
- namespace: "{{ item.name | lower }}-net"
+ namespace: "{{ org.name | lower }}-net"
component_name: "{{ peer.name }}"
- kubernetes: "{{ item.k8s }}"
+ kubernetes: "{{ org.k8s }}"
label_selectors:
- app = {{ component_name }}
loop: "{{ component_services.peers }}"
loop_control:
loop_var: peer
when: peer.peerstatus is not defined or peer.peerstatus == 'new'
- tags:
- - notest
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/nested_main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/nested_main.yaml
index e72388ae9b8..daa8d3198dc 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/nested_main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/peers/tasks/nested_main.yaml
@@ -1,47 +1,83 @@
-# Remove existing value file for peer -- change to not use shell
+# Remove existing value file for peer
- name: Remove existing value file for {{ peer.name }}
shell: |
- rm -f {{ values_dir }}/{{ item.name | lower }}/values-{{ peer.name }}.yaml
+ rm -f {{ values_dir }}/{{ org.name | lower }}/values-{{ peer.name }}.yaml
when:
- add_peer is not defined or add_peer == 'false'
+# Create the certs directory if it does not exist
+- name: Create the certs directory if it does not exist
+ file:
+ path: "{{playbook_dir}}/../../../{{ charts_dir }}/fabric-peernode/files"
+ state: directory
+
# Fetch the custom core.yaml
- name: Fetch the custom core.yaml
shell: |
- cat {{ peer.configpath }} | base64 > {{ playbook_dir }}/build/{{ peer.name }}_{{ item.name | lower }}_core.yaml.base64
+ cat {{ peer.configpath }} > {{playbook_dir}}/../../../{{ charts_dir }}/fabric-peernode/conf/default_core.yaml
register: core_yaml_file
when:
- peer.configpath is defined
+# Get orderer tls cacert from configmap
+- name: check crypto scripts already exists
+ kubernetes.core.k8s_info:
+ kubeconfig: "{{ kubernetes.config_file }}"
+ kind: ConfigMap
+ name: "crypto-scripts-cm"
+ namespace: "{{ org.name | lower }}-net"
+ register: crypto_scripts_data
+
+# Get orderer tls cacert from configmap
+- name: Get orderer tls cacert from config map
+ kubernetes.core.k8s_info:
+ kubeconfig: "{{ kubernetes.config_file }}"
+ kind: ConfigMap
+ name: "orderer-tls-cacert"
+ namespace: "{{ org.orderer_org | lower }}-net"
+ register: tls_cert_data
+ when: org.orderer_org != org.name
+
+- name: Create new ConfigMap with tls_cert_data
+ kubernetes.core.k8s:
+ kubeconfig: "{{ kubernetes.config_file }}"
+ definition:
+ apiVersion: v1
+ kind: ConfigMap
+ metadata:
+ name: "orderer-tls-cacert"
+ namespace: "{{ org.name | lower }}-net"
+ data:
+ cacert: "{{ tls_cert_data.resources[0].data['cacert'] }}"
+ when: org.orderer_org != org.name
+
+# Set Variable sc_name
+- name: "Set Variable sc_name"
+ set_fact:
+ sc_name: "storage-{{ peer.name }}"
+
+- name: Get information about StorageClasses
+ kubernetes.core.k8s_info:
+ kind: StorageClass
+ api_version: storage.k8s.io/v1
+ namespace: default
+ register: storage_classes_info
+
# Create Value files for Organization Peers
- name: Create Value files for Organization Peers
include_role:
name: helm_component
vars:
- name: "{{ item.name | lower }}"
- sc_name: "{{ name }}-bevel-storageclass"
+ name: "{{ org.name | lower }}"
type: "value_peer"
- component_name: values-{{ peer.name }}
- peer_name: "{{ peer.name }}"
- peer_ns: "{{ namespace }}"
- provider: "{{ network.env.proxy }}"
+ component_name: "{{ peer.name }}"
+ component_subject: "{{ org.subject }}"
+ component_ns: "{{ namespace }}"
+ provider: "{{ org.cloud_provider }}"
+ orderer: "{{ network.orderers | first }}"
+ user_list: "{{ org.users | default('') }}"
+ enabled_cli: "{{ true if peer.cli == 'enabled' else false }}"
+ sc_enabled: "{{ false if storage_classes_info.resources | selectattr('metadata.name', 'equalto', sc_name) | list else true }}"
+ create_configmaps: "{{ true if (first_peer == peer.name) and (crypto_scripts_data.resources | length == 0) else false }}"
when:
- peer.peerstatus is not defined or peer.peerstatus == 'new'
- - peer.configpath is not defined
-
-# Create Value files for Organization Peers - external
-- name: Create Value files for Organization Peers - external
- include_role:
- name: helm_component
- vars:
- name: "{{ item.name | lower }}"
- sc_name: "{{ name }}-bevel-storageclass"
- type: "value_peer"
- component_name: values-{{ peer.name }}
- peer_name: "{{ peer.name }}"
- peer_ns: "{{ namespace }}"
- provider: "{{ network.env.proxy }}"
- core_file: "{{ lookup('file', '{{ playbook_dir }}/build/{{ peer.name }}_{{ item.name | lower }}_core.yaml.base64') }}"
- when:
- - peer.peerstatus is not defined or peer.peerstatus == 'new'
- - peer.configpath is defined
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/main.yaml
index 039b80cd55b..6261d71565e 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/main.yaml
@@ -19,7 +19,6 @@
channel_name: "{{ sys_channel_name }}"
orderer: "{{ org.services.orderers | first }}"
check: "latest_block"
- when: add_new_org == 'false' and ('2.2.' in network.version or '1.4.' in network.version)
# Call get_update_block to get the latest from appchannel channel block.
- name: Call get_update_block to get latest appchannel block
@@ -38,23 +37,10 @@
path: "{{ build_path }}/channel-artifacts"
state: directory
-# Create the genesis block by consuming the latest config block for 2.5.x fabric versions
-- name: "Create genesis block"
- shell: |
- cat {{ build_path }}/{{ channel.channel_name | lower }}_config_block.pb | base64 > {{ build_path }}/channel-artifacts/{{ channel.channel_name | lower }}.genesis.block.base64
- loop: "{{ network.channels }}"
- loop_control:
- loop_var: channel
- when: add_new_org == 'false' and ('2.5.' in network.version)
-
# Create the genesis block by consuming the latest config block
- name: "Create genesis block"
shell: |
- cat {{ build_path }}/{{ sys_channel_name | lower }}_config_block.pb | base64 > {{ build_path }}/channel-artifacts/{{ channel.channel_name | lower }}.genesis.block.base64
- loop: "{{ network.channels }}"
- loop_control:
- loop_var: channel
- when: add_new_org == 'false' and ('2.2.' in network.version or '1.4.' in network.version)
+ cat {{ build_path }}/{{ sys_channel_name }}_config_block.pb | base64 > {{ build_path }}/channel-artifacts/{{ channel.channel_name | lower }}.genesis.block.base64
# Add new genesis block to the vault
- name: "Write genesis block to Vault"
@@ -63,10 +49,6 @@
environment:
VAULT_ADDR: "{{ org.vault.url }}"
VAULT_TOKEN: "{{ org.vault.root_token }}"
- loop: "{{ network.channels }}"
- loop_control:
- loop_var: channel
- when: add_new_org == 'false' and ('2.5.' in network.version)
# Delete the orderer cli
- name: "Delete all temp {{ orderer.name }}-{{ org.name }}-cli"
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/nested_create_cli.yaml b/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/nested_create_cli.yaml
index 431afcf6788..93073adc660 100644
--- a/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/nested_create_cli.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/create/refresh_certs/create_channel_block/tasks/nested_create_cli.yaml
@@ -52,7 +52,6 @@
script: "syschannel-update-script.sh"
channel_name: "{{ sys_channel_name }}"
check: "fetch_block"
- when: add_new_org == 'false' and ('1.4.' in network.version or '2.2.' in network.version)
# Call get_update_block to fetch the appchannel channels block
- name: Call get_update_block to fetch the {{ channel_name }} channel block
@@ -72,7 +71,6 @@
script: "syschannel-update-script.sh"
channel_name: "{{ sys_channel_name }}"
check: "update_block"
- when: add_new_org == 'false' and ('1.4.' in network.version or '2.2.' in network.version)
# Call get_update_block to fetch the appchannel channels block
- name: Call get_update_block to update the {{ channel_name }} channel block
diff --git a/platforms/hyperledger-fabric/configuration/roles/create/secrets/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/secrets/tasks/main.yaml
new file mode 100644
index 00000000000..cc31dd73c32
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/create/secrets/tasks/main.yaml
@@ -0,0 +1,32 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+# Wait for namespace to be created by flux
+- name: "Wait for the namespace {{ component_ns }} to be created"
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/check/k8_component"
+ vars:
+ component_type: "Namespace"
+ component_name: "{{ component_ns }}"
+ type: "retry"
+
+# Create the vault roottoken secret
+- name: "Create vault token secret"
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/create/shared_k8s_secrets"
+ vars:
+ namespace: "{{ component_ns }}"
+ check: "token_secret"
+
+# Create the docker pull credentials for image registry
+- name: "Create docker credentials secret"
+ include_role:
+ name: "{{ playbook_dir }}/../../shared/configuration/roles/create/shared_k8s_secrets"
+ vars:
+ namespace: "{{ component_ns }}"
+ check: "docker_credentials"
+ when:
+ - network.docker.username is defined
diff --git a/platforms/hyperledger-fabric/configuration/roles/delete/genesis/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/delete/genesis/tasks/main.yaml
index 467bea7b330..68abdb3bfda 100644
--- a/platforms/hyperledger-fabric/configuration/roles/delete/genesis/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/delete/genesis/tasks/main.yaml
@@ -9,10 +9,29 @@
#############################################################################################
# Delete BASE 64 encoded genesis blocks for all channels
-- name: Delete genesis block from Vault
+- name: Delete genesis block from Vault for syschannel
shell: |
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ item.name | lower }}/channel-artifacts/syschannel-genesis
+ target_path={{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ item.name | lower }}/channel-artifacts;
+ for key in $(vault kv list -format=json "$target_path" | jq -r '.[]'); do
+ vault kv delete "$target_path/$key";
+ done
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
ignore_errors: yes
+
+# Delete genesis block to Vault
+- name: "Delete genesis block to Vault for app channel"
+ shell: |
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ item.name | lower }}/channel-artifacts/{{ channel.channel_name | lower }}-genesis
+ target_path={{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ item.name | lower }}/channel-artifacts;
+ for key in $(vault kv list -format=json "$target_path" | jq -r '.[]'); do
+ vault kv delete "$target_path/$key";
+ done
+ environment:
+ VAULT_ADDR: "{{ item.vault.url }}"
+ VAULT_TOKEN: "{{ item.vault.root_token }}"
+ loop: "{{ network['channels'] }}"
+ loop_control:
+ loop_var: channel
diff --git a/platforms/hyperledger-fabric/configuration/roles/delete/operator/tasks/delete_channel.yaml b/platforms/hyperledger-fabric/configuration/roles/delete/operator/tasks/delete_channel.yaml
index 1bf5d582457..587f76f42f3 100644
--- a/platforms/hyperledger-fabric/configuration/roles/delete/operator/tasks/delete_channel.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/delete/operator/tasks/delete_channel.yaml
@@ -13,7 +13,7 @@
state: absent
kubeconfig: "{{ kubernetes.config_file }}"
context: "{{ kubernetes.context }}"
- ignore_errors: yes
+ ignore_errors: true
# Delete main channel
- name: Delete main channel
@@ -24,4 +24,4 @@
state: absent
kubeconfig: "{{ kubernetes.config_file }}"
context: "{{ kubernetes.context }}"
- ignore_errors: yes
+ ignore_errors: true
diff --git a/platforms/hyperledger-fabric/configuration/roles/delete/vault_secrets/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/delete/vault_secrets/tasks/main.yaml
index ecfa9600ef7..284c784eeeb 100644
--- a/platforms/hyperledger-fabric/configuration/roles/delete/vault_secrets/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/delete/vault_secrets/tasks/main.yaml
@@ -17,7 +17,7 @@
state: absent
kubeconfig: "{{ kubernetes.config_file }}"
context: "{{ kubernetes.context }}"
- ignore_errors: yes
+ ignore_errors: true
# Delete vault auth
- name: Delete vault-auth path
@@ -39,19 +39,18 @@
# Delete crypto materials from vault
- name: Delete Crypto for orderers
shell: |
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/ca
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/orderers/{{orderer.name}}.{{ component_name }}/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/orderers/{{orderer.name}}.{{ component_name }}/msp
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/users/admin/msp
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/credentials/{{ component_name }}/ca/{{ org_name }}
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/ca
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/orderers/{{ orderer.name | lower }}-tls
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/orderers/{{ orderer.name | lower }}-msp
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/users/admin-tls
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/users/admin-msp
loop: "{{ services.orderers }}"
loop_control:
loop_var: orderer
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
- when: component_type == 'orderer'
+ when: item.services.orderers is defined and item.services.orderers | length > 0
# Delete crypto materials from extternalchaincode
- name: Delete Crypto for peers
@@ -69,33 +68,26 @@
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
- when: component_type == 'peer'
+ when:
+ - item.services.peers is defined and item.services.peers | length > 0
+ - peer.chaincodes is defined
# Delete crypto materials from vault
- name: Delete Crypto for peers
shell: |
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/ca
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/admin/msp
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/orderer/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/msp/config
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/ca
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/users/admin-tls
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/users/admin-msp
{% for peer in peers %}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/peers/{{peer.name}}.{{ component_name }}/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/peers/{{peer.name}}.{{ component_name }}/msp
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/peers/{{peer.name}}-tls
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/peers//{{peer.name}}-msp
{% endfor %}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/credentials/{{ component_name }}/ca/{{ org_name }}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/credentials/{{ component_name }}/couchdb/{{ org_name }}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/credentials/{{ component_name }}/git
- target_path={{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/endorsers/{{ org_name }}/users;
- for key in $(vault kv list -format=json "$target_path" | jq -r '.[]'); do
- vault kv delete "$target_path/$key/msp";
- done
vars:
peers: "{{ services.peers }}"
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
- when: component_type == 'peer'
+ when: item.services.peers is defined and item.services.peers | length > 0
# Remove all endorsers
- name: Remove all endorsers
@@ -109,37 +101,23 @@
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
- ignore_errors: yes
-
-# Delete genesis block to Vault
-- name: "Delete genesis block to Vault"
- shell: |
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ component_name }}/{{ channel.channel_name | lower }}
- environment:
- VAULT_ADDR: "{{ item.vault.url }}"
- VAULT_TOKEN: "{{ item.vault.root_token }}"
- loop: "{{ network['channels'] }}"
- loop_control:
- loop_var: channel
+ ignore_errors: true
# Delete crypto materials from vault
- name: Delete Crypto for users
shell: |
{% for user in users %}
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/{{ user.identity }}/tls
- vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users/{{ user.identity }}/msp
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/users/{{ user.identity }}-tls
+ vault kv delete {{ item.vault.secret_path | default('secretsv2') }}/{{ network.env.type }}{{ org_name }}/users/{{ user.identity }}-msp
{% endfor %}
- target_path={{ item.vault.secret_path | default('secret') }}/{{ item.name | lower }}/peerOrganizations/{{ component_name }}/users;
- for key in $(vault kv list -format=json "$target_path" | jq -r '.[]'); do
- vault kv delete "$target_path/$key/msp";
- vault kv delete "$target_path/$key/tls";
- done
vars:
users: "{{ item.users }}"
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
- when: component_type == 'peer' and item.users is defined
+ when:
+ - item.services.peers is defined and item.services.peers | length > 0
+ - item.users is defined
# Delete policy
- name: Delete policy
@@ -148,4 +126,4 @@
environment:
VAULT_ADDR: "{{ item.vault.url }}"
VAULT_TOKEN: "{{ item.vault.root_token }}"
- ignore_errors: yes
+ ignore_errors: true
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/anchorpeer_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/anchorpeer_job.tpl
deleted file mode 100644
index daf8a46e8c6..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/anchorpeer_job.tpl
+++ /dev/null
@@ -1,59 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: {{ component_name }}
- namespace: {{ component_ns }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: {{ component_name }}
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-anchorpeer
- values:
- metadata:
- namespace: {{ component_ns }}
- network:
- version: {{ network.version }}
- images:
- fabrictools: {{ docker_url }}/{{ fabric_tools_image[network.version] }}
- alpineutils: {{ docker_url }}/{{ alpine_image }}
-
- peer:
- name: {{ peer_name }}
-{% if network.env.proxy == 'none' %}
- address: {{ peer.name }}.{{ component_ns }}:7051
-{% else %}
- address: {{ peer.peerAddress }}
-{% endif %}
- localmspid: {{ org.name | lower}}MSP
- loglevel: debug
- tlsstatus: true
-
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ k8s.cluster_id | default('')}}{{ network.env.type }}{{ org.name | lower }}
- adminsecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/peerOrganizations/{{ component_ns }}/users/admin
- orderersecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/peerOrganizations/{{ component_ns }}/orderer
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
-
- channel:
- name: {{channel_name}}
- orderer:
- address: {{ participant.ordererAddress }}
- anchorstx: |-
-{{ anchorstx | indent(width=6, first=True) }}
-
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/approve_chaincode_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/approve_chaincode_job.tpl
index b410289091e..6fcaf8b3e6c 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/approve_chaincode_job.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/approve_chaincode_job.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-orderer.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-orderer.tpl
deleted file mode 100644
index 953cd401b1b..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-orderer.tpl
+++ /dev/null
@@ -1,82 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: {{ component_name }}-ca
- namespace: {{ component_name }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: {{ component_name }}-ca
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-ca-server
- values:
-{% if network.env.annotations is defined %}
- deployment:
- annotations:
-{% for item in network.env.annotations.deployment %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- annotations:
- service:
-{% for item in network.env.annotations.service %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- pvc:
-{% for item in network.env.annotations.pvc %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
-{% endif %}
- metadata:
- namespace: {{ component_name | e }}
- images:
- alpineutils: {{ docker_url }}/{{ alpine_image }}
- ca: {{ docker_url }}/{{ ca_image[network.version] }}
- server:
- name: {{ component_services.ca.name }}
- tlsstatus: true
- admin: {{ component }}-admin
-{% if component_services.ca.configpath is defined %}
- configpath: conf/fabric-ca-server-config-{{ component }}.yaml
-{% endif %}
- storage:
- storageclassname: {{ sc_name }}
- storagesize: 512Mi
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ item.k8s.cluster_id | default('')}}{{ network.env.type }}{{ item.name | lower }}
- secretcert: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/ordererOrganizations/{{ component_name | e }}/ca?ca.{{ component_name | e }}-cert.pem
- secretkey: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/ordererOrganizations/{{ component_name | e }}/ca?{{ component_name | e }}-CA.key
- secretadminpass: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/credentials/{{ component_name | e }}/ca/{{ component }}?user
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
- service:
- servicetype: ClusterIP
- ports:
- tcp:
- clusteripport: {{ component_services.ca.grpc.port }}
-{% if component_services.ca.grpc.nodePort is defined %}
- nodeport: {{ component_services.ca.grpc.nodePort }}
-{% endif %}
- proxy:
- provider: {{ network.env.proxy }}
- type: orderer
- external_url_suffix: {{ external_url_suffix }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-peer.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-peer.tpl
deleted file mode 100644
index 24ee0b9965d..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-peer.tpl
+++ /dev/null
@@ -1,82 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: {{ component_name }}-ca
- namespace: {{ component_name }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: {{ component_name }}-ca
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-ca-server
- values:
- metadata:
- namespace: {{ component_name | e }}
- images:
- alpineutils: {{ docker_url }}/{{ alpine_image }}
- ca: {{ docker_url }}/{{ ca_image[network.version] }}
-{% if network.env.annotations is defined %}
- deployment:
- annotations:
-{% for item in network.env.annotations.deployment %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- annotations:
- service:
-{% for item in network.env.annotations.service %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- pvc:
-{% for item in network.env.annotations.pvc %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
-{% endif %}
- server:
- name: {{ component_services.ca.name }}
- tlsstatus: true
- admin: {{ component }}-admin
-{% if component_services.ca.configpath is defined %}
- configpath: conf/fabric-ca-server-config-{{ component }}.yaml
-{% endif %}
- storage:
- storageclassname: {{ sc_name }}
- storagesize: 512Mi
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ item.k8s.cluster_id | default('')}}{{ network.env.type }}{{ item.name | lower }}
- secretcert: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/peerOrganizations/{{ component_name | e }}/ca?ca.{{ component_name | e }}-cert.pem
- secretkey: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/peerOrganizations/{{ component_name | e }}/ca?{{ component_name | e }}-CA.key
- secretadminpass: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/credentials/{{ component_name | e }}/ca/{{ component }}?user
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
- service:
- servicetype: ClusterIP
- ports:
- tcp:
- clusteripport: {{ component_services.ca.grpc.port }}
-{% if component_services.ca.grpc.nodePort is defined %}
- nodeport: {{ component_services.ca.grpc.nodePort }}
-{% endif %}
- proxy:
- provider: {{ network.env.proxy }}
- type: peer
- external_url_suffix: {{ external_url_suffix }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-server.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-server.tpl
new file mode 100644
index 00000000000..c21506f4ce5
--- /dev/null
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-server.tpl
@@ -0,0 +1,89 @@
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+ name: {{ component_name | replace('_','-') }}
+ namespace: {{ component_ns }}
+ annotations:
+ fluxcd.io/automated: "false"
+spec:
+ interval: 1m
+ releaseName: {{ component_name | replace('_','-') }}
+ chart:
+ spec:
+ interval: 1m
+ sourceRef:
+ kind: GitRepository
+ name: flux-{{ network.env.type }}
+ namespace: flux-{{ network.env.type }}
+ chart: {{ charts_dir }}/fabric-ca-server
+ values:
+ global:
+ serviceAccountName: vault-auth
+ cluster:
+ provider: {{ org.cloud_provider }}
+ cloudNativeServices: false
+ kubernetesUrl: {{ kubernetes_url }}
+ vault:
+ type: hashicorp
+ network: fabric
+ address: {{ vault.url }}
+ authPath: {{ network.env.type }}{{ component }}
+ secretEngine: {{ vault.secret_path | default("secretsv2") }}
+ secretPrefix: "data/{{ network.env.type }}{{ component }}"
+ role: vault-role
+ tls: false
+ proxy:
+ provider: {{ network.env.proxy | quote }}
+ externalUrlSuffix: {{ org.external_url_suffix }}
+
+ storage:
+ size: 512Mi
+ reclaimPolicy: "Delete"
+ volumeBindingMode: Immediate
+ allowedTopologies:
+ enabled: false
+
+ image:
+ alpineUtils: {{ docker_url }}/bevel-alpine:{{ bevel_alpine_version }}
+ ca: {{ docker_url }}/{{ ca_image[network.version] }}
+{% if network.docker.username is defined and network.docker.password is defined %}
+ pullSecret: regcred
+{% else %}
+ pullSecret: ""
+{% endif %}
+
+ server:
+ removeCertsOnDelete: true
+ tlsStatus: true
+ adminUsername: {{ component }}-admin
+ adminPassword: {{ component }}-adminpw
+ subject: "{{ subject | quote }}"
+{% if component_services.ca.configpath is defined %}
+ configPath: conf/fabric-ca-server-config-{{ component }}.yaml
+{% endif %}
+{% if component_services.ca.grpc.nodePort is defined %}
+ nodePort: {{ component_services.ca.grpc.nodePort }}
+{% endif %}
+ clusterIpPort: {{ component_services.ca.grpc.port }}
+
+{% if network.env.labels is defined %}
+ labels:
+{% if network.env.labels.service is defined %}
+ service:
+{% for key in network.env.labels.service.keys() %}
+ - {{ key }}: {{ network.env.labels.service[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.pvc is defined %}
+ pvc:
+{% for key in network.env.labels.pvc.keys() %}
+ - {{ key }}: {{ network.env.labels.pvc[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.deployment is defined %}
+ deployment:
+{% for key in network.env.labels.deployment.keys() %}
+ - {{ key }}: {{ network.env.labels.deployment[key] | quote }}
+{% endfor %}
+{% endif %}
+{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-tools.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-tools.tpl
deleted file mode 100644
index e8426fda057..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/ca-tools.tpl
+++ /dev/null
@@ -1,119 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: {{ component_name }}-ca-tools
- namespace: {{ component_name }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: {{ component_name }}-ca-tools
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-catools
- values:
- metadata:
- namespace: {{ component_name }}
- name: ca-tools
- component_type: {{ component_type }}
- org_name: {{ org_name }}
- proxy: {{ proxy }}
-{% if network.env.annotations is defined %}
- annotations:
- service:
-{% for item in network.env.annotations.service %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- pvc:
-{% for item in network.env.annotations.pvc %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- deployment:
-{% for item in network.env.annotations.deployment %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
-{% endif %}
- replicaCount: 1
-
- image:
- alpineutils: {{ docker_url }}/{{ alpine_image }}
- catools: {{ docker_url }}/{{ ca_tools_image }}
- pullPolicy: IfNotPresent
-
- storage:
- storageclassname: {{ sc_name }}
- storagesize: 512Mi
-
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ item.k8s.cluster_id | default('')}}{{ network.env.type }}{{ item.name | lower }}
- secretusers: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/users
- secretorderer: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/orderers
- secretpeer: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/peers
- secretpeerorderertls: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name }}/orderer/tls
- secretcert: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name | e }}/ca?ca.{{ component_name | e }}-cert.pem
- secretkey: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name | e }}/ca?{{ component_name | e }}-CA.key
- secretcouchdb: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/credentials/{{ component_name }}/couchdb/{{ org_name }}
- secretconfigfile: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component_name | e }}/msp/config
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
-
- healthcheck:
- retries: 10
- sleepTimeAfterError: 2
-
-
- org_data:
- external_url_suffix: {{ external_url_suffix }}
- component_subject: {{ component_subject }}
- cert_subject: {{ cert_subject }}
- component_country: {{ component_country }}
- component_state: {{ component_state }}
- component_location: {{ component_location }}
- ca_url: {{ ca_url }}
-
- orderers:
- name: {% for orderer in orderers_list %}{% for key, value in orderer.items() %}{% if key == 'name' %}{{ value }}-{% endif %}{% endfor %}{% endfor %}
-
-{% if item.type == 'peer' %}
- orderers_info:
-{% for orderer in orderers_list %}
- - name: {{ orderer.name }}
- path: "{{ lookup('file', orderer.certificate) | b64encode }}"
-{% endfor %}
-
- peers:
- name: {% for peer in peers_list %}{% for key, value in peer.items() %}{% if key == 'name' %}{{ value }},{% endif %}{% if key == 'peerstatus' %}{{ value }}{% endif %}{% endfor %}-{% endfor %}
-
- peer_count: "{{ peer_count }}"
-{% if item.users is defined %}
- users:
- users_list: "{{ user_list | b64encode }}"
- users_identities: {% for user in user_list %}{% for key, value in user.items() %}{% if key == 'identity' %}{{ value }}{% endif %}{% endfor %}-{% endfor %}
-{% endif %}
-
-{% if add_peer_value == 'true' %}
- new_peer_count: "{{ new_peer_count }}"
-{% endif %}
- checks:
- refresh_cert_value: {{ refresh_cert_value }}
- refresh_user_cert_value: {{ refresh_user_cert_value }}
- add_peer_value: {{ add_peer_value }}
-{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/cacerts_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/cacerts_job.tpl
deleted file mode 100644
index b6d0b4caad5..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/cacerts_job.tpl
+++ /dev/null
@@ -1,41 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: {{ name }}-cacerts-job
- namespace: {{ component_ns }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: {{ name }}-cacerts-job
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-cacerts-gen
- values:
- metadata:
- name: {{ component }}
- component_name: {{ component }}-net
- namespace: {{ component_ns }}
- images:
- alpineutils: {{ docker_url }}/{{ alpine_image }}
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ item.k8s.cluster_id | default('')}}{{ network.env.type }}{{ item.name | lower }}
- secretcryptoprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/{{ component_type }}Organizations/{{ component }}-net/ca
- secretcredentialsprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/credentials/{{ component }}-net/ca/{{ component }}
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
-
- ca:
- subject: {{ subject }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/cli.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/cli.tpl
index 98cfaf2273a..fe18c283712 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/cli.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/cli.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
@@ -50,3 +50,24 @@ spec:
{% endif %}
orderer:
address: {{ orderer.uri }}
+{% if network.env.labels is defined %}
+ labels:
+{% if network.env.labels.service is defined %}
+ service:
+{% for key in network.env.labels.service.keys() %}
+ - {{ key }}: {{ network.env.labels.service[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.pvc is defined %}
+ pvc:
+{% for key in network.env.labels.pvc.keys() %}
+ - {{ key }}: {{ network.env.labels.pvc[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.deployment is defined %}
+ deployment:
+{% for key in network.env.labels.deployment.keys() %}
+ - {{ key }}: {{ network.env.labels.deployment[key] | quote }}
+{% endfor %}
+{% endif %}
+{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/commit_chaincode_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/commit_chaincode_job.tpl
index a2258413cf8..45059ead02b 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/commit_chaincode_job.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/commit_chaincode_job.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/create_channel_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/create_channel_job.tpl
deleted file mode 100644
index 835ac592b18..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/create_channel_job.tpl
+++ /dev/null
@@ -1,54 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: channel-{{ org.name | lower }}-{{ component_name }}
- namespace: {{ component_ns }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: channel-{{ org.name | lower }}-{{ component_name }}
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-channel-create
- values:
- metadata:
- namespace: {{ component_ns }}
- network:
- version: {{ network.version }}
- images:
- fabrictools: {{ docker_url }}/{{ fabric_tools_image[network.version] }}
- alpineutils: {{ docker_url }}/{{ alpine_image }}
-
- peer:
- name: {{ peer_name }}
- address: {{ peer_name }}.{{ component_ns }}:7051
- localmspid: {{ org.name | lower }}MSP
- loglevel: debug
- tlsstatus: true
-
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ k8s.cluster_id | default('')}}{{ network.env.type }}{{ org.name | lower }}
- adminsecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/peerOrganizations/{{ component_ns }}/users/admin
- orderersecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/peerOrganizations/{{ component_ns }}/orderer
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
-
- channel:
- name: {{ component_name }}
- orderer:
- address: {{ peer.ordererAddress }}
- channeltx: |-
-{{ channeltx | indent(width=6, first=True) }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/external_chaincode.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/external_chaincode.tpl
index bab4e450720..9a34b2e1bf6 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/external_chaincode.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/external_chaincode.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cc-{{ chaincode_name }}
@@ -49,3 +49,25 @@ spec:
{% endif %}
service:
servicetype: ClusterIP
+
+{% if network.env.labels is defined %}
+ labels:
+{% if network.env.labels.service is defined %}
+ service:
+{% for key in network.env.labels.service.keys() %}
+ - {{ key }}: {{ network.env.labels.service[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.pvc is defined %}
+ pvc:
+{% for key in network.env.labels.pvc.keys() %}
+ - {{ key }}: {{ network.env.labels.pvc[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.deployment is defined %}
+ deployment:
+{% for key in network.env.labels.deployment.keys() %}
+ - {{ key }}: {{ network.env.labels.deployment[key] | quote }}
+{% endfor %}
+{% endif %}
+{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_chaincode_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_chaincode_job.tpl
index fabb64e4c6c..5990fdef549 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_chaincode_job.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_chaincode_job.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_external_chaincode_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_external_chaincode_job.tpl
index 0e289f78c0f..df53012860b 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_external_chaincode_job.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/install_external_chaincode_job.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/instantiate_chaincode_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/instantiate_chaincode_job.tpl
index 3de754f2580..b9446545c65 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/instantiate_chaincode_job.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/instantiate_chaincode_job.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/invoke_chaincode_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/invoke_chaincode_job.tpl
index 6d7c7fa21be..ff8f0d3cdf3 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/invoke_chaincode_job.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/invoke_chaincode_job.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/join_channel_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/join_channel_job.tpl
deleted file mode 100644
index dd2cbd920dd..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/join_channel_job.tpl
+++ /dev/null
@@ -1,54 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: joinchannel-{{ peer.name }}-{{ component_name }}
- namespace: {{ component_ns }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: joinchannel-{{ peer.name }}-{{ component_name }}
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-channel-join
- values:
- metadata:
- namespace: {{ component_ns }}
- images:
- fabrictools: {{ docker_url }}/{{ fabric_tools_image[network.version] }}
- alpineutils: {{ docker_url }}/{{ alpine_image }}
-
- peer:
- name: {{ peer_name }}
-{% if network.env.proxy == 'none' %}
- address: {{ peer.name }}.{{ component_ns }}:7051
-{% else %}
- address: {{ peer.peerAddress }}
-{% endif %}
- localmspid: {{ org.name | lower}}MSP
- loglevel: debug
- tlsstatus: true
-
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ org.k8s.cluster_id | default('')}}{{ network.env.type }}{{ org.name | lower }}
- adminsecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/peerOrganizations/{{ component_ns }}/users/admin
- orderersecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/peerOrganizations/{{ component_ns }}/orderer
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
-
- channel:
- name: {{channel_name}}
- orderer:
- address: {{ participant.ordererAddress }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/operations_console.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/operations_console.tpl
index c38c91d7ff1..57b2bf3f46c 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/operations_console.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/operations_console.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ name }}-operations-console
@@ -45,3 +45,24 @@ spec:
proxy:
provider: "{{ network.env.proxy }}"
external_url_suffix: {{ item.external_url_suffix }}
+{% if network.env.labels is defined %}
+ labels:
+{% if network.env.labels.service is defined %}
+ service:
+{% for key in network.env.labels.service.keys() %}
+ - {{ key }}: {{ network.env.labels.service[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.pvc is defined %}
+ pvc:
+{% for key in network.env.labels.pvc.keys() %}
+ - {{ key }}: {{ network.env.labels.pvc[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.deployment is defined %}
+ deployment:
+{% for key in network.env.labels.deployment.keys() %}
+ - {{ key }}: {{ network.env.labels.deployment[key] | quote }}
+{% endfor %}
+{% endif %}
+{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/orderernode.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/orderernode.tpl
index a21ad5e280f..d1dffb9f42e 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/orderernode.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/orderernode.tpl
@@ -1,13 +1,13 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
- name: {{ org_name }}-{{ orderer.name }}
+ name: {{ component_name | replace('_','-') }}
namespace: {{ namespace }}
annotations:
fluxcd.io/automated: "false"
spec:
interval: 1m
- releaseName: {{ org_name }}-{{ orderer.name }}
+ releaseName: {{ component_name | replace('_','-') }}
chart:
spec:
interval: 1m
@@ -17,97 +17,118 @@ spec:
namespace: flux-{{ network.env.type }}
chart: {{ charts_dir }}/fabric-orderernode
values:
- metadata:
- namespace: {{ namespace }}
- network:
- version: {{ network.version }}
- images:
- orderer: {{ docker_url }}/{{ orderer_image[network.version] }}
- alpineutils: {{ docker_url }}/{{ alpine_image }}
-{% if network.env.annotations is defined %}
- annotations:
- service:
-{% for item in network.env.annotations.service %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- pvc:
-{% for item in network.env.annotations.pvc %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- deployment:
-{% for item in network.env.annotations.deployment %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
+ global:
+ version: {{ network.version }}
+ serviceAccountName: vault-auth
+ cluster:
+ provider: {{ org.cloud_provider }}
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ network: fabric
+ address: {{ vault.url }}
+ authPath: {{ network.env.type }}{{ org_name }}
+ secretEngine: {{ vault.secret_path | default("secretsv2") }}
+ secretPrefix: "data/{{ network.env.type }}{{ org_name }}"
+ role: vault-role
+ tls: false
+ proxy:
+ provider: {{ network.env.proxy | quote }}
+ externalUrlSuffix: {{ org.external_url_suffix }}
+
+ storage:
+ size: 512Mi
+ reclaimPolicy: "Delete"
+ volumeBindingMode:
+ allowedTopologies:
+ enabled: false
+
+ certs:
+ generateCertificates: true
+ orgData:
+{% if network.env.proxy == 'none' %}
+ caAddress: ca.{{ namespace }}:7054
+{% else %}
+ caAddress: ca.{{ namespace }}.{{ org.external_url_suffix }}
{% endif %}
- orderer:
- name: {{ orderer.name }}
- loglevel: info
- localmspid: {{ org_name }}MSP
- tlsstatus: true
- keepaliveserverinterval: 10s
- ordererAddress: {{ orderer.ordererAddress }}
+ caAdminUser: {{ org_name }}-admin
+ caAdminPassword: {{ org_name }}-adminpw
+ orgName: {{ org_name }}
+ type: orderer
+ componentSubject: "{{ component_subject | quote }}"
- consensus:
- name: {{ orderer.consensus }}
+ settings:
+ createConfigMaps: {{ create_configmaps }}
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
- storage:
- storageclassname: {{ sc_name }}
- storagesize: 512Mi
+ image:
+ orderer: {{ docker_url }}/{{ orderer_image }}
+ alpineUtils: {{ docker_url }}/bevel-alpine:{{ bevel_alpine_version }}
+{% if network.docker.username is defined and network.docker.password is defined %}
+ pullSecret: regcred
+{% else %}
+ pullSecret: ""
+{% endif %}
- service:
- servicetype: ClusterIP
+ orderer:
+ consensus: {{ orderer.consensus }}
+ logLevel: info
+ localMspId: {{ org_name }}MSP
+ tlsStatus: true
+ keepAliveServerInterval: 10s
+ serviceType: ClusterIP
ports:
grpc:
- clusteripport: {{ orderer.grpc.port }}
+ clusterIpPort: {{ orderer.grpc.port }}
{% if orderer.grpc.nodePort is defined %}
nodeport: {{ orderer.grpc.nodePort }}
{% endif %}
metrics:
enabled: {{ orderer.metrics.enabled | default(false) }}
- clusteripport: {{ orderer.metrics.port | default(9443) }}
+ clusterIpPort: {{ orderer.metrics.port | default(9443) }}
+ resources:
+ limits:
+ memory: 512M
+ cpu: 1
+ requests:
+ memory: 512M
+ cpu: 0.25
- vault:
- address: {{ vault.url }}
- role: vault-role
- authpath: {{ item.k8s.cluster_id | default('')}}{{ network.env.type }}{{ item.name | lower }}
- type: {{ vault.type | default("hashicorp") }}
- secretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/ordererOrganizations/{{ namespace }}/orderers/{{ orderer.name }}.{{ namespace }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
- serviceaccountname: vault-auth
{% if orderer.consensus == 'kafka' %}
kafka:
- readinesscheckinterval: 10
- readinessthreshold: 10
+ readinessCheckInterval: 10
+ readinessThresHold: 10
brokers:
{% for i in range(consensus.replicas) %}
- {{ consensus.name }}-{{ i }}.{{ consensus.type }}.{{ namespace }}.svc.cluster.local:{{ consensus.grpc.port }}
{% endfor %}
{% endif %}
- proxy:
- provider: {{ network.env.proxy }}
- external_url_suffix: {{ item.external_url_suffix }}
-{% if '2.5' not in network.version %}
- genesis: |-
-{{ genesis | indent(width=6, first=True) }}
-{% endif %}
+ healthCheck:
+ retries: 10
+ sleepTimeAfterError: 15
- config:
- pod:
- resources:
- limits:
- memory: 512M
- cpu: 1
- requests:
- memory: 512M
- cpu: 0.25
+{% if network.env.labels is defined %}
+ labels:
+{% if network.env.labels.service is defined %}
+ service:
+{% for key in network.env.labels.service.keys() %}
+ - {{ key }}: {{ network.env.labels.service[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.pvc is defined %}
+ pvc:
+{% for key in network.env.labels.pvc.keys() %}
+ - {{ key }}: {{ network.env.labels.pvc[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.deployment is defined %}
+ deployment:
+{% for key in network.env.labels.deployment.keys() %}
+ - {{ key }}: {{ network.env.labels.deployment[key] | quote }}
+{% endfor %}
+{% endif %}
+{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/osn_create_channel_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/osn_create_channel_job.tpl
deleted file mode 100644
index 6fc24964044..00000000000
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/osn_create_channel_job.tpl
+++ /dev/null
@@ -1,57 +0,0 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
-kind: HelmRelease
-metadata:
- name: channel-{{ org.name | lower }}-{{ component_name }}
- namespace: {{ component_ns }}
- annotations:
- fluxcd.io/automated: "false"
-spec:
- interval: 1m
- releaseName: osn-channel-{{ org.name | lower }}-{{ component_name }}
- chart:
- spec:
- interval: 1m
- sourceRef:
- kind: GitRepository
- name: flux-{{ network.env.type }}
- namespace: flux-{{ network.env.type }}
- chart: {{ charts_dir }}/fabric-osnadmin-channel-create
- values:
- metadata:
- namespace: {{ component_ns }}
- network:
- version: {{ network.version }}
- images:
- fabrictools: {{ docker_url }}/{{ fabric_tools_image[network.version] }}
- alpineutils: {{ docker_url }}/{{ alpine_image }}
-
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ org.k8s.cluster_id | default('')}}{{ network.env.type }}{{ org.name | lower }}
- adminsecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/ordererOrganizations/{{ component_ns }}/users/admin
- orderersecretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ org.name | lower }}/ordererOrganizations/{{ component_ns }}/orderers
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
-{% else %}
- imagesecretname: ""
-{% endif %}
-
- channel:
- name: {{ component_name }}
- orderers:
- orderer_info: {% for orderer in orderers_list %}{% for key, value in orderer.items() %}{% if key == 'name' %}{{ value }}{% endif %}{% endfor %}*{% endfor %}
-
- add_orderer: {{ add_orderer_value }}
-
-{% if add_orderer is not defined or add_orderer is sameas false %}
- genesis: |-
-{{ genesis | indent(width=6, first=True) }}
-{% else %}
- orderer:
- name: {{ first_orderer.name }}
- localmspid: {{ org.name | lower}}MSP
- address: {{ first_orderer.ordererAddress }}
-{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/upgrade_chaincode_job.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/upgrade_chaincode_job.tpl
index 169557c1733..350354ebc64 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/upgrade_chaincode_job.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/upgrade_chaincode_job.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ component_name }}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/value_peer.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/value_peer.tpl
index ecb99df43e1..7aaab41423b 100755
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/value_peer.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/value_peer.tpl
@@ -1,13 +1,13 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
- name: {{ name }}-{{ peer_name }}
- namespace: {{ peer_ns }}
+ name: {{ component_name | replace('_','-') }}
+ namespace: {{ component_ns }}
annotations:
fluxcd.io/automated: "false"
spec:
interval: 1m
- releaseName: {{ name }}-{{ peer_name }}
+ releaseName: {{ component_name | replace('_','-') }}
chart:
spec:
interval: 1m
@@ -17,110 +17,142 @@ spec:
namespace: flux-{{ network.env.type }}
chart: {{ charts_dir }}/fabric-peernode
values:
-{% if network.upgrade is defined %}
- upgrade: {{ network.upgrade }}
-{% endif %}
- metadata:
- namespace: {{ peer_ns }}
- images:
- couchdb: {{ docker_url }}/{{ couchdb_image[network.version] }}
- peer: {{ docker_url }}/{{ peer_image[network.version] }}
- alpineutils: {{ docker_url }}/{{ alpine_image }}
+ global:
+ version: {{ network.version }}
+ serviceAccountName: vault-auth
+ cluster:
+ provider: {{ org.cloud_provider }}
+ cloudNativeServices: false
+ vault:
+ type: hashicorp
+ network: fabric
+ address: {{ vault.url }}
+ authPath: {{ network.env.type }}{{ name }}
+ secretEngine: {{ vault.secret_path | default("secretsv2") }}
+ secretPrefix: "data/{{ network.env.type }}{{ name }}"
+ role: vault-role
+ tls: false
+ proxy:
+ provider: {{ network.env.proxy | quote }}
+ externalUrlSuffix: {{ org.external_url_suffix }}
-{% if network.env.annotations is defined %}
- annotations:
- service:
-{% for item in network.env.annotations.service %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- pvc:
-{% for item in network.env.annotations.pvc %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
- deployment:
-{% for item in network.env.annotations.deployment %}
-{% for key, value in item.items() %}
- - {{ key }}: {{ value | quote }}
-{% endfor %}
-{% endfor %}
-{% endif %}
- peer:
- name: {{ peer_name }}
- gossippeeraddress: {{ peer.gossippeeraddress }}
-{% if provider == 'none' %}
- gossipexternalendpoint: {{ peer_name }}.{{ peer_ns }}:7051
+ storage:
+ enabled: {{ sc_enabled }}
+ peer: 512Mi
+ couchdb: 512Mi
+ reclaimPolicy: "Delete"
+ volumeBindingMode: Immediate
+ allowedTopologies:
+ enabled: false
+
+ certs:
+ generateCertificates: true
+ orgData:
+{% if network.env.proxy == 'none' %}
+ caAddress: ca.{{ namespace }}:7054
{% else %}
- gossipexternalendpoint: {{ peer.peerAddress }}
+ caAddress: ca.{{ namespace }}.{{ org.external_url_suffix }}
{% endif %}
- localmspid: {{ name }}MSP
- loglevel: info
- tlsstatus: true
- builder: hyperledger/fabric-ccenv:{{ network.version }}
- couchdb:
- username: {{ name }}-user
-{% if peer.configpath is defined %}
- configpath: conf/{{ peer_name }}_{{ name }}_core.yaml
- core: |-
-{{ core_file | indent(width=8, first=True) }}
+ caAdminUser: {{ name }}-admin
+ caAdminPassword: {{ name }}-adminpw
+ orgName: {{ name }}
+ type: peer
+ componentSubject: "{{ component_subject }}"
+
+{% if org.users is defined %}
+ users:
+ usersList:
+{% for user in user_list %}
+ - {{ user }}
+{% endfor %}
{% endif %}
- storage:
- peer:
- storageclassname: {{ sc_name }}
- storagesize: 512Mi
- couchdb:
- storageclassname: {{ sc_name }}
- storagesize: 1Gi
+ settings:
+ createConfigMaps: {{ create_configmaps }}
+ refreshCertValue: false
+ addPeerValue: false
+ removeCertsOnDelete: true
+ removeOrdererTlsOnDelete: true
- vault:
- role: vault-role
- address: {{ vault.url }}
- authpath: {{ item.k8s.cluster_id | default('')}}{{ network.env.type }}{{ item.name | lower }}
- secretprefix: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/peerOrganizations/{{ namespace }}/peers/{{ peer_name }}.{{ namespace }}
- serviceaccountname: vault-auth
- type: {{ vault.type | default("hashicorp") }}
-{% if network.docker.username is defined and network.docker.password is defined %}
- imagesecretname: regcred
+ image:
+ couchdb: {{ docker_url }}/{{ couchdb_image }}
+ peer: {{ docker_url }}/{{ peer_image }}
+ alpineUtils: {{ docker_url }}/bevel-alpine:{{ bevel_alpine_version }}
+{% if network.docker.username is defined and network.docker.password is defined %}
+ pullSecret: regcred
{% else %}
- imagesecretname: ""
+ pullSecret: ""
{% endif %}
- secretcouchdbpass: {{ vault.secret_path | default('secretsv2') }}/data/{{ item.name | lower }}/credentials/{{ namespace }}/couchdb/{{ name }}?user
- service:
- servicetype: ClusterIP
+ peer:
+ gossipPeerAddress: {{ peer.peerAddress }}
+ logLevel: info
+ localMspId: {{ name }}MSP
+ tlsStatus: true
+ cliEnabled: {{ enabled_cli }}
+ ordererAddress: {{ orderer.uri }}
+ builder: hyperledger/fabric-ccenv
+ couchdb:
+ username: {{ name }}-user
+ password: {{ name }}-userpw
+ mspConfig:
+ organizationalUnitIdentifiers:
+ nodeOUs:
+ clientOUIdentifier: client
+ peerOUIdentifier: peer
+ adminOUIdentifier: admin
+ ordererOUIdentifier: orderer
+ serviceType: ClusterIP
+ loadBalancerType: ""
ports:
grpc:
- clusteripport: {{ peer.grpc.port }}
+ clusterIpPort: {{ peer.grpc.port }}
{% if peer.grpc.nodePort is defined %}
- nodeport: {{ peer.grpc.nodePort }}
+ nodePort: {{ peer.grpc.nodePort }}
{% endif %}
events:
- clusteripport: {{ peer.events.port }}
+ clusterIpPort: {{ peer.events.port }}
{% if peer.events.nodePort is defined %}
- nodeport: {{ peer.events.nodePort }}
+ nodePort: {{ peer.events.nodePort }}
{% endif %}
couchdb:
- clusteripport: {{ peer.couchdb.port }}
+ clusterIpPort: {{ peer.couchdb.port }}
{% if peer.couchdb.nodePort is defined %}
- nodeport: {{ peer.couchdb.nodePort }}
+ nodepnodePortort: {{ peer.couchdb.nodePort }}
{% endif %}
- metrics:
+ metrics:
enabled: {{ peer.metrics.enabled | default(false) }}
- clusteripport: {{ peer.metrics.port | default(9443) }}
- proxy:
- provider: "{{ network.env.proxy }}"
- external_url_suffix: {{ item.external_url_suffix }}
+ clusterIpPort: {{ peer.metrics.port | default(9443) }}
+ resources:
+ limits:
+ memory: 1Gi
+ cpu: 1
+ requests:
+ memory: 512M
+ cpu: 0.25
+ upgrade: {{ network.upgrade | default(false) }}
+ healthCheck:
+ retries: 20
+ sleepTimeAfterError: 15
- config:
- pod:
- resources:
- limits:
- memory: 512M
- cpu: 1
- requests:
- memory: 512M
- cpu: 0.25
+{% if network.env.labels is defined %}
+ labels:
+{% if network.env.labels.service is defined %}
+ service:
+{% for key in network.env.labels.service.keys() %}
+ - {{ key }}: {{ network.env.labels.service[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.pvc is defined %}
+ pvc:
+{% for key in network.env.labels.pvc.keys() %}
+ - {{ key }}: {{ network.env.labels.pvc[key] | quote }}
+{% endfor %}
+{% endif %}
+{% if network.env.labels.deployment is defined %}
+ deployment:
+{% for key in network.env.labels.deployment.keys() %}
+ - {{ key }}: {{ network.env.labels.deployment[key] | quote }}
+{% endfor %}
+{% endif %}
+{% endif %}
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/zkkafka.tpl b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/zkkafka.tpl
index 29b97d85d48..af0ef0d229c 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/zkkafka.tpl
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/templates/zkkafka.tpl
@@ -1,4 +1,4 @@
-apiVersion: helm.toolkit.fluxcd.io/v2beta1
+apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: zkkafka-{{ org_name }}-orderer
diff --git a/platforms/hyperledger-fabric/configuration/roles/helm_component/vars/main.yaml b/platforms/hyperledger-fabric/configuration/roles/helm_component/vars/main.yaml
index 22ee588acae..f33e0cf7ab9 100644
--- a/platforms/hyperledger-fabric/configuration/roles/helm_component/vars/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/helm_component/vars/main.yaml
@@ -5,8 +5,7 @@
##############################################################################################
helm_templates:
- ca-orderer: ca-orderer.tpl
- ca-peer: ca-peer.tpl
+ ca-server: ca-server.tpl
ca-tools: ca-tools.tpl
cas: ca.tpl
orderers: orderernode.tpl
@@ -30,31 +29,20 @@ helm_templates:
external_chaincode: external_chaincode.tpl
install_external_chaincode_job: install_external_chaincode_job.tpl
-alpine_image: bevel-alpine:latest
-ca_tools_image: bevel-fabric-ca-tools:1.2.1
+bevel_alpine_version: latest # Change to tag version when using tag specific images
+fabric_tools_image: bevel-fabric-tools
kafka_image: bevel-fabric-kafka:0.4.18
zookeeper_image: bevel-fabric-zookeeper:0.4.18
fabric_console_image: bevel-fabric-console:latest
+orderer_image: bevel-fabric-orderer
+peer_image: bevel-fabric-peer
+couchdb_image: bevel-fabric-couchdb
+
ca_image:
1.4.8: bevel-fabric-ca:1.4.8
2.2.2: bevel-fabric-ca:1.4.8
2.5.4: bevel-fabric-ca:latest
-orderer_image:
- 1.4.8: bevel-fabric-orderer:1.4.8
- 2.2.2: bevel-fabric-orderer:2.2.2
- 2.5.4: bevel-fabric-orderer:2.5.4
-
-peer_image:
- 1.4.8: bevel-fabric-peer:1.4.8
- 2.2.2: bevel-fabric-peer:2.2.2
- 2.5.4: bevel-fabric-peer:2.5.4
-
-couchdb_image:
- 1.4.8: bevel-fabric-couchdb:1.4.8
- 2.2.2: bevel-fabric-couchdb:2.2.2
- 2.5.4: bevel-fabric-couchdb:2.5.4
-
fabric_tools_image:
1.4.8: bevel-fabric-tools:1.4.8
2.2.2: bevel-fabric-tools:2.2.2
diff --git a/platforms/hyperledger-fabric/configuration/roles/k8_component/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/k8_component/tasks/main.yaml
index f603add72e1..21c4ab9f408 100644
--- a/platforms/hyperledger-fabric/configuration/roles/k8_component/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/k8_component/tasks/main.yaml
@@ -9,25 +9,25 @@
#############################################################################################
# Ensure that the directory exists for each entity, if not, it creates them
-- name: Ensure {{ component_type_name }} dir exists
+- name: Ensure {{ release_dir }} dir exists
file:
- path: "{{ release_dir }}/{{ component_type_name }}"
+ path: "{{ release_dir }}"
state: directory
# Create the value file for the k8 components
-- name: "Create {{ component_type }} file for {{ component_type_name }}"
+- name: "Create {{ component_type }} file for {{ org.name | lower }}"
template:
src: "{{ k8_templates[type] | default('default.tpl') }}"
dest: "{{ values_file }}"
vars:
- values_file: "{{ release_dir }}/{{ component_type_name }}/{{ component_type }}.yaml"
+ values_file: "{{ release_dir }}/{{ component_type }}.yaml"
type: "{{ component_type }}"
# Create the component in kubernetes cluster directly when using operator
- name: Create the component in kubernetes cluster directly when using operator
kubernetes.core.k8s:
state: present
- src: "{{ release_dir }}/{{ component_type_name }}/{{ component_type }}.yaml"
+ src: "{{ release_dir }}/{{ component_type }}.yaml"
kubeconfig: "{{ kubernetes.config_file }}"
context: "{{ kubernetes.context }}"
when:
diff --git a/platforms/hyperledger-fabric/configuration/roles/operator/create/ca/user/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/operator/create/ca/user/tasks/main.yaml
index 8cb2455877c..4a95cf94204 100644
--- a/platforms/hyperledger-fabric/configuration/roles/operator/create/ca/user/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/operator/create/ca/user/tasks/main.yaml
@@ -17,7 +17,7 @@
until: this.status == 200
retries: "{{ network.env.retry_count }}"
delay: 20
- ignore_errors: yes
+ ignore_errors: true
# Create main user for orderer org
- name: "Create main user for orderer org"
@@ -33,7 +33,7 @@
when:
- component_type == 'orderer'
- user_type == 'default'
- ignore_errors: yes
+ ignore_errors: true
# Create main user for peer org
- name: "Create main user for peer org"
@@ -63,7 +63,7 @@
kubeconfig_path: "{{ item.k8s.config_file }}"
when:
- user_type == 'admin'
- ignore_errors: yes
+ ignore_errors: true
# Create admin user identity for orderer
- name: "Create admin user identity for orderer"
diff --git a/platforms/hyperledger-fabric/configuration/roles/operator/create/orderer/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/operator/create/orderer/tasks/main.yaml
index 9ddcfec0d4b..2d544ebec0d 100644
--- a/platforms/hyperledger-fabric/configuration/roles/operator/create/orderer/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/operator/create/orderer/tasks/main.yaml
@@ -17,7 +17,7 @@
until: this.status == 200
retries: "{{ network.env.retry_count }}"
delay: 20
- ignore_errors: yes
+ ignore_errors: true
# Create orderer node
- name: "Create orderer node"
diff --git a/platforms/hyperledger-fabric/configuration/roles/operator/create/peer/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/operator/create/peer/tasks/main.yaml
index bd4b5a23f97..9992d83211a 100644
--- a/platforms/hyperledger-fabric/configuration/roles/operator/create/peer/tasks/main.yaml
+++ b/platforms/hyperledger-fabric/configuration/roles/operator/create/peer/tasks/main.yaml
@@ -17,7 +17,7 @@
until: this.status == 200
retries: "{{ network.env.retry_count }}"
delay: 20
- ignore_errors: yes
+ ignore_errors: true
# Create peer node
- name: "Create peer node"
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-new-channel.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-new-channel.yaml
index 166347992ae..589ab5ea165 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-new-channel.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-new-channel.yaml
@@ -11,7 +11,7 @@ network:
# Network level configuration specifies the attributes required for each organization
# to join an existing network.
type: fabric
- version: 2.2.2 # currently tested 1.4.8 and 2.2.2
+ version: 2.2.2 # currently tested 1.4.8, 2.2.2 and 2.5.4
frontend: enabled #Flag for frontend to enabled for nodes/peers
@@ -21,9 +21,9 @@ network:
proxy: haproxy # values can be 'haproxy' or 'none'
retry_count: 20 # Retry count for the checks
external_dns: enabled # Should be enabled if using external-dns for automatic route configuration
- annotations: # Additional annotations that can be used for some pods (ca, ca-tools, orderer and peer nodes)
+ labels: # Additional annotations that can be used for some pods (ca, ca-tools, orderer and peer nodes)
service:
- - example1: example2
+ example1: example2
deployment: {}
pvc: {}
# For providing Custom Templates to generate configtx.yaml
@@ -48,42 +48,69 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
- channel_status: existing
+ channel_status: new
+ osn_creator_org: # Organization name, whose orderers will create the channel. This field is only used with version 2.5
+ name: supplychain
chaincodes:
- "chaincode_name"
- orderers:
+ orderers:
- supplychain
participants:
- organization:
name: carrier
type: creator # creator organization will create the channel and instantiate chaincode, in addition to joining the channel and install chaincode
- org_status: existing
+ org_status: new
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, External or internal URI of the orderer
+ - organization:
+ name: supplychain
+ type: joiner
+ org_status: new
+ peers:
+ - peer:
+ name: peer0
+ type: anchor
+ gossipAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ peerAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ - peer:
+ name: peer1
+ type: nonanchor
+ gossipAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ peerAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ - organization:
+ name: store
+ type: joiner # joiner organization will only join the channel and install chaincode
+ org_status: new
+ peers:
+ - peer:
+ name: peer0
+ type: anchor
+ gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
+ peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- organization:
name: warehouse
type: joiner
@@ -91,9 +118,10 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- organization:
name: manufacturer
type: joiner
@@ -101,19 +129,10 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
- - organization:
- name: store
- type: joiner # joiner organization will only join the channel and install chaincode
- org_status: new
- peers:
- - peer:
- name: peer0
- gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
- peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -144,8 +163,7 @@ network:
name: peer0
corepeerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
certificate: "/path/store/server.crt" # certificate path for peer
- genesis:
- name: OrdererGenesis
+
- channel:
consortium: SupplyChainConsortium
channel_name: ChannelTwo
@@ -153,6 +171,22 @@ network:
orderers:
- supplychain
participants:
+ - organization:
+ name: supplychain
+ type: joiner
+ org_status: new
+ peers:
+ - peer:
+ name: peer0
+ type: anchor
+ gossipAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ peerAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ - peer:
+ name: peer1
+ type: nonanchor
+ gossipAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ peerAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- organization:
name: carrier
type: joiner # creator organization will create the channel and instantiate chaincode, in addition to joining the channel and install chaincode
@@ -160,9 +194,10 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: creator # joiner organization will only join the channel and install chaincode
@@ -170,9 +205,10 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -189,8 +225,6 @@ network:
name: peer0
corepeerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
certificate: "/path/store/server.crt" # certificate path for peer
- genesis:
- name: ChannelTwoGenesis
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -204,18 +238,17 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: new
+ fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: /path/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
-
+
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
aws:
access_key: "aws_access_key" # AWS Access key, only used when cloud_provider=aws
secret_key: "aws_secret_key" # AWS Secret key, only used when cloud_provider=aws
-
+
# Kubernetes cluster deployment variables. The config file path and name has to be provided in case
# the cluster has already been created.
k8s:
@@ -248,14 +281,13 @@ network:
services:
ca:
name: ca
- subject: "/C=GB/ST=London/L=London/O=Orderer/CN=ca.supplychain-net.org1proxy.blockchaincloudpoc.com"
+ subject: "/C=GB/ST=London/L=London/O=Orderer"
type: ca
grpc:
port: 7054
consensus:
name: raft
-
orderers:
# This sample has multiple orderers as an example.
# You can use a single orderer for most production implementations.
@@ -266,111 +298,59 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- orderer:
name: orderer2
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- orderer:
name: orderer3
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.org1proxy.blockchaincloudpoc.com:443
-
- # Specification for the 2nd organization. Each organization maps to a VPC and a separate k8s cluster
- - organization:
- name: manufacturer
- country: CH
- state: Zurich
- location: Zurich
- subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
- external_url_suffix: org2proxy.blockchaincloudpoc.com
- org_status: new
- orderer_org: supplychain # Name of the organization that provides the ordering service
- ca_data:
- url: ca.manufacturer-net.org2proxy.blockchaincloudpoc.com
- certificate: /path/manufacturer/server.crt
-
- cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
- aws:
- access_key: "aws_access_key" # AWS Access key, only used when cloud_provider=aws
- secret_key: "aws_secret_key" # AWS Secret key, only used when cloud_provider=aws
-
- # Kubernetes cluster deployment variables. The config file path and name has to be provided in case
- # the cluster has already been created.
- k8s:
- region: "cluster_region"
- context: "cluster_context"
- config_file: "cluster_config"
+ ordererAddress: orderer3.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- # Hashicorp Vault server address and root-token. Vault should be unsealed.
- # Do not check-in root_token
- vault:
- url: "vault_addr"
- root_token: "vault_root_token"
- secret_path: "secretsv2"
- # Git Repo details which will be used by GitOps/Flux.
- # Do not check-in git_access_token
- gitops:
- git_protocol: "https" # Option for git over https or ssh
- git_url: "https://github.com//bevel.git" # Gitops https or ssh url for flux value files
- branch: "develop" # Git branch where release is being made
- release_dir: "platforms/hyperledger-fabric/releases/dev" # Relative Path in the Git repo for flux sync per environment.
- chart_source: "platforms/hyperledger-fabric/charts" # Relative Path where the Helm charts are stored in Git repo
- git_repo: "github.com//bevel.git" # Gitops git repository URL for git push (without https://)
- username: "git_username" # Git Service user who has rights to check-in in all branches
- password: "git_access_token" # Git Server user password/token (Optional for ssh; Required for https)
- email: "git@email.com" # Email to use in git config
- private_key: "path_to_private_key" # Path to private key file which has write-access to the git repo (Optional for https; Required for ssh)
-
- # The participating nodes are peers
- # This organization hosts it's own CA server
- services:
- ca:
- name: ca
- subject: "/C=CH/ST=Zurich/L=Zurich/O=Manufacturer/CN=ca.manufacturer-net.org2proxy.blockchaincloudpoc.com"
- type: ca
- grpc:
- port: 7054
peers:
- peer:
- name: peer0
- type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
- gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
- peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/manufacturer/peer0.crt # Path to peer Certificate
- cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
+ name: peer0
+ type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
+ gossippeeraddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
+ peerAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # External URI of the peer
+ cli: enabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
- port: 7051
+ port: 7051
events:
port: 7053
couchdb:
port: 5984
- restserver: # This is for the rest-api server
+ restserver:
targetPort: 20001
- port: 20001
- expressapi: # This is for the express api server
+ port: 20001
+ expressapi:
+ targetPort: 3000
+ port: 3000
+ - peer:
+ name: peer1
+ type: nonanchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
+ gossippeeraddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # External address of the existing anchor peer
+ peerAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # External URI of the peer
+ cli: enabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
+ grpc:
+ port: 7051
+ events:
+ port: 7053
+ couchdb:
+ port: 5984
+ restserver:
+ targetPort: 20001
+ port: 20001
+ expressapi:
targetPort: 3000
port: 3000
- chaincodes:
- - name: "chaincode_name" #This has to be replaced with the name of the chaincode
- version: "1" #This has to be replaced with the version of the chaincode
- maindirectory: "chaincode_main" #The main directory where chaincode is needed to be placed
- lang: "golang" # The language in which the chaincode is written ( golang/ java)
- repository:
- username: "git_username" # Git Service user who has rights to check-in in all branches
- password: "git_access_token"
- url: "github.com//bevel-samples.git"
- branch: main
- path: "chaincode_src" #The path to the chaincode
- arguments: 'chaincode_args' #Arguments to be passed along with the chaincode parameters
- endorsements: "" #Endorsements (if any) provided along with the chaincode
- organization:
name: carrier
@@ -378,12 +358,10 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com
certificate: /path/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -421,7 +399,7 @@ network:
services:
ca:
name: ca
- subject: "/C=GB/ST=London/L=London/O=Carrier/CN=ca.carrier-net.org3proxy.blockchaincloudpoc.com"
+ subject: "/C=GB/ST=London/L=London/O=Carrier"
type: ca
grpc:
port: 7054
@@ -431,7 +409,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -464,12 +441,11 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
+
external_url_suffix: org4proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.store-net.org4proxy.blockchaincloudpoc.com
certificate: /path/store/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -507,7 +483,7 @@ network:
services:
ca:
name: ca
- subject: "/C=US/ST=New York/L=New York/O=Store/CN=ca.store-net.org4proxy.blockchaincloudpoc.com"
+ subject: "/C=US/ST=New York/L=New York/O=Store"
type: ca
grpc:
port: 7054
@@ -517,7 +493,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.store-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/store/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -551,12 +526,10 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org5proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.warehouse-net.org5proxy.blockchaincloudpoc.com
certificate: /path/warehouse/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -594,7 +567,7 @@ network:
services:
ca:
name: ca
- subject: "/C=US/ST=Massachusetts/L=Boston/O=Warehouse/CN=ca.warehouse-net.org5proxy.blockchaincloudpoc.com"
+ subject: "/C=US/ST=Massachusetts/L=Boston/O=Warehouse"
type: ca
grpc:
port: 7054
@@ -604,7 +577,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.warehouse-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/warehouse/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-ordererorg.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-ordererorg.yaml
index 5b606b1678a..87509e0b6bc 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-ordererorg.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-ordererorg.yaml
@@ -14,7 +14,7 @@ network:
# Network level configuration specifies the attributes required for each organization
# to join an existing network.
type: fabric
- version: 2.2.2 #Addition of ordrer organization only works for 2.2.2
+ version: 2.2.2 #Addition of ordrer organization works for 2.2.2 and 2.5.4
frontend: enabled #Flag for frontend to enabled for nodes/peers
@@ -46,26 +46,24 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "chaincode_name"
orderers:
@@ -80,7 +78,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -90,7 +88,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: warehouse
type: joiner
@@ -100,7 +98,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: manufacturer
type: joiner
@@ -110,7 +108,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -134,8 +132,6 @@ network:
name: peer0
corepeerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
certificate: "/path/manufacturer/server.crt" # certificate path for peer
- genesis:
- name: OrdererGenesis
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -149,11 +145,9 @@ network:
state: London
location: London
subject: "O=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: file/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -211,7 +205,7 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer2
type: orderer
@@ -234,11 +228,9 @@ network:
state: London
location: London
subject: "O=NewOrderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org6proxy.blockchaincloudpoc.com
org_status: new # Status of the organization for the existing network, can be new / existing
ca_data:
- url: ca.neworderer-net.org6proxy.blockchaincloudpoc.com
certificate: file/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -311,12 +303,10 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.manufacturer-net.org2proxy.blockchaincloudpoc.com
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -399,12 +389,10 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -485,12 +473,10 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: org4proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.store-net.org4proxy.blockchaincloudpoc.com
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -571,12 +557,10 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org5proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.warehouse-net.org5proxy.blockchaincloudpoc.com
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-organization.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-organization.yaml
index 4c8853b5923..49fd66c048d 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-organization.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-organization.yaml
@@ -11,7 +11,7 @@ network:
# Network level configuration specifies the attributes required for each organization
# to join an existing network.
type: fabric
- version: 2.2.2 # currently tested 1.4.8 and 2.2.2
+ version: 2.2.2 # currently tested 1.4.8, 2.2.2 and 2.5.4
frontend: enabled #Flag for frontend to enabled for nodes/peers
@@ -47,26 +47,24 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Path of the orderer certificate which must exist
+ uri: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Path of the orderer certificate which must exist
+ uri: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "chaincode_name"
orderers:
@@ -81,7 +79,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: warehouse
type: joiner
@@ -91,7 +89,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: manufacturer
type: joiner
@@ -101,7 +99,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -111,7 +109,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -135,9 +133,7 @@ network:
name: peer0
corepeerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
certificate: /home/bevel/build/manufacturer/server.crt # certificate path for peer
- genesis:
- name: OrdererGenesis
-
+
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
# then these services should be listed in this section as well.
@@ -150,11 +146,9 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: /home/bevel/build/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
aws:
@@ -211,21 +205,21 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer2
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer3
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443
# Specification for the 2nd organization. Each organization maps to a VPC and a separate k8s cluster
- organization:
@@ -234,12 +228,10 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.manufacturer-net.org2proxy.blockchaincloudpoc.com
certificate: /home/bevel/build/manufacturer/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -288,7 +280,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/manufacturer/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -322,12 +313,10 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com
certificate: /home/bevel/build/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -375,7 +364,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -409,12 +397,10 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: org4proxy.blockchaincloudpoc.com
org_status: new # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.store-net.org4proxy.blockchaincloudpoc.com
certificate: /home/bevel/build/store/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -467,7 +453,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.store-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/store/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -500,12 +485,10 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org5proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be new / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.warehouse-net.org5proxy.blockchaincloudpoc.com
certificate: /home/bevel/build/warehouse/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -553,7 +536,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.warehouse-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/warehouse/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml
index 0ce83ed16ea..e847535da4f 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml
@@ -11,7 +11,7 @@ network:
# Network level configuration specifies the attributes required for each organization
# to join an existing network.
type: fabric
- version: 2.2.2 # currently tested 1.4.8 and 2.2.2
+ version: 2.2.2 # currently tested 1.4.8, 2.2.2 and 2.5.4
frontend: enabled #Flag for frontend to enabled for nodes/peers
#Environment section for Kubernetes setup
@@ -42,26 +42,24 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "chaincode_name"
orderers:
@@ -82,9 +80,7 @@ network:
peerstatus: new # new peers should have status as new
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer1.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- genesis:
- name: OrdererGenesis
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -97,12 +93,10 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: existing # org_status must be existing when adding peer
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com # CA Server URL must be public when adding peer on new cluster
certificate: /path/carrier/server.crt # CA Server public cert must be provided when adding peer on new cluster
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -157,7 +151,6 @@ network:
gossippeeraddress: peer1.carrier-net.org3proxy.blockchaincloudpoc.com:443 # No change from original configuration
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
peerstatus: existing # old peers should have status as existing
- certificate: /path/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -190,7 +183,6 @@ network:
gossippeeraddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External address of the existing anchor peer
peerAddress: peer1.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
peerstatus: new # new peers should have status as new
- certificate: /path/carrier/peer1.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -225,11 +217,9 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: existing # org_status must be existing when adding peer
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: /path/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -287,18 +277,18 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer2
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer3
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabric-remove-organization.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabric-remove-organization.yaml
index df1dc6e7c70..1e1d8f22367 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabric-remove-organization.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabric-remove-organization.yaml
@@ -11,7 +11,7 @@ network:
# Network level configuration specifies the attributes required for each organization
# to remove an organization from existing network.
type: fabric
- version: 2.2.2 # currently tested 1.4.8 and 2.2.2
+ version: 2.2.2 # currently tested 1.4.8, 2.2.2 and 2.5.4
frontend: enabled #Flag for frontend to enabled for nodes/peers
@@ -43,25 +43,23 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Path of the orderer certificate which must exist
+ uri: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Path of the orderer certificate which must exist
+ uri: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
+ channel_status: new
channel_name: AllChannel
chaincodes:
- "chaincode_name"
@@ -77,7 +75,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -87,7 +85,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: warehouse
type: joiner
@@ -97,7 +95,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: manufacturer
type: joiner
@@ -107,9 +105,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
- genesis:
- name: OrdererGenesis
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -123,11 +119,9 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be delete / existing
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: /path/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -185,21 +179,21 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer2
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer3
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443
# Specification for the 2nd organization. Each organization maps to a VPC and a separate k8s cluster
- organization:
@@ -208,12 +202,10 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be delete / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.manufacturer-net.org2proxy.blockchaincloudpoc.com
certificate: /path/manufacturer/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -263,7 +255,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/manufacturer/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -297,12 +288,10 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be delete / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com
certificate: /path/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -350,7 +339,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -384,12 +372,10 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: org4proxy.blockchaincloudpoc.com
org_status: delete # Status of the organization for the existing network, can be delete / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.store-net.org4proxy.blockchaincloudpoc.com
certificate: /path/store/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -437,7 +423,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.store-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/store/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
@@ -471,12 +456,10 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org5proxy.blockchaincloudpoc.com
org_status: existing # Status of the organization for the existing network, can be delete / existing
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.warehouse-net.org5proxy.blockchaincloudpoc.com
certificate: /path/warehouse/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -524,7 +507,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.warehouse-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/warehouse/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
grpc:
port: 7051
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-external-chaincode.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-external-chaincode.yaml
index e92ec77618c..a5c451ad8ee 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-external-chaincode.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-external-chaincode.yaml
@@ -11,7 +11,7 @@ network:
# Network level configuration specifies the attributes required for each organization
# to join an existing network.
type: fabric
- version: 2.2.2 # currently tested 1.4.8 and 2.2.2
+ version: 2.2.2 # currently tested 1.4.8, 2.2.2 and 2.5.4
frontend: enabled #Flag for frontend to enabled for nodes/peers
@@ -48,25 +48,23 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt
+ uri: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "assettransfer"
orderers:
@@ -81,7 +79,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -91,7 +89,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: warehouse
type: joiner
@@ -101,7 +99,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: manufacturer
type: joiner
@@ -111,7 +109,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -135,8 +133,6 @@ network:
name: peer0
corepeerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
certificate: "/home/bevel/build/manufacturer/server.crt" # certificate path for peer
- genesis:
- name: OrdererGenesis
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -150,12 +146,10 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: new
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.supplychain-net:7054
certificate: /home/bevel/build/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, minikube
@@ -187,7 +181,7 @@ network:
git_repo: "github.com//bevel.git" # Gitops https URL for git push (without https://)
username: "git_username" # Git Service user who has rights to check-in in all branches
password: "git_access_token" # Git Server user password
- email: "git_email" # Email to use in git config
+ email: "git@email.com" # Email to use in git config
private_key: "path_to_private_key" # Path to private key file which has write-access to the git repo
# Services maps to the pods that will be deployed on the k8s cluster
@@ -230,13 +224,11 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To deploy Fabric console for this organization
ca_data:
- url: ca.manufacturer-net:7054
certificate: /home/bevel/build/manufacturer/server.crt
cloud_provider: aws # Options: aws, azure, gcp, minikube
@@ -268,7 +260,7 @@ network:
git_repo: "github.com//bevel.git" # Gitops https URL for git push (without https://)
username: "git_username" # Git Service user who has rights to check-in in all branches
password: "git_access_token" # Git Server user password
- email: "git_email" # Email to use in git config
+ email: "git@email.com" # Email to use in git config
private_key: "path_to_private_key" # Path to private key file which has write-access to the git repo
# Generating User Certificates with custom attributes using Fabric CA in BAF for Peer Organizations
users:
@@ -292,7 +284,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/manufacturer/peer0.crt # Path to peer Certificate
cli: enabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
configpath: /home/bevel/build/peer0-core.yaml # path to custom core.yaml
grpc:
@@ -310,9 +301,11 @@ network:
chaincodes:
- name: "assettransfer" # This has to be replaced with the name of the chaincode
version: "1" # This has to be replaced with the version of the chaincode
+ sequence: "1" # Sequence of the chaincode, update this only for chaincode upgrade
external_chaincode: true
init_required: false
tls: true
+ upgrade_chaincode: false
buildpack_path: /home/fabric-samples/asset-transfer-basic/chaincode-external/sampleBuilder # The path where buildpacks are locally stored
image: ghcr.io/hyperledger/bevel-samples-example:1.0
arguments: '\"InitLedger\",\"\"' # Init Arguments to be passed which will mark chaincode as init-required
@@ -324,13 +317,11 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.carrier-net:7054
certificate: /home/bevel/build/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp, minikube
@@ -362,7 +353,7 @@ network:
git_repo: "github.com//bevel.git" # Gitops https URL for git push (without https://)
username: "git_username" # Git Service user who has rights to check-in in all branches
password: "git_access_token" # Git Server user password
- email: "git_email" # Email to use in git config
+ email: "git@email.com" # Email to use in git config
private_key: "path_to_private_key" # Path to private key file which has write-access to the git repo
# Generating User Certificates with custom attributes using Fabric CA in Bevel for Peer Organizations
users:
@@ -384,7 +375,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
configpath: /home/bevel/build/peer0-core.yaml # path to custom core.yaml
grpc:
@@ -402,9 +392,11 @@ network:
chaincodes:
- name: "assettransfer" # This has to be replaced with the name of the chaincode
version: "1" # This has to be replaced with the version of the chaincode
+ sequence: "1" # Sequence of the chaincode, update this only for chaincode upgrade
external_chaincode: true
init_required: false
tls: true
+ upgrade_chaincode: false
buildpack_path: /home/fabric-samples/asset-transfer-basic/chaincode-external/sampleBuilder # The path where buildpacks are locally stored
image: ghcr.io/hyperledger/bevel-samples-example:1.0
arguments: '\"InitLedger\",\"\"' # Init Arguments to be passed which will mark chaincode as init-required
@@ -416,13 +408,11 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: org4proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.store-net:7054
certificate: /home/bevel/build/store/server.crt
cloud_provider: aws # Options: aws, azure, gcp, minikube
@@ -454,7 +444,7 @@ network:
git_repo: "github.com//bevel.git" # Gitops https URL for git push (without https://)
username: "git_username" # Git Service user who has rights to check-in in all branches
password: "git_access_token" # Git Server user password
- email: "git_email" # Email to use in git config
+ email: "git@email.com" # Email to use in git config
private_key: "path_to_private_key" # Path to private key file which has write-access to the git repo
# Generating User Certificates with custom attributes using Fabric CA in Bevel for Peer Organizations
users:
@@ -476,7 +466,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.store-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/store/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
configpath: /home/bevel/build/peer0-core.yaml # path to custom core.yaml
grpc:
@@ -494,9 +483,11 @@ network:
chaincodes:
- name: "assettransfer" # This has to be replaced with the name of the chaincode
version: "1" # This has to be replaced with the version of the chaincode
+ sequence: "1" # Sequence of the chaincode, update this only for chaincode upgrade
external_chaincode: true
init_required: false
tls: true
+ upgrade_chaincode: false
buildpack_path: /home/fabric-samples/asset-transfer-basic/chaincode-external/sampleBuilder # The path where buildpacks are locally stored
image: ghcr.io/hyperledger/bevel-samples-example:1.0
arguments: '\"InitLedger\",\"\"' # Init Arguments to be passed which will mark chaincode as init-required
@@ -507,13 +498,11 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org5proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.warehouse-net:7054
certificate: /home/bevel/build/warehouse/server.crt
cloud_provider: aws # Options: aws, azure, gcp, minikube
@@ -545,7 +534,7 @@ network:
git_repo: "github.com//bevel.git" # Gitops https URL for git push (without https://)
username: "git_username" # Git Service user who has rights to check-in in all branches
password: "git_access_token" # Git Server user password
- email: "git_email" # Email to use in git config
+ email: "git@email.com" # Email to use in git config
private_key: "path_to_private_key" # Path to private key file which has write-access to the git repo
services:
@@ -561,7 +550,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.warehouse-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /home/bevel/build/warehouse/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
configpath: /home/bevel/build/peer0-core.yaml # path to custom core.yaml
grpc:
@@ -579,10 +567,11 @@ network:
chaincodes:
- name: "assettransfer" # This has to be replaced with the name of the chaincode
version: "1" # This has to be replaced with the version of the chaincode
+ sequence: "1" # Sequence of the chaincode, update this only for chaincode upgrade
external_chaincode: true
init_required: false
tls: true
- upgrade_chaincode: true
+ upgrade_chaincode: false
buildpack_path: /home/fabric-samples/asset-transfer-basic/chaincode-external/sampleBuilder # The path where buildpacks are locally stored
image: ghcr.io/hyperledger/bevel-samples-example:1.0
arguments: '\"InitLedger\",\"\"' # Init Arguments to be passed which will mark chaincode as init-required
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-kafka.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-kafka.yaml
index 417341e0372..91ff5f125f4 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-kafka.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-kafka.yaml
@@ -51,20 +51,19 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "chaincode_name"
orderers:
@@ -79,7 +78,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -89,7 +88,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.org3proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: warehouse
type: joiner
@@ -99,7 +98,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: manufacturer
type: joiner
@@ -109,9 +108,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
- genesis:
- name: OrdererGenesis
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -125,12 +122,10 @@ network:
state: London
location: London
subject: "O=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: new
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: file/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -191,14 +186,14 @@ network:
consensus: kafka
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer2
type: orderer
consensus: kafka
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443
# Specification for the 2nd organization. Each organization maps to a VPC and a separate k8s cluster
@@ -208,13 +203,11 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.manufacturer-net.org2proxy.blockchaincloudpoc.com
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -297,13 +290,11 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -383,13 +374,11 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.store-net.org3proxy.blockchaincloudpoc.com
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -470,13 +459,11 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.warehouse-net.org2proxy.blockchaincloudpoc.com
certificate: /file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-raft-add-orderer.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-raft-add-orderer.yaml
index 1aaab440b31..37068d00dcc 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-raft-add-orderer.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2-raft-add-orderer.yaml
@@ -11,7 +11,7 @@ network:
# Network level configuration specifies the attributes required for each organization
# to join an existing network.
type: fabric
- version: 2.2.2 # currently tested 1.4.8 and 2.2.2
+ version: 2.2.2 # currently tested 1.4.8, 2.2.2 and 2.5.4
frontend: enabled #Flag for frontend to enabled for nodes/peers
@@ -44,32 +44,29 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer4
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer4.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer4.crt # Ensure that the directory exists
+ uri: orderer4.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "chaincode_name"
orderers:
@@ -84,7 +81,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -94,7 +91,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: warehouse
type: joiner
@@ -104,7 +101,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: manufacturer
type: joiner
@@ -114,9 +111,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
- genesis:
- name: OrdererGenesis
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -130,11 +125,9 @@ network:
state: London
location: London
subject: "O=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: existing
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: /path/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -193,7 +186,7 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer2
status: existing
@@ -201,7 +194,7 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer3
status: existing
@@ -209,7 +202,7 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer4
status: new
@@ -217,4 +210,4 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer4.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer4.supplychain-net.org1proxy.blockchaincloudpoc.com:443
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml
index de34d8340e8..6e54918ce12 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml
@@ -12,7 +12,7 @@ network:
# to join an existing network.
type: fabric
version: 2.2.2 # currently tested 1.4.8, 2.2.2 and 2.5.4
-
+ upgrade: false # true : To upgrading Hyperledger Fabric version from 1.4.x to 2.2.x
frontend: enabled #Flag for frontend to enabled for nodes/peers
#Environment section for Kubernetes setup
@@ -21,9 +21,9 @@ network:
proxy: haproxy # values can be 'haproxy' or 'none'
retry_count: 20 # Retry count for the checks
external_dns: enabled # Should be enabled if using external-dns for automatic route configuration
- annotations: # Additional annotations that can be used for some pods (ca, ca-tools, orderer and peer nodes)
+ labels:
service:
- - example1: example2
+ example1: example2
deployment: {}
pvc: {}
# For providing Custom Templates to generate configtx.yaml
@@ -48,26 +48,24 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
osn_creator_org: # Organization name, whose orderers will create the channel. This field is only used with version 2.5
name: supplychain
chaincodes:
@@ -82,9 +80,26 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Must include port, External or internal URI of the orderer
+ - organization:
+ name: supplychain
+ type: joiner
+ org_status: new
+ peers:
+ - peer:
+ name: peer0
+ type: anchor
+ gossipAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ peerAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ - peer:
+ name: peer1
+ type: nonanchor
+ gossipAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ peerAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -92,9 +107,10 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- organization:
name: warehouse
type: joiner
@@ -102,9 +118,10 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- organization:
name: manufacturer
type: joiner
@@ -112,9 +129,10 @@ network:
peers:
- peer:
name: peer0
+ type: anchor
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -145,8 +163,6 @@ network:
name: peer0
corepeerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
certificate: "/path/store/server.crt" # certificate path for peer
- genesis:
- name: OrdererGenesis
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -160,12 +176,10 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: new
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: /path/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -205,7 +219,7 @@ network:
services:
ca:
name: ca
- subject: "/C=GB/ST=London/L=London/O=Orderer/CN=ca.supplychain-net.org1proxy.blockchaincloudpoc.com"
+ subject: "/C=GB/ST=London/L=London/O=Orderer"
type: ca
grpc:
port: 7054
@@ -222,21 +236,59 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- orderer:
name: orderer2
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
- orderer:
name: orderer3
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer3.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
+
+ peers:
+ - peer:
+ name: peer0
+ type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
+ gossippeeraddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
+ peerAddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # External URI of the peer
+ cli: enabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
+ grpc:
+ port: 7051
+ events:
+ port: 7053
+ couchdb:
+ port: 5984
+ restserver:
+ targetPort: 20001
+ port: 20001
+ expressapi:
+ targetPort: 3000
+ port: 3000
+ - peer:
+ name: peer1
+ type: nonanchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
+ gossippeeraddress: peer0.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # External address of the existing anchor peer
+ peerAddress: peer1.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443 # External URI of the peer
+ cli: enabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
+ grpc:
+ port: 7051
+ events:
+ port: 7053
+ couchdb:
+ port: 5984
+ restserver:
+ targetPort: 20001
+ port: 20001
+ expressapi:
+ targetPort: 3000
+ port: 3000
# Specification for the 2nd organization. Each organization maps to a VPC and a separate k8s cluster
- organization:
@@ -245,13 +297,11 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.manufacturer-net.org2proxy.blockchaincloudpoc.com
certificate: /path/manufacturer/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -297,7 +347,7 @@ network:
services:
ca:
name: ca
- subject: "/C=CH/ST=Zurich/L=Zurich/O=Manufacturer/CN=ca.manufacturer-net.org2proxy.blockchaincloudpoc.com"
+ subject: "/C=CH/ST=Zurich/L=Zurich/O=Manufacturer"
type: ca
grpc:
port: 7054
@@ -307,7 +357,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/manufacturer/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -343,13 +392,11 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com
certificate: /path/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -393,7 +440,7 @@ network:
services:
ca:
name: ca
- subject: "/C=GB/ST=London/L=London/O=Carrier/CN=ca.carrier-net.org3proxy.blockchaincloudpoc.com"
+ subject: "/C=GB/ST=London/L=London/O=Carrier"
type: ca
grpc:
port: 7054
@@ -403,7 +450,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -438,13 +484,11 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: org4proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.store-net.org4proxy.blockchaincloudpoc.com
certificate: /path/store/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -488,7 +532,7 @@ network:
services:
ca:
name: ca
- subject: "/C=US/ST=New York/L=New York/O=Store/CN=ca.store-net.org4proxy.blockchaincloudpoc.com"
+ subject: "/C=US/ST=New York/L=New York/O=Store"
type: ca
grpc:
port: 7054
@@ -498,7 +542,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.store-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/store/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -534,13 +577,11 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org5proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.warehouse-net.org5proxy.blockchaincloudpoc.com
certificate: /path/warehouse/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -584,7 +625,7 @@ network:
services:
ca:
name: ca
- subject: "/C=US/ST=Massachusetts/L=Boston/O=Warehouse/CN=ca.warehouse-net.org5proxy.blockchaincloudpoc.com"
+ subject: "/C=US/ST=Massachusetts/L=Boston/O=Warehouse"
type: ca
grpc:
port: 7054
@@ -594,7 +635,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.warehouse-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/warehouse/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-operator-fabric.yaml b/platforms/hyperledger-fabric/configuration/samples/network-operator-fabric.yaml
index 1cecf912954..628f0cf424c 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-operator-fabric.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-operator-fabric.yaml
@@ -46,26 +46,24 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "not_supported"
orderers:
@@ -80,7 +78,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -90,7 +88,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: warehouse
type: joiner
@@ -100,7 +98,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- organization:
name: manufacturer
type: joiner
@@ -110,7 +108,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -141,8 +139,6 @@ network:
name: peer0
corepeerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443
certificate: "/path/store/server.crt" # certificate path for peer
- genesis:
- name: OrdererGenesis
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -156,12 +152,10 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: org1proxy.blockchaincloudpoc.com
org_status: new
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.supplychain-net.org1proxy.blockchaincloudpoc.com
certificate: /path/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -198,21 +192,21 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer1.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer2
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer2.supplychain-net.org1proxy.blockchaincloudpoc.com:443
- orderer:
name: orderer3
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.org1proxy.blockchaincloudpoc.com:443
+ ordererAddress: orderer3.supplychain-net.org1proxy.blockchaincloudpoc.com:443
# Specification for the 2nd organization. Each organization maps to a VPC and a separate k8s cluster
- organization:
@@ -221,13 +215,11 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: org2proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.manufacturer-net.org2proxy.blockchaincloudpoc.com
certificate: /path/manufacturer/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -264,7 +256,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.manufacturer-net.org2proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/manufacturer/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -299,13 +290,11 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.carrier-net.org3proxy.blockchaincloudpoc.com
certificate: /path/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -340,7 +329,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -374,13 +362,11 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: org4proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.store-net.org4proxy.blockchaincloudpoc.com
certificate: /path/store/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -415,7 +401,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.store-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.store-net.org4proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/store/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -450,13 +435,11 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: org5proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.warehouse-net.org5proxy.blockchaincloudpoc.com
certificate: /path/warehouse/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -491,7 +474,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.warehouse-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.warehouse-net.org5proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
- certificate: /path/warehouse/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-proxy-none.yaml b/platforms/hyperledger-fabric/configuration/samples/network-proxy-none.yaml
index 77e8df9e0d5..ee882785906 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-proxy-none.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-proxy-none.yaml
@@ -43,13 +43,13 @@ network:
name: orderer1
org_name: supplychain # org_name should match one organization definition below in organizations: key
uri: orderer1.supplychain-net:7050 # Internal URI for orderer which should be reachable by all peers
- certificate: /home/bevel/build/orderer1.crt # the directory should be writable
# The channels defined for a network with participating peers in each channel
channels:
- channel:
consortium: SupplyChainConsortium
channel_name: AllChannel
+ channel_status: new
chaincodes:
- "chaincode_name"
orderers:
@@ -91,8 +91,6 @@ network:
name: peer0
corepeerAddress: peer0.manufacturer-net:7051
certificate: "/home/bevel/build/manufacturer/server.crt" # certificate path for peer
- genesis:
- name: OrdererGenesis
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -106,12 +104,10 @@ network:
state: London
location: London
subject: "O=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: develop.local.com # Ignore for proxy none
org_status: new
fabric_console: enabled
ca_data:
- url: ca.supplychain-net:7054
certificate: /home/bevel/build/supplychain/server.crt
cloud_provider: aws # Options: aws, azure, gcp
@@ -179,12 +175,10 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: develop.local.com # Ignore for proxy none
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.manufacturer-net:7054
certificate: /home/bevel/build/manufacturer/server.crt
cloud_provider: aws # Options: aws, azure, gcp
@@ -242,7 +236,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.manufacturer-net:7051 # Internal URI of the peer
- certificate: /home/bevel/build/manufacturer/peer0.crt # Path to peer Certificate
cli: enabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: enabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -279,12 +272,10 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: develop.local.com # Ignore for proxy none
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
ca_data:
- url: ca.carrier-net:7054
certificate: /home/bevel/build/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp
@@ -340,7 +331,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net:7051 # Internal URI of the peer
- certificate: /home/bevel/build/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
diff --git a/platforms/hyperledger-fabric/configuration/samples/network-user-certificate.yaml b/platforms/hyperledger-fabric/configuration/samples/network-user-certificate.yaml
index 1e387def9cf..00896f97978 100644
--- a/platforms/hyperledger-fabric/configuration/samples/network-user-certificate.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/network-user-certificate.yaml
@@ -37,13 +37,11 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: org3proxy.blockchaincloudpoc.com
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
cli: enabled
ca_data:
- url: ca.carrier-net:7054
certificate: file/server.crt
cloud_provider: aws # Options: aws, azure, gcp, minikube
diff --git a/platforms/hyperledger-fabric/configuration/samples/workflow/network-fabric-workflow.yaml b/platforms/hyperledger-fabric/configuration/samples/workflow/network-fabric-workflow.yaml
index ab2b529441e..a4818baaea0 100644
--- a/platforms/hyperledger-fabric/configuration/samples/workflow/network-fabric-workflow.yaml
+++ b/platforms/hyperledger-fabric/configuration/samples/workflow/network-fabric-workflow.yaml
@@ -48,20 +48,17 @@ network:
type: orderer
name: orderer1
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer1.EXTERNAL_URL_SUFFIX:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: USER_DIRECTORY/build/orderer1.crt # Ensure that the directory exists
+ uri: orderer1.supplychain-net.EXTERNAL_URL_SUFFIX:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer2
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer2.EXTERNAL_URL_SUFFIX:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: USER_DIRECTORY/build/orderer2.crt # Ensure that the directory exists
+ uri: orderer2.supplychain-net.EXTERNAL_URL_SUFFIX:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- orderer:
type: orderer
name: orderer3
org_name: supplychain #org_name should match one organization definition below in organizations: key
- uri: orderer3.EXTERNAL_URL_SUFFIX:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
- certificate: USER_DIRECTORY/build/orderer3.crt # Ensure that the directory exists
+ uri: orderer3.supplychain-net.EXTERNAL_URL_SUFFIX:443 # Must include port, Can be external or internal URI for orderer which should be reachable by all peers
# The channels defined for a network with participating peers in each channel
channels:
@@ -84,7 +81,7 @@ network:
name: peer0
gossipAddress: peer0.carrier-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External or internal URI of the gossip peer
peerAddress: peer0.carrier-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.EXTERNAL_URL_SUFFIX:443 # Must include port, External or internal URI of the orderer
+ ordererAddress: orderer1.supplychain-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External or internal URI of the orderer
- organization:
name: store
type: joiner # joiner organization will only join the channel and install chaincode
@@ -94,7 +91,7 @@ network:
name: peer0
gossipAddress: peer0.store-net.EXTERNAL_URL_SUFFIX:443
peerAddress: peer0.store-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.EXTERNAL_URL_SUFFIX:443
+ ordererAddress: orderer1.supplychain-net.EXTERNAL_URL_SUFFIX:443
- organization:
name: warehouse
type: joiner
@@ -104,7 +101,7 @@ network:
name: peer0
gossipAddress: peer0.warehouse-net.EXTERNAL_URL_SUFFIX:443
peerAddress: peer0.warehouse-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.EXTERNAL_URL_SUFFIX:443
+ ordererAddress: orderer1.supplychain-net.EXTERNAL_URL_SUFFIX:443
- organization:
name: manufacturer
type: joiner
@@ -114,7 +111,7 @@ network:
name: peer0
gossipAddress: peer0.manufacturer-net.EXTERNAL_URL_SUFFIX:443
peerAddress: peer0.manufacturer-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- ordererAddress: orderer1.EXTERNAL_URL_SUFFIX:443
+ ordererAddress: orderer1.supplychain-net.EXTERNAL_URL_SUFFIX:443
endorsers:
# Only one peer per org required for endorsement
- organization:
@@ -145,8 +142,6 @@ network:
name: peer0
corepeerAddress: peer0.store-net.EXTERNAL_URL_SUFFIX:443
certificate: "USER_DIRECTORY/store/server.crt" # certificate path for peer
- genesis:
- name: OrdererGenesis
# Allows specification of one or many organizations that will be connecting to a network.
# If an organization is also hosting the root of the network (e.g. doorman, membership service, etc),
@@ -160,12 +155,10 @@ network:
state: London
location: London
subject: "O=Orderer,OU=Orderer,L=51.50/-0.13/London,C=GB"
- type: orderer
external_url_suffix: EXTERNAL_URL_SUFFIX
org_status: new
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.supplychain-net.EXTERNAL_URL_SUFFIX
certificate: USER_DIRECTORY/supplychain/server.crt # Path where ca public cert will be stored (if new) or read from (if existing ca)
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -222,21 +215,21 @@ network:
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer1.EXTERNAL_URL_SUFFIX:443
+ ordererAddress: orderer1.supplychain-net.EXTERNAL_URL_SUFFIX:443
- orderer:
name: orderer2
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer2.EXTERNAL_URL_SUFFIX:443
+ ordererAddress: orderer2.supplychain-net.EXTERNAL_URL_SUFFIX:443
- orderer:
name: orderer3
type: orderer
consensus: raft
grpc:
port: 7050
- ordererAddress: orderer3.EXTERNAL_URL_SUFFIX:443
+ ordererAddress: orderer3.supplychain-net.EXTERNAL_URL_SUFFIX:443
# Specification for the 2nd organization. Each organization maps to a VPC and a separate k8s cluster
- organization:
@@ -245,13 +238,11 @@ network:
state: Zurich
location: Zurich
subject: "O=Manufacturer,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH"
- type: peer
external_url_suffix: EXTERNAL_URL_SUFFIX
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: enabled # To deploy Fabric console for this organization
ca_data:
- url: ca.manufacturer-net.EXTERNAL_URL_SUFFIX
certificate: USER_DIRECTORY/manufacturer/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -307,7 +298,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.manufacturer-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.manufacturer-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- certificate: USER_DIRECTORY/manufacturer/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -343,13 +333,11 @@ network:
state: London
location: London
subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
- type: peer
external_url_suffix: EXTERNAL_URL_SUFFIX
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.carrier-net
certificate: USER_DIRECTORY/carrier/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -403,7 +391,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.carrier-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.carrier-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- certificate: USER_DIRECTORY/carrier/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -438,13 +425,11 @@ network:
state: New York
location: New York
subject: "O=Store,OU=Store,L=40.73/-74/New York,C=US"
- type: peer
external_url_suffix: EXTERNAL_URL_SUFFIX
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.store-net
certificate: USER_DIRECTORY/store/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -498,7 +483,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.store-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.store-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- certificate: USER_DIRECTORY/store/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
@@ -534,13 +518,11 @@ network:
state: Massachusetts
location: Boston
subject: "O=Warehouse,OU=Warehouse,L=42.36/-71.06/Boston,C=US"
- type: peer
external_url_suffix: EXTERNAL_URL_SUFFIX
org_status: new
orderer_org: supplychain # Name of the organization that provides the ordering service
fabric_console: disabled # To not deploy Fabric console for this organization
ca_data:
- url: ca.warehouse-net
certificate: USER_DIRECTORY/warehouse/server.crt
cloud_provider: aws # Options: aws, azure, gcp, digitalocean, minikube
@@ -594,7 +576,6 @@ network:
type: anchor # This can be anchor/nonanchor. Atleast one peer should be anchor peer.
gossippeeraddress: peer0.warehouse-net:7051 # Internal Address of the other peer in same Org for gossip, same peer if there is only one peer
peerAddress: peer0.warehouse-net.EXTERNAL_URL_SUFFIX:443 # Must include port, External URI of the peer
- certificate: USER_DIRECTORY/warehouse/peer0.crt # Path to peer Certificate
cli: disabled # Creates a peer cli pod depending upon the (enabled/disabled) tag.
cactus_connector: disabled # set to enabled to create a cactus connector for Fabric
grpc:
diff --git a/platforms/hyperledger-indy/charts/README.md b/platforms/hyperledger-indy/charts/README.md
index cd44972df0d..d0255bf7122 100644
--- a/platforms/hyperledger-indy/charts/README.md
+++ b/platforms/hyperledger-indy/charts/README.md
@@ -3,40 +3,154 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-# Charts for Indy components
+# Charts for Hyperledger Indy components
## About
-This folder contains helm charts which are used by the ansible playbooks for the deployment of the component. Each chart folder contain a folder for templates, chart file and the corresponding value file.
+This folder contains the helm charts which are used for the deployment of the Hyperledger Indy components. Each helm chart that you can use has the following keys and you need to set them. The `global.cluster.provider` is used as a key for the various cloud features to be enabled. Also you only need to specify one cloud provider, **not** both if deploying to cloud. As of writing this doc, AWS ans Azure is fully supported.
-## Example Folder Structure ###
+```yaml
+global:
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # future: set to true to use Cloud Native Services
+ kubernetesUrl: "https://kubernetes.url" # Provide the k8s URL, ignore if not using Hashicorp Vault
+ vault:
+ type: hashicorp # choose from hashicorp | kubernetes
+ network: indy # must be indy for these charts
+ # Following are necessary only when hashicorp vault is used.
+ address: "http://vault.url:8200"
+ authPath: authority
+ secretEngine: secretsv2
+ secretPrefix: "data/authority"
+ role: vault-role
```
-/indy-node
-|-- templates
-| |--_helpers.tpl
-| |-- volumes.yaml
-| |-- deployment.yaml
-| |-- service.yaml
-|-- Chart.yaml
-|-- values.yaml
+
+## Usage
+
+### Pre-requisites
+
+- Kubernetes Cluster (either Managed cloud option like EKS or local like minikube)
+- Accessible and unsealed Hahsicorp Vault (if using Vault)
+- Configured Ambassador AES (if using Ambassador as proxy)
+- Update the dependencies
+ ```
+ helm dependency update indy-key-mgmt
+ helm dependency update indy-node
+ ```
+
+### _Without Proxy or Vault_
+
+> **Important:** As Indy nodes need IP Address, the no-proxy option works only with minikube or cluster with 1 node in nodepool.
+
+Replace the `publicIp` in all the files in `./values/noproxy-and-novault/` folder with the IP address of your Minikube or the single node in your Cloud Cluster.
+
+For Indy, the keys need to be created first for each organisation
+```bash
+# Create keys for first trustee
+helm install authority-keys ./indy-key-mgmt --namespace authority-ns --create-namespace --values ./values/noproxy-and-novault/authority-keys.yaml
+# Create keys for endorser and stewards from another org namespace
+helm install university-keys ./indy-key-mgmt --namespace university-ns --create-namespace --values ./values/noproxy-and-novault/university-keys.yaml
+
+# Get the public keys from Kubernetes for genesis
+cd ../scripts/genesis
+chmod +x get_keys.sh
+./get_keys.sh
+
+cd ../../charts
+# Update the IP address and Ports in ./values/noproxy-and-novault/genesis.yaml
+helm install genesis ./indy-genesis --namespace authority-ns --values ./values/noproxy-and-novault/genesis.yaml
+
+# Get the genesis files from existing authority and place in indy-genesis/files
+cd ./indy-genesis/files/
+kubectl --namespace authority-ns get configmap dtg -o jsonpath='{.data.domain_transactions_genesis}' > domain_transactions_genesis.json
+kubectl --namespace authority-ns get configmap ptg -o jsonpath='{.data.pool_transactions_genesis}' > pool_transactions_genesis.json
+
+# Run secondary genesis
+cd ../..
+helm install genesis ./indy-genesis --namespace university-ns --values ./values/noproxy-and-novault/genesis-sec.yaml
+
+# Then deploy the stewards
+helm install university-steward-1 ./indy-node --namespace university-ns --values ./values/noproxy-and-novault/steward.yaml
+helm install university-steward-2 ./indy-node --namespace university-ns --values ./values/noproxy-and-novault/steward.yaml --set settings.node.externalPort=30021 --set settings.client.externalPort=30022 --set settings.node.port=30021 --set settings.client.port=30022
+helm install university-steward-3 ./indy-node --namespace university-ns --values ./values/noproxy-and-novault/steward.yaml --set settings.node.externalPort=30031 --set settings.client.externalPort=30032 --set settings.node.port=30031 --set settings.client.port=30032
+
+# Get endorser public keys
+cd ./indy-register-identity/files
+kubectl --namespace university-ns get secret university-endorser-identity-public -o jsonpath='{.data.value}' | base64 -d | jq '.["did"]'> university-endorser-did.json
+kubectl --namespace university-ns get secret university-endorser-node-public-verif-keys -o jsonpath='{.data.value}' | base64 -d | jq '.["verification-key"]' > university-endorser-verkey.json
+# Register the endorser identity using the trustee's credentials
+# Deploy the endorser identity registration Helm chart in the authority namespace, where the trustee resides
+cd ../..
+helm install university-endorser-id ./indy-register-identity --namespace authority-ns
+```
+
+### _With Ambassador proxy and Vault_
+Replace the `global.vault.address`, `global.cluster.kubernetesUrl` and `publicIp` of your Ambassador Loadbalancer in all the files in `./values/proxy-and-vault/` folder.
+
+For Indy, the keys need to be created first for each organisation
+```bash
+kubectl create namespace authority-ns # if the namespace does not exist already
+# Create the roottoken secret
+kubectl -n authority-ns create secret generic roottoken --from-literal=token=
+
+kubectl create namespace university-ns # if the namespace does not exist already
+# Create the roottoken secret
+kubectl -n university-ns create secret generic roottoken --from-literal=token=
+
+# Create keys for first trustee
+helm install authority-keys ./indy-key-mgmt --namespace authority-ns --values ./values/proxy-and-vault/authority-keys.yaml
+# Create keys for endorser and stewards from another org namespace
+helm install university-keys ./indy-key-mgmt --namespace university-ns --values ./values/proxy-and-vault/university-keys.yaml
+
+# Get the public keys from Kubernetes for genesis
+cd ../scripts/genesis
+chmod +x get_keys.sh
+./get_keys.sh
+
+cd ../../charts
+# Update the IP address and Ports in ./values/proxy-and-vault/genesis.yaml
+helm install genesis ./indy-genesis --namespace authority-ns --values ./values/proxy-and-vault/genesis.yaml
+
+# Get the genesis files from existing authority and place in indy-genesis/files
+cd ./indy-genesis/files/
+kubectl --namespace authority-ns get configmap dtg -o jsonpath='{.data.domain_transactions_genesis}' > domain_transactions_genesis.json
+kubectl --namespace authority-ns get configmap ptg -o jsonpath='{.data.pool_transactions_genesis}' > pool_transactions_genesis.json
+
+# Run secondary genesis
+cd ../..
+helm install genesis ./indy-genesis --namespace university-ns --values ./values/proxy-and-vault/genesis-sec.yaml
+
+# Then deploy the stewards
+helm install university-steward-1 ./indy-node --namespace university-ns --values ./values/proxy-and-vault/steward.yaml
+helm install university-steward-2 ./indy-node --namespace university-ns --values ./values/proxy-and-vault/steward.yaml --set settings.node.externalPort=15021 --set settings.client.externalPort=15022
+helm install university-steward-3 ./indy-node --namespace university-ns --values ./values/proxy-and-vault/steward.yaml --set settings.node.externalPort=15031 --set settings.client.externalPort=15032
+helm install university-steward-4 ./indy-node --namespace university-ns --values ./values/proxy-and-vault/steward.yaml --set settings.node.externalPort=15041 --set settings.client.externalPort=15042
+
+# Get endorser public keys
+cd ./indy-register-identity/files
+kubectl --namespace university-ns get secret university-endorser-identity-public -o jsonpath='{.data.value}' | base64 -d | jq '.["did"]'> university-endorser-did.json
+kubectl --namespace university-ns get secret university-endorser-node-public-verif-keys -o jsonpath='{.data.value}' | base64 -d | jq '.["verification-key"]' > university-endorser-verkey.json
+# Register the endorser identity using the trustee's credentials
+# Deploy the endorser identity registration Helm chart in the authority namespace, where the trustee resides
+cd ../..
+helm install university-endorser-id ./indy-register-identity --namespace authority-ns
```
-## Pre-requisites
-
- Helm to be installed and configured
-
-## Charts description ##
-
-### 1. indy-auth-job ###
-- This folder contains chart templates and default values for creation of indy authotization job.
-### 2. indy-cli ###
-- This folder contains chart templates and default values for creation of indy cli.
-### 4. indy-domain-genesis ###
-- This folder contains chart templates and default values for creation of indy domain genesis.
-### 5. indy-key-mgmt ###
-- This folder contains chart templates and default values for creation of indy key management.
-### 6. indy-ledger-txn ###
-- This folder contains chart templates and default values for creation of indy ledger txn.
-### 7. indy-node ###
-- This folder contains chart templates and default values for creation of indy node.
-### 8. indy-pool-genesis ###
-- This folder contains chart templates and default values for creation of indy pool genesis.
+### Clean-up
+
+To clean up, simply uninstall the Helm charts.
+> **NOTE**: It's important to uninstall the genesis Helm chart at the end to prevent any cleanup failure.
+
+```bash
+helm uninstall --namespace university-ns university-steward-1
+helm uninstall --namespace university-ns university-steward-2
+helm uninstall --namespace university-ns university-steward-3
+helm uninstall --namespace university-ns university-steward-4
+helm uninstall --namespace university-ns university-keys
+helm uninstall --namespace university-ns genesis
+
+helm uninstall --namespace authority-ns university-endorser-id
+helm uninstall --namespace authority-ns authority-keys
+helm uninstall --namespace authority-ns genesis
+```
diff --git a/platforms/hyperledger-indy/charts/indy-auth-job/Chart.yaml b/platforms/hyperledger-indy/charts/indy-auth-job/Chart.yaml
deleted file mode 100644
index 8308f3148df..00000000000
--- a/platforms/hyperledger-indy/charts/indy-auth-job/Chart.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: v1
-appVersion: "2.0"
-description: "hyperledger-indy: Creates an indy authorization job"
-name: indy-auth-job
-version: 1.0.0
diff --git a/platforms/hyperledger-indy/charts/indy-auth-job/README.md b/platforms/hyperledger-indy/charts/indy-auth-job/README.md
deleted file mode 100644
index 6f21d33bba8..00000000000
--- a/platforms/hyperledger-indy/charts/indy-auth-job/README.md
+++ /dev/null
@@ -1,187 +0,0 @@
-[//]: # (##############################################################################################)
-[//]: # (Copyright Accenture. All Rights Reserved.)
-[//]: # (SPDX-License-Identifier: Apache-2.0)
-[//]: # (##############################################################################################)
-
-
-# indy-auth-job
-
-- [indy-auth-job Helm Chart](#indy-auth-node-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
-
-
-## indy-auth-job Helm Chart
----
-This [Helm chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-auth-job) helps to deploy indy authorization job.
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-indy-auth-job/
- |- templates/
- |- helpers.tpl
- |- job.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: This directory contains the template files for generating Kubernetes resources.
-- `_helpers.tpl`: Contains custom label definitions used in other templates.
-- `job.yaml`: This file provides information about the kubernetes job
-- `Chart.yaml`: Provides metadata about the chart, such as its name, version, and description.
-- `README.md`: This file provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the chart. It includes configuration for the metadata, image, node, Vault, etc.
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-auth-job/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-## Parameters
----
-### metadata
-
-| Name | Description | Default Value |
-| ----------------| ----------------------------------------------- | ------------- |
-| namespace | Provide the namespace for organization's peer | bevel |
-| name | Provide the name for indy-auth-job release | indy-auth-job |
-
-
-### network
-
-| Name | Description | Default Value |
-| ------------ | ------------------------------------| ---------------------- |
-| name | Provide the name of the network | bevel |
-| kubernetes_url | Provide the kubernetes host url | https://10.3.8.5:6443 |
-
-### image
-
-| Name | Description | Default Value |
-| -------- | ----------------------------------------------------------- | ------------- |
-| name | Provide the image name for the indy-auth-job container | indy-auth-job |
-| repository | Provide the image repoitory for the indy-auth-job container | alpine:3.9. 4 |
-
-
-### vault
-
-| Name | Description | Default Value |
-| ----------------- | ----------------------------------| -----------------------------------------|
-| address | Provide the vault server address | http://54.226.163.39:8200 |
-| identity | Provide the vault identity | my-identity |
-| admin_auth_path | Provide the admin authpath | kubernetes-bevel-provider-admin-auth |
-| policy | Provide the vault policy name | bevel-provider-steward-1-ro |
-| policy_content | Provide the vault policy content | path "/kv/{{ organization }} |
-| auth_path | Provide the authpath | kubernetes-bevel-provider-steward-1-auth |
-
-### account
-
-| Name | Description | Default Value |
-| --------------| --------------------------------------- | --------------------------------------|
-| admin_service | Provide the admin service account name | |
-| admin_role | Provide the admin service account role | bevel-provider-admin-vault-auth |
-| service | Provide the service account name | rw |
-| role | Provide the service account role | provider-steward-1-vault-auth |
-
-
-
-## Deployment
----
-
-To deploy the indy-auth-job Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-auth-job/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./indy-auth-job
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the indy auth job to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the jobs, we can use the following command:
-```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the job was created. The command will display information about the jobs.
-
-
-
-## Updating the job
----
-
-If we need to update the job with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-auth-job/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./indy-auth-job
-```
-Replace `` with the name of the release. This command will apply the changes to the job , ensuring the job is up to date.
-
-
-
-## Deletion
----
-
-To delete the jobs and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
-
-
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [INDY authorization job Helm Chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-auth-job), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
-
-
-
-## License
-
-This chart is licensed under the Apache v2.0 license.
-
-Copyright © 2023 Accenture
-
-### Attribution
-
-This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
-
-```
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-```
diff --git a/platforms/hyperledger-indy/charts/indy-auth-job/templates/_helpers.tpl b/platforms/hyperledger-indy/charts/indy-auth-job/templates/_helpers.tpl
deleted file mode 100644
index d43c09d8cef..00000000000
--- a/platforms/hyperledger-indy/charts/indy-auth-job/templates/_helpers.tpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
diff --git a/platforms/hyperledger-indy/charts/indy-auth-job/templates/job.yaml b/platforms/hyperledger-indy/charts/indy-auth-job/templates/job.yaml
deleted file mode 100644
index 87f20ad739a..00000000000
--- a/platforms/hyperledger-indy/charts/indy-auth-job/templates/job.yaml
+++ /dev/null
@@ -1,90 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: batch/v1
-kind: Job
-metadata:
- name: "{{ $.Values.metadata.name }}"
- namespace: "{{ $.Values.metadata.namespace }}"
- labels:
- app: "{{ $.Values.metadata.name }}"
-spec:
- template:
- metadata:
- labels:
- app: "{{ $.Values.metadata.name }}"
- spec:
- restartPolicy: OnFailure
- imagePullSecrets:
- - name: "{{ $.Values.image.pullSecret }}"
- serviceAccountName: {{ $.Values.account.admin_service }}
- containers:
- - name: "{{ $.Values.image.name }}"
- image: "{{ $.Values.image.repository }}"
- imagePullPolicy: IfNotPresent
- command:
- - "sh"
- - "-c"
- - >
- apk update && apk add curl git jq;
-
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.15.1/bin/linux/amd64/kubectl;
-
- chmod u+x kubectl && mv kubectl /bin/kubectl;
-
-
- validateVaultResponse () {
- if [ ${1} != 200 -a ${1} != 204 ]; then
- echo "ERROR: Unable to retrieve. Http status: ${1}"
- exit 1
- fi
- };
-
- export KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token);
- export KUBE_CERT=$(cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt);
-
- export VAULT_SA_NAME=$(kubectl get sa {{ $.Values.account.service }} -n {{ $.Values.metadata.namespace }} -o jsonpath="{.secrets[*]['name']}");
-
- export SA_JWT_TOKEN=$(kubectl get secret $VAULT_SA_NAME -n {{ $.Values.metadata.namespace }} -o jsonpath="{.data.token}" | base64 -d; echo)
-
- VAULT_TOKEN="$(curl --request POST --data '{"jwt": "'"$KUBE_TOKEN"'", "role": "{{ $.Values.account.admin_role }}"}' -s -k {{ $.Values.vault.address }}/v1/auth/{{ $.Values.vault.admin_auth_path }}/login | jq -r '.auth.client_token')";
-
- export SA_CA_CRT_ONELINE=$(kubectl get secret $VAULT_SA_NAME -n {{ $.Values.metadata.namespace }} -o jsonpath="{.data['ca\.crt']}" | base64 -d | awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}');
-
-
- # Create auth
-
- curl --header "X-Vault-Token: $VAULT_TOKEN" --request POST --data '{"type": "kubernetes"}' {{ $.Values.vault.address }}/v1/sys/auth/{{ $.Values.vault.auth_path }};
-
- curl --header "X-Vault-Token: $VAULT_TOKEN" --request POST --data '{"kubernetes_host": "{{ $.Values.network.kubernetes_url }}", "kubernetes_ca_cert": "'"$SA_CA_CRT_ONELINE"'","disable_iss_validation": "true"}' -s -k {{ $.Values.vault.address }}/v1/auth/{{ $.Values.vault.auth_path }}/config;
-
- # Check auth
-
- response_status=$(curl -s -o /dev/null -w "%{http_code}" --header "X-Vault-Token: $VAULT_TOKEN" {{ $.Values.vault.address }}/v1/auth/{{ $.Values.vault.auth_path }}/config);
-
- validateVaultResponse ${response_status};
-
-
- # Create policy
-
- curl --header "X-Vault-Token: $VAULT_TOKEN" --request PUT --data '{"policy": "{{ $.Values.vault.policy_content }}"}' {{ $.Values.vault.address }}/v1/sys/policy/{{ $.Values.vault.policy }};
-
- # Check policy
-
- response_status=$(curl -s -o /dev/null -w "%{http_code}" --header "X-Vault-Token: $VAULT_TOKEN" {{ $.Values.vault.address }}/v1/sys/policy/{{ $.Values.vault.policy }});
-
- validateVaultResponse ${response_status};
-
-
- # Create role
-
- curl -s -o /dev/null -w "%{http_code}" --header "X-Vault-Token: $VAULT_TOKEN" --request POST --data '{"bound_service_account_names": "{{ $.Values.account.service }}","bound_service_account_namespaces": "{{ $.Values.metadata.namespace }}","policies": ["{{ $.Values.vault.policy }}"], "ttl": 3600}' {{ $.Values.vault.address }}/v1/auth/{{ $.Values.vault.auth_path }}/role/{{ $.Values.account.role }};
-
- # Check role
-
- response_status=$(curl -s -o /dev/null -w "%{http_code}" --header "X-Vault-Token: $VAULT_TOKEN" {{ $.Values.vault.address }}/v1/auth/{{ $.Values.vault.auth_path }}/role/{{ $.Values.account.role }});
-
- validateVaultResponse ${response_status};
diff --git a/platforms/hyperledger-indy/charts/indy-auth-job/values.yaml b/platforms/hyperledger-indy/charts/indy-auth-job/values.yaml
deleted file mode 100644
index e71a32594ca..00000000000
--- a/platforms/hyperledger-indy/charts/indy-auth-job/values.yaml
+++ /dev/null
@@ -1,79 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-# Default values for indy-auth-job.
-# This is a YAML-formatted file.
-# Declare variables to be passed into your templates.
-
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: bevel
- namespace:
-
- #Provide the name for indy-auth-job release
- #Eg. name: indy-auth-job
- name:
-
-network:
- #Provide the name for network
- #Eg. name: bevel
- name:
-
- #Provide the kubernetes host url
- #Eg. kubernetes_url: https://10.3.8.5:6443
- kubernetes_url:
-
-image:
- #Provide the image name for the indy-auth-job container
- #Eg. name: indy-auth-job
- name:
-
- #Provide the image repoitory for the indy-auth-job container
- #Eg. repository: alpine:3.9.4
- repository:
-
-
-vault:
- #Provide the vault server address
- #Eg. address: http://54.226.163.39:8200
- address:
-
- #Provide the vault identity
- #Eg. identity: my-identity
- identity:
-
- #Provide the admin authpath
- #Eg. admin_auth_path: kubernetes-bevel-provider-admin-auth
- admin_auth_path:
-
- #Provide the vault policy name
- #Eg. policy: bevel-provider-steward-1-ro
- policy:
-
- #Provide the vault policy content
- #Eg. policy_content: path "/kv/{{ organization }}/bevel-ac/+/+/+/public*" {capabilities = [ "read", "list" ]}
- policy_content:
-
- #Provide the authpath
- #Eg. authpath: kubernetes-bevel-provider-steward-1-auth
- auth_path:
-
-account:
- #Provide the admin service account name
- #Eg. admin_service: bevel-provider-admin-vault-auth
- admin_service:
-
- #Provide the admin service account role
- #Eg. admin_role: rw
- admin_role:
-
- #Provide the service account name
- #Eg. service: provider-steward-1-vault-auth
- service:
-
- #Provide the service account role
- #Eg. role: ro
- role:
diff --git a/platforms/hyperledger-indy/charts/indy-cli/README.md b/platforms/hyperledger-indy/charts/indy-cli/README.md
deleted file mode 100644
index 987b5ea6923..00000000000
--- a/platforms/hyperledger-indy/charts/indy-cli/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-[//]: # (##############################################################################################)
-[//]: # (Copyright Accenture. All Rights Reserved.)
-[//]: # (SPDX-License-Identifier: Apache-2.0)
-[//]: # (##############################################################################################)
-
-# Hyperledger Bevel Indy indy-cli Helm chart
diff --git a/platforms/hyperledger-indy/charts/indy-domain-genesis/Chart.yaml b/platforms/hyperledger-indy/charts/indy-domain-genesis/Chart.yaml
deleted file mode 100644
index a38c2a093cf..00000000000
--- a/platforms/hyperledger-indy/charts/indy-domain-genesis/Chart.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: v1
-appVersion: "2.0"
-description: "hyperledger-indy: Creates config map for domain transactions genesis"
-name: indy-domain-genesis
-version: 1.0.0
-
diff --git a/platforms/hyperledger-indy/charts/indy-domain-genesis/README.md b/platforms/hyperledger-indy/charts/indy-domain-genesis/README.md
deleted file mode 100644
index 64aead47c26..00000000000
--- a/platforms/hyperledger-indy/charts/indy-domain-genesis/README.md
+++ /dev/null
@@ -1,156 +0,0 @@
-[//]: # (##############################################################################################)
-[//]: # (Copyright Accenture. All Rights Reserved.)
-[//]: # (SPDX-License-Identifier: Apache-2.0)
-[//]: # (##############################################################################################)
-
-
-# indy-domain-genesis
-
-- [indy-domain-genesis Helm Chart](#indy-node-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-job)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
-
-
-## indy-domain-genesis Helm Chart
----
-This [Helm chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-domain-genesis) helps to deploy the indy-domain-genesis job.
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- Helm installed.
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-indy-domain-genesis/
- |- templates/
- |- _helpers.tpl
- |- configmap.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: This directory contains the template files for generating Kubernetes resources.
-- `_helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: This file provides information about the kubernetes configmap job
-- `Chart.yaml`: Provides metadata about the chart, such as its name, version, and description.
-- `README.md`: This file provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the chart. It includes configuration for the metadata, image, node, Vault, etc.
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-domain-genesis/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-## Parameters
----
-### metadata
-
-| Name | Description | Default Value |
-| ----------------| ----------------------------------------------- | --------------------|
-| namespace | Provide the namespace for organization's peer | bevel |
-| name | Provide the name for indy-domain-genesis release | indy-domain-genesis |
-
-
-### organization
-
-| Name | Description | Default Value |
-| ----------------| -------------------------------------------------| ------------- |
-| name | Provide the namespace for organization's peer | provider |
-| configmap | Provide the name for organization | configmap |
-
-
-## Deployment
----
-
-To deploy the indy-domain-genesis job Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-domain-genesis/values.yam) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./indy-domain-genesis
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the indy-domain-genesis job to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the jobs, we can use the following command:
-```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the job was created. The command will display information about the jobs.
-
-
-
-## Updating the Deployment
----
-
-If we need to update the job with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-domain-genesis/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./indy-domain-genesis
-```
-Replace `` with the name of the release. This command will apply the changes to the job , ensuring the job is up to date.
-
-
-
-## Deletion
----
-
-To delete the jobs and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
-
-
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [INDY authorization job Helm Chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-auth-job), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
-
-
-
-## License
-
-This chart is licensed under the Apache v2.0 license.
-
-Copyright © 2023 Accenture
-
-### Attribution
-
-This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
-
-```
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-```
diff --git a/platforms/hyperledger-indy/charts/indy-domain-genesis/templates/_helpers.tpl b/platforms/hyperledger-indy/charts/indy-domain-genesis/templates/_helpers.tpl
deleted file mode 100644
index d43c09d8cef..00000000000
--- a/platforms/hyperledger-indy/charts/indy-domain-genesis/templates/_helpers.tpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
diff --git a/platforms/hyperledger-indy/charts/indy-domain-genesis/templates/configmap.yaml b/platforms/hyperledger-indy/charts/indy-domain-genesis/templates/configmap.yaml
deleted file mode 100644
index 160d30479b5..00000000000
--- a/platforms/hyperledger-indy/charts/indy-domain-genesis/templates/configmap.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: {{ $.Values.organization.name }}-dtg
- namespace: {{ $.Values.metadata.namespace }}
- labels:
- app.kubernetes.io/name: {{ $.Values.organization.name }}-dtg
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/instance: {{ .Release.Name }}
-data:
- domain_transactions_genesis: |
- {{ $.Values.configmap.domainGenesis | nindent 6 }}
diff --git a/platforms/hyperledger-indy/charts/indy-domain-genesis/values.yaml b/platforms/hyperledger-indy/charts/indy-domain-genesis/values.yaml
deleted file mode 100644
index 24acff6fc9b..00000000000
--- a/platforms/hyperledger-indy/charts/indy-domain-genesis/values.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-# Default values for indy-domain-genesis.
-# This is a YAML-formatted file.
-# Declare variables to be passed into your templates.
-
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: bevel
- namespace:
-
- #Provide the name for indy-domain-genesis release
- #Eg. name: indy-domain-genesis
- name:
-
-organization:
- #Provide the name for organization
- #Eg. name: provider
- name:
-
- configmap:
- #Provide the domain Genesis
- #Eg. domainGenesis: |-
- # {"reqSignature":{},"txn":{"data":{"alias":"authority-trustee","dest":"68N4MNTN9K9cQJQhz4pKA2","role":"0","verkey":"3o5EVpzadvVYzT7X4sy1uD1d9zrRptQ72YiipCVyHroW"},"metadata":{},"type":"1"},"txnMetadata":{"seqNo":1},"ver":"1"}
- # {"reqSignature":{},"txn":{"data":{"alias":"provider-steward-1","dest":"JerLtFwVmp8f4LS6tdTDwA","role":"2","verkey":"Ad2wXywwt8NiBDXhQU6am2CVHbHyYRRY38HCxATE7pzz"},"metadata":{"from":"68N4MNTN9K9cQJQhz4pKA2"},"type":"1"},"txnMetadata":{"seqNo":2},"ver":"1"}
- # {"reqSignature":{},"txn":{"data":{"alias":"provider-steward-2","dest":"4M286TT2qVTSWn2i7d6Ggg","role":"2","verkey":"2pkLP55RVqjwPPZvRyrMXNasNxkGfvUuHs2sXgpvjgLv"},"metadata":{"from":"68N4MNTN9K9cQJQhz4pKA2"},"type":"1"},"txnMetadata":{"seqNo":3},"ver":"1"}
- # {"reqSignature":{},"txn":{"data":{"alias":"partner-steward-1","dest":"Rsn88jsgAGSyABaB8b73V4","role":"2","verkey":"EZN4GQMvFhUv7jqDbf3Q7aow9Yb7JcKgidfSTR8zbsp5"},"metadata":{"from":"68N4MNTN9K9cQJQhz4pKA2"},"type":"1"},"txnMetadata":{"seqNo":4},"ver":"1"}
- # {"reqSignature":{},"txn":{"data":{"alias":"partner-steward-2","dest":"8QrUxhXHb7v63D2PPwdZr3","role":"2","verkey":"53HWJHMUDFEaVwRLk8awK9meoatqZrqiyNsJqHP3M6sN"},"metadata":{"from":"68N4MNTN9K9cQJQhz4pKA2"},"type":"1"},"txnMetadata":{"seqNo":5},"ver":"1"}
- domainGenesis:
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/Chart.yaml b/platforms/hyperledger-indy/charts/indy-genesis/Chart.yaml
new file mode 100644
index 00000000000..c40d3ec1ac6
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/Chart.yaml
@@ -0,0 +1,26 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+apiVersion: v1
+name: indy-genesis
+description: "Hyperledger Indy: Genesis generator"
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - identity
+ - indy
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/README.md b/platforms/hyperledger-indy/charts/indy-genesis/README.md
new file mode 100644
index 00000000000..f09e349d304
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/README.md
@@ -0,0 +1,125 @@
+[//]: # (##############################################################################################)
+[//]: # (Copyright Accenture. All Rights Reserved.)
+[//]: # (SPDX-License-Identifier: Apache-2.0)
+[//]: # (##############################################################################################)
+
+# indy-genesis
+
+This chart is a component of Hyperledger Bevel. The indy-genesis chart creates the domain_transactions_genesis and pool_transaction_genesis files as Kubernetes config maps for Indy network. If enabled, the genesis files are then stored on the configured vault. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
+
+> **Important**: All the public key files should already be placed in `files` before installing this chart. Check **Prerequisites**.
+
+## TL;DR
+
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install genesis bevel/indy-genesis
+```
+
+## Prerequisites
+
+- Kubernetes 1.19+
+- Helm 3.2.0+
+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
+
+Before running indy-genesis, the public key information for each trustee and steward should be saved in the `files` directory. For example, given a trustee called `authority-trustee` and a steward called `university-steward-1`, run the following commands to save the public key info.
+
+> **Important**: The [indy-key-mgmt](../indy-key-mgmt/README.md) chart generates these keys, so should be installed before this chart.
+
+```bash
+cd files
+# trustee files are in authority-ns namespace
+trustee_namespace=authority-ns
+trustee_name=authority-trustee
+kubectl --namespace $trustee_namespace get secret $trustee_name-identity-public -o jsonpath='{.data.value}' | base64 -d | jq '.["did"]'> $trustee_name-did.json
+kubectl --namespace $trustee_namespace get secret $trustee_name-node-public-verif-keys -o jsonpath='{.data.value}' | base64 -d | jq '.["verification-key"]' > $trustee_name-verkey.json
+
+# steward files are in university-ns namespace
+steward_namespace=university-ns
+steward_name=university-steward-1
+kubectl --namespace $steward_namespace get secret $steward_name-identity-public -o jsonpath='{.data.value}' | base64 -d | jq '.["did"]'> $steward_name-did.json
+kubectl --namespace $steward_namespace get secret $steward_name-node-public-verif-keys -o jsonpath='{.data.value}' | base64 -d | jq '.["verification-key"]' > $steward_name-verkey.json
+kubectl --namespace $steward_namespace get secret $steward_name-node-public-bls-keys -o jsonpath='{.data.value}' | base64 -d | jq '.["bls-key-pop"]' > $steward_name-blspop.json
+kubectl --namespace $steward_namespace get secret $steward_name-node-public-bls-keys -o jsonpath='{.data.value}' | base64 -d | jq '.["bls-public-key"]' > $steward_name-blspub.json
+```
+
+## Installing the Chart
+
+To install the chart with the release name `genesis`:
+
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install genesis bevel/indy-genesis
+```
+
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
+
+> **Tip**: List all releases using `helm list`
+
+## Uninstalling the Chart
+
+To uninstall/delete the `genesis` deployment:
+
+```bash
+helm uninstall genesis
+```
+
+The command removes all the Kubernetes components associated with the chart and deletes the release.
+
+## Parameters
+
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS or minikube. Currently ony `aws`, `azure` and `minikube` is tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.network` | Network type that is being deployed | `indy` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `authority` |
+| `global.vault.secretEngine` | The value for vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | The value for vault secret prefix which must start with `data/` | `data/authority` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.alpineutils` | Alpine utils image repository | `ghcr.io/hyperledger/bevel-alpine-ext:latest` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
+
+### Settings
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`settings.removeGenesisOnDelete` | Setting to delete the genesis configmaps when uninstalling the release | `true` |
+| `settings.secondaryGenesis` | Flag to copy genesis and static nodes from `files` for secondary members | `false` |
+| `settings.trustees` | Array of trustees and the relatedß stewards with IP and port details | `- name: authority-trustee`
`stewards:`
`- name: university-steward-1`
`publicIp:`
`clientPort: 15011`
`nodePort: 15012` |
+
+## License
+
+This chart is licensed under the Apache v2.0 license.
+
+Copyright © 2024 Accenture
+
+### Attribution
+
+This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
+
+```
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+```
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/files/readme.txt b/platforms/hyperledger-indy/charts/indy-genesis/files/readme.txt
new file mode 100644
index 00000000000..672160e2f49
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/files/readme.txt
@@ -0,0 +1 @@
+This is a dummy file. Place the public key files in this folder.
\ No newline at end of file
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/templates/_helpers.tpl b/platforms/hyperledger-indy/charts/indy-genesis/templates/_helpers.tpl
new file mode 100644
index 00000000000..34fc4d9e2cb
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/templates/_helpers.tpl
@@ -0,0 +1,28 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "indy-genesis.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "indy-genesis.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "indy-genesis.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/templates/configmap.yaml b/platforms/hyperledger-indy/charts/indy-genesis/templates/configmap.yaml
new file mode 100644
index 00000000000..07526145207
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/templates/configmap.yaml
@@ -0,0 +1,64 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+{{- if .Values.settings.secondaryGenesis }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: dtg
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/instance: {{ $.Release.Name }}
+data:
+ domain_transactions_genesis: |-
+ {{ .Files.Get "files/domain_transactions_genesis.json" | nindent 8 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: ptg
+ namespace: {{ .Release.Namespace }}
+ labels:
+ app.kubernetes.io/instance: {{ $.Release.Name }}
+data:
+ pool_transactions_genesis: |-
+ {{ .Files.Get "files/pool_transactions_genesis.json" | nindent 8 }}
+{{- else }}
+{{- range .Values.settings.trustees }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ .name }}-keys
+ namespace: {{ $.Release.Namespace }}
+ labels:
+ app.kubernetes.io/instance: {{ $.Release.Name }}
+data:
+ did: |
+{{ $.Files.Get (printf "files/%s-did.json" .name) | replace "\"" "" | indent 4 }}
+ verkey: |
+{{ $.Files.Get (printf "files/%s-verkey.json" .name) | replace "\"" "" | indent 4 }}
+{{- range .stewards }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ .name }}-keys
+ namespace: {{ $.Release.Namespace }}
+ labels:
+ app.kubernetes.io/instance: {{ $.Release.Name }}
+data:
+ did: |
+{{ $.Files.Get (printf "files/%s-did.json" .name) | replace "\"" "" | indent 4 }}
+ verkey: |
+{{ $.Files.Get (printf "files/%s-verkey.json" .name) | replace "\"" "" | indent 4 }}
+ blspop: |
+{{ $.Files.Get (printf "files/%s-blspop.json" .name) | replace "\"" "" | indent 4 }}
+ blspub: |
+{{ $.Files.Get (printf "files/%s-blspub.json" .name) | replace "\"" "" | indent 4 }}
+{{- end -}}
+{{- end }}
+{{- end }}
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/templates/genesis-cleanup.yaml b/platforms/hyperledger-indy/charts/indy-genesis/templates/genesis-cleanup.yaml
new file mode 100644
index 00000000000..0aa3b2032e6
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/templates/genesis-cleanup.yaml
@@ -0,0 +1,57 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ include "indy-genesis.name" . }}-cleanup
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-weight: "0"
+ helm.sh/hook: "pre-delete"
+ helm.sh/hook-delete-policy: "hook-succeeded"
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-genesis-cleanup
+ app.kubernetes.io/component: genesis-cleanup
+ app.kubernetes.io/part-of: {{ include "indy-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+spec:
+ backoffLimit: 5
+ template:
+ metadata:
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-genesis-cleanup
+ app.kubernetes.io/component: genesis-cleanup
+ app.kubernetes.io/part-of: {{ include "indy-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ restartPolicy: Never
+ imagePullSecrets:
+ {{- if .Values.image.pullSecret }}
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ containers:
+ - name: genesis-cleanup
+ image: {{ .Values.image.alpineutils }}
+ imagePullPolicy: IfNotPresent
+ command: ["sh", "-c"]
+ args:
+ - |
+{{- if .Values.settings.removeGenesisOnDelete }}
+ if kubectl get configmap --namespace {{ $.Release.Namespace }} dtg &> /dev/null; then
+ kubectl delete configmap --namespace {{ $.Release.Namespace }} dtg
+ fi
+ if kubectl get configmap --namespace {{ $.Release.Namespace }} ptg &> /dev/null; then
+ kubectl delete configmap --namespace {{ $.Release.Namespace }} ptg
+ fi
+{{- end }}
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/templates/genesis-job.yaml b/platforms/hyperledger-indy/charts/indy-genesis/templates/genesis-job.yaml
new file mode 100644
index 00000000000..9bff0c1fbf3
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/templates/genesis-job.yaml
@@ -0,0 +1,159 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ include "indy-genesis.name" . }}
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-delete-policy: "hook-succeeded"
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-genesis-job
+ app.kubernetes.io/component: genesis-job
+ app.kubernetes.io/part-of: {{ include "indy-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+spec:
+ backoffLimit: 5
+ template:
+ metadata:
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-genesis-job
+ app.kubernetes.io/component: genesis-job
+ app.kubernetes.io/part-of: {{ include "indy-genesis.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ restartPolicy: OnFailure
+ imagePullSecrets:
+ {{- if .Values.image.pullSecret }}
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ containers:
+ - name: genesis
+ image: {{ .Values.image.alpineutils }}
+ imagePullPolicy: IfNotPresent
+ volumeMounts:
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
+ env:
+ - name: VAULT_ADDR
+ value: "{{ .Values.global.vault.address }}"
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: KUBERNETES_AUTH_PATH
+ value: "{{ .Values.global.vault.authPath }}"
+ - name: VAULT_APP_ROLE
+ value: "{{ .Values.global.vault.role }}"
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
+ {{- end }}
+ command: ["sh", "-c"]
+ args:
+ - |
+
+ #!/bin/bash
+{{- if .Values.settings.secondaryGenesis }}
+ echo "Secondary Genesis, config maps are created from local files."
+{{- else }}
+ domain_genesis=""
+ first_global_trustee_did=""
+ seqNo=1
+ pool_genesis=""
+ pseqNo=1
+ {{- range .Values.settings.trustees }}
+ echo "Trustee: {{ .name }}"
+ trustee_did=$(kubectl get configmap {{ .name }}-keys -o jsonpath='{.data.did}')
+ trustee_verkey=$(kubectl get configmap {{ .name }}-keys -o jsonpath='{.data.verkey}')
+ if [ -z "$first_global_trustee_did" ]
+ then
+ first_global_trustee_did="${trustee_did}"
+ JSON_STRING=$( jq -n -c \
+ --arg trustee_did "${trustee_did}" \
+ --arg trustee_verkey "${trustee_verkey}" \
+ --arg seqNo $seqNo \
+ --arg alias "{{ .name }}" \
+ '{"reqSignature":{},"txn":{"data":{"alias":$alias,"dest":$trustee_did,"role":"0","verkey":$trustee_verkey},"metadata":{},"type":"1"},"txnMetadata":{"seqNo":$seqNo|tonumber},"ver":"1"}')
+ else
+ JSON_STRING=$( jq -n -c \
+ --arg trustee_did "${trustee_did}" \
+ --arg trustee_verkey "${trustee_verkey}" \
+ --arg first_global_trustee_did "${first_global_trustee_did}" \
+ --arg seqNo $seqNo \
+ --arg alias "{{ .name }}" \
+ '{"reqSignature":{},"txn":{"data":{"alias":$alias,"dest":$trustee_did,"role":"0","verkey":$trustee_verkey},"metadata":{"from":$first_global_trustee_did},"type":"1"},"txnMetadata":{"seqNo":$seqNo|tonumber},"ver":"1"}')
+ fi
+ seqNo=$((seqNo + 1))
+ domain_genesis="${domain_genesis}${JSON_STRING}\n"
+
+ {{- range .stewards }}
+ echo "Steward: {{ .name }}"
+ steward_did=$(kubectl get configmap {{ .name }}-keys -o jsonpath='{.data.did}')
+ steward_verkey=$(kubectl get configmap {{ .name }}-keys -o jsonpath='{.data.verkey}')
+
+ JSON_STRING=$( jq -n -c \
+ --arg steward_did "${steward_did}" \
+ --arg trustee_did "${trustee_did}" \
+ --arg steward_verkey "${steward_verkey}" \
+ --arg seqNo $seqNo \
+ --arg alias "{{ .name }}" \
+ '{"reqSignature":{},"txn":{"data":{"alias":$alias,"dest":$steward_did,"role":"2","verkey":$steward_verkey},"metadata":{"from":$trustee_did},"type":"1"},"txnMetadata":{"seqNo":$seqNo|tonumber},"ver":"1"}')
+
+ seqNo=$((seqNo + 1))
+ domain_genesis="${domain_genesis}${JSON_STRING}\n"
+
+ bls_key=$(kubectl get configmap {{ .name }}-keys -o jsonpath='{.data.blspub}')
+ bls_key_pop=$(kubectl get configmap {{ .name }}-keys -o jsonpath='{.data.blspop}')
+ txn_id=$(echo {{ .name }} | sha256sum | awk '{print $1}')
+ json=$( jq -n -c \
+ --arg alias "{{ .name }}" \
+ --arg blskey "${bls_key}" \
+ --arg blskey_pop "${bls_key_pop}" \
+ --arg client_ip "{{ .publicIp }}" \
+ --arg client_port {{ .clientPort }} \
+ --arg node_ip "{{ .publicIp }}" \
+ --arg node_port {{ .nodePort }} \
+ --arg type "VALIDATOR" \
+ --arg dest "${steward_verkey}" \
+ --arg from "${steward_did}" \
+ --arg seqNo ${pseqNo} \
+ --arg txnId "${txn_id}" \
+ '{"reqSignature":{},"txn":{"data":{"data":{"alias":$alias,"blskey":$blskey,"blskey_pop":$blskey_pop,"client_ip":$client_ip,"client_port":$client_port|tonumber,"node_ip":$node_ip,"node_port":$node_port|tonumber,"services":[$type]},"dest":$dest},"metadata":{"from":$from},"type":"0"},"txnMetadata":{"seqNo":$seqNo|tonumber,"txnId":$txnId},"ver":"1"}')
+
+ pool_genesis="${pool_genesis}${json}\n"
+ pseqNo=$((pseqNo + 1))
+ {{- end }}
+ {{- end }}
+
+ echo -e "${domain_genesis}"
+ kubectl create configmap --namespace {{ .Release.Namespace }} dtg --from-literal=domain_transactions_genesis="$(echo -e $domain_genesis)"
+ echo -e "${pool_genesis}"
+ kubectl create configmap --namespace {{ .Release.Namespace }} ptg --from-literal=pool_transactions_genesis="$(echo -e $pool_genesis)"
+{{- end }}
+ volumes:
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ defaultMode: 0777
+ {{- end }}
+ - name: package-manager
+ configMap:
+ name: package-manager
+ defaultMode: 0777
diff --git a/platforms/hyperledger-indy/charts/indy-genesis/values.yaml b/platforms/hyperledger-indy/charts/indy-genesis/values.yaml
new file mode 100644
index 00000000000..d6e17fbdbf9
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-genesis/values.yaml
@@ -0,0 +1,68 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+# Default values for indy-genesis.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+---
+# The following are for overriding global values
+global:
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented now
+ vault:
+ #Provide the type of vault
+ type: kubernetes # hashicorp | kubernetes
+ #Provide the vault role used.
+ role: vault-role
+ #Provide the network type
+ network: indy
+ #Provide the vault server address
+ address:
+ #Provide the vault authPath configured to be used.
+ authPath: authority
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/authority"
+
+image:
+ #Provide the image for the job container
+ #Eg. alpineutils: ghcr.io/hyperledger/bevel-alpine-ext:latest
+ alpineutils: ghcr.io/hyperledger/bevel-alpine-ext:latest
+ #Provide the secret to use if private repository
+ #Eg. pullSecret: regcred
+ pullSecret:
+
+settings:
+ # Flag to ensure the genesis configmaps are removed on helm uninstall
+ removeGenesisOnDelete: true
+ # Flag to copy domain and pool genesis from files for secondary members
+ secondaryGenesis: false
+ # Provide the steward details by following trustee tree as per example below
+ trustees:
+ - name: authority-trustee
+ stewards:
+ - name: university-steward-1 # Steward name
+ publicIp: # Steward public IP Address /Kubernetes API IP for noproxy
+ nodePort: 15011 # Node external port
+ clientPort: 15012 # Client external port
+ # - name: university-steward-2
+ # publicIp:
+ # nodePort: 15021
+ # clientPort: 15022
+ # - name: partner-trustee
+ # stewards:
+ # - name: partner-steward-1
+ # publicIp:
+ # nodePort: 15031
+ # clientPort: 15032
+ # - name: partner-steward-2
+ # publicIp:
+ # nodePort: 15041
+ # clientPort: 15042
diff --git a/platforms/hyperledger-indy/charts/indy-key-mgmt/Chart.yaml b/platforms/hyperledger-indy/charts/indy-key-mgmt/Chart.yaml
index ccae66eba31..5b7e293fb62 100644
--- a/platforms/hyperledger-indy/charts/indy-key-mgmt/Chart.yaml
+++ b/platforms/hyperledger-indy/charts/indy-key-mgmt/Chart.yaml
@@ -5,7 +5,22 @@
##############################################################################################
apiVersion: v1
-appVersion: "2.0"
-description: "hyperledger-indy: indy-key-mgmt"
name: indy-key-mgmt
-version: 1.0.0
+description: "hyperledger Indy: Keys generator"
+version: 1.1.0
+appVersion: latest
+keywords:
+ - bevel
+ - identity
+ - indy
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-indy/charts/indy-key-mgmt/README.md b/platforms/hyperledger-indy/charts/indy-key-mgmt/README.md
index a6b009f4cfd..b1990cf5b82 100644
--- a/platforms/hyperledger-indy/charts/indy-key-mgmt/README.md
+++ b/platforms/hyperledger-indy/charts/indy-key-mgmt/README.md
@@ -3,170 +3,89 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
# indy-key-mgmt
-- [indy-key-mgmt Helm Chart](#indy-node-deployment-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-job)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
-
-
-## indy-key-mgmt Helm Chart
----
-This [Helm chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-key-mgmt) helps to deploy the indy-key-mgmt job.
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
+This chart is a component of Hyperledger Bevel. The indy-key-mgmt chart generates the various keys needed for a Hyperledger Indy node. If enabled, the keys are then stored on the configured vault and stored as Kubernetes secrets. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for details.
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
+## TL;DR
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install authority-keys bevel/indy-key-mgmt
```
-indy-key-mgmt/
- |- templates/
- |- _helpers.tpl
- |- configmap.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: This directory contains the template files for generating Kubernetes resources.
-- `_helpers.tpl`: Contains custom label definitions used in other templates.
-- `configmap.yaml`: This file provides information about the kubernetes configmap job
-- `Chart.yaml`: Provides metadata about the chart, such as its name, version, and description.
-- `README.md`: This file provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the chart. It includes configuration for the metadata, image, node, Vault, etc.
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-key-mgmt/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-## Parameters
----
-### metadata
-
-| Name | Description | Default Value |
-| ----------------| ----------------------------------------------- | ----------------|
-| namespace | Provide the namespace for organization's peer | bevel |
-| name | Provide the name for indy-key-mgmt release | indy-key-mgmt |
-
-### network
-
-| Name | Description | Default Value |
-| ----------------| ----------------------------------------------- | ------------- |
-| name | Provide the name for network | bevel |
-
-### image
-| Name | Description | Default Value |
-| ----------------| ----------------------------------------------------------- | ----------------|
-| name | Provide the image name for the indy-key-mgmt container | indy-key-mgmt |
-| repository | Provide the image repository for the indy-key-mgmt container | ind-key-mgmt:lts|
-| pullSecret | Provide the image pull secret of image | regcred |
-
-### vault
-
-| Name | Description | Default Value |
-| ---------------- | ------------------------------------------- | ------------- |
-| address | Provide the vault server address | http://54.226.163.39:8200 |
-| version | Provide the vault secret version address | "1 or 2" |
-| keyPath | Provide the key path for vault | provider.stewards |
-| identity | Provide the identity for vault | my-identity |
-| auth_path | Provide the authpath | kubernetes-bevel-provider-admin-auth |
-| certsecretprefix | Provide the vault path where the certificates are stored | secret/organisation-name |
-| retries | Provide The amount of times to retry fetching from/writing to Vault before giving up | "10" |
-| sleepTimeAfterError | The amount of time in seconds to wait after an error occurs when fetching from/writing to Vault"" | "15" |
+## Prerequisites
+- Kubernetes 1.19+
+- Helm 3.2.0+
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
-### account
-
-| Name | Description | Default Value |
-| --------| --------------------------------- | ------------- |
-| service | Provide the service account name | vault-auth-provider-agent-app |
-| role |Provide the service account role | ro |
-
-
-
-## Deployment
----
-
-To deploy the indy-key-mgmt job Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-key-mgmt/values.yam) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./indy-key-mgmt
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the indy-key-mgmt job to the Kubernetes cluster based on the provided configurations.
+> **Important**: Also check the dependent charts.
+## Installing the Chart
-
-## Verification
----
+To install the chart with the release name `authority-keys`:
-To verify the jobs, we can use the following command:
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install authority-keys bevel/indy-key-mgmt
```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the job was created. The command will display information about the jobs.
-
-
-## Updating the deployment
----
+The command deploys the chart on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
-If we need to update the job with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-key-mgmt/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./indy-key-mgmt
-```
-Replace `` with the name of the release. This command will apply the changes to the job , ensuring the job is up to date.
+> **Tip**: List all releases using `helm list`
+## Uninstalling the Chart
-
-## Deletion
----
+To uninstall/delete the `authority-keys` deployment:
-To delete the jobs and associated resources, run the following Helm command:
-```
-$ helm uninstall
+```bash
+helm uninstall authority-keys
```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
+The command removes all the Kubernetes components associated with the chart and deletes the release.
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [INDY authorization job Helm Chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-auth-job), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
+## Parameters
+### Global parameters
+These parameters are refered to as same in each parent or child chart
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`global.serviceAccountName` | The serviceaccount name that will be created for Vault Auth and k8S Secret management| `vault-auth` |
+| `global.cluster.provider` | Kubernetes cluster provider like AWS EKS, AKS or minikube. Currently ony `aws`, `azure` and `minikube` is tested | `aws` |
+| `global.cluster.cloudNativeServices` | only `false` is implemented, `true` to use Cloud Native Services (SecretsManager and IAM for AWS; KeyVault & Managed Identities for Azure) is for future | `false` |
+| `global.cluster.kubernetesUrl` | URL of the Kubernetes Cluster | `""` |
+| `global.vault.type` | Type of Vault to support other providers. Currently, only `hashicorp` and `kubernetes` is supported. | `hashicorp` |
+| `global.vault.role` | Role used for authentication with Vault | `vault-role` |
+| `global.vault.network` | Network type that is being deployed | `indy` |
+| `global.vault.address`| URL of the Vault server. | `""` |
+| `global.vault.authPath` | Authentication path for Vault | `authority` |
+| `global.vault.secretEngine` | The value for vault secret engine name | `secretsv2` |
+| `global.vault.secretPrefix` | The value for vault secret prefix which must start with `data/` | `data/authority` |
+
+### Image
+
+| Name | Description | Default Value |
+| -------------| ---------- | --------- |
+| `image.keyUtils` | Indy Key Gen image repository for the Indy version | `ghcr.io/hyperledger/bevel-indy-key-mgmt:1.12.6` |
+| `image.pullSecret` | Secret name in the namespace containing private image registry credentials | `""` |
+
+### Settings
+
+| Name | Description | Default Value |
+|--------|---------|-------------|
+|`settings.removeKeysOnDelete` | Setting to delete the keys when uninstalling the release | `true` |
+| `settings.identities.trustee` | Single trustee identity to be created for the organization. Set to empty if not needed | `authority-trustee` |
+| `settings.identities.endorser` | Single endorser identity to be created for the organization. Set to empty if not needed | `""` |
+| `settings.identities.stewards` | Array of steward identities to be created for the orgnaization. Set to empty if not needed | `[]` |
-
## License
This chart is licensed under the Apache v2.0 license.
-Copyright © 2023 Accenture
+Copyright © 2024 Accenture
### Attribution
diff --git a/platforms/hyperledger-indy/charts/indy-key-mgmt/requirements.yaml b/platforms/hyperledger-indy/charts/indy-key-mgmt/requirements.yaml
new file mode 100644
index 00000000000..b1195396c5f
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-key-mgmt/requirements.yaml
@@ -0,0 +1,11 @@
+dependencies:
+ - name: bevel-vault-mgmt
+ repository: "file://../../../shared/charts/bevel-vault-mgmt"
+ tags:
+ - bevel
+ version: ~1.0.0
+ - name: bevel-scripts
+ repository: "file://../../../shared/charts/bevel-scripts"
+ tags:
+ - bevel
+ version: ~1.0.0
diff --git a/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/_helpers.tpl b/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/_helpers.tpl
index d43c09d8cef..0d54910e220 100644
--- a/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/_helpers.tpl
+++ b/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/_helpers.tpl
@@ -1,5 +1,28 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "indy-key-mgmt.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "indy-key-mgmt.fullname" -}}
+{{- $name := default .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "indy-key-mgmt.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/job-cleanup.yaml b/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/job-cleanup.yaml
new file mode 100644
index 00000000000..61ba3d89a37
--- /dev/null
+++ b/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/job-cleanup.yaml
@@ -0,0 +1,114 @@
+##############################################################################################
+# Copyright Accenture. All Rights Reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+##############################################################################################
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ include "indy-key-mgmt.name" . }}-cleanup
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-weight: "0"
+ helm.sh/hook: "pre-delete"
+ helm.sh/hook-delete-policy: "hook-succeeded"
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-key-mgmt-cleanup
+ app.kubernetes.io/component: key-mgmt-cleanup
+ app.kubernetes.io/part-of: {{ include "indy-key-mgmt.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+spec:
+ backoffLimit: 3
+ completions: 1
+ template:
+ metadata:
+ labels:
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-key-mgmt-cleanup
+ app.kubernetes.io/component: key-mgmt-cleanup
+ app.kubernetes.io/part-of: {{ include "indy-key-mgmt.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
+ spec:
+ restartPolicy: Never
+ imagePullSecrets:
+ {{- if .Values.image.pullSecret }}
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
+ containers:
+ - name: cleanup-keys
+ image: {{ .Values.image.keyUtils }}
+ imagePullPolicy: IfNotPresent
+ volumeMounts:
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
+ command: ["/bin/bash", "-c"]
+ args:
+ - |
+
+ # Install necessary packages using custom package manager script
+ . /scripts/package-manager.sh
+ packages_to_install="curl"
+ install_packages "$packages_to_install"
+ # Download kubectl binary
+ curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.27.0/bin/linux/amd64/kubectl;
+ chmod u+x kubectl && mv kubectl /usr/local/bin/kubectl;
+
+ #function to delete kubernetes secrets
+ function deleteAllSecret {
+ identity=$1
+ secretData=$2
+ jq -r 'to_entries[] | "\(.key) \(.value)"' <<< "$secretData" | \
+ while read -r key value; do
+ jq -r 'to_entries[] | "\(.key) \(.value)"' <<< "$value" | \
+ while read -r subkey subvalue; do
+ if [ "$key" == "identity" ]; then
+ # Do not iterate as identity has only 1 level of keys
+ secretName=$(echo "$identity-$key-$subkey" |sed 's/_/-/g')
+ if kubectl get secret --namespace {{ $.Release.Namespace }} $secretName &> /dev/null; then
+ kubectl delete secret --namespace {{ $.Release.Namespace }} $secretName
+ fi
+ else
+ # Otherwise, iterate over next set of key-value pairs
+ jq -r 'to_entries[] | "\(.key) \(.value)"' <<< "$subvalue" | \
+ while read -r key1 value1; do
+ secretName=$(echo "$identity-$key-$subkey-$key1" |sed 's/_/-/g')
+ if kubectl get secret --namespace {{ $.Release.Namespace }} $secretName &> /dev/null; then
+ kubectl delete secret --namespace {{ $.Release.Namespace }} $secretName
+ fi
+ done
+ fi
+ done
+ done
+ }
+
+{{- if .Values.settings.removeKeysOnDelete }}
+ echo "Deleting Kubernetes Secrets"
+ {{- if .Values.settings.identities.trustee }}
+ trustees_json=$(generate_identity {{ .Values.settings.identities.trustee }} trustees)
+ json=$(echo "$trustees_json" | jq -r '.trustees."{{ .Values.settings.identities.trustee }}"')
+ deleteAllSecret "{{ .Values.settings.identities.trustee }}" "$json"
+ {{- end }}
+ {{- if .Values.settings.identities.endorser }}
+ endorsers_json=$(generate_identity {{ .Values.settings.identities.endorser }} endorsers)
+ json=$(echo "$endorsers_json" | jq -r '.endorsers."{{ .Values.settings.identities.endorser }}"')
+ deleteAllSecret "{{ .Values.settings.identities.endorser }}" "$json"
+ {{- end }}
+ {{- range .Values.settings.identities.stewards }}
+ stewards_json=$(generate_identity {{ . }} stewards)
+ json=$(echo "$stewards_json" | jq -r '.stewards."{{ . }}"')
+ deleteAllSecret "{{ . }}" "$json"
+ {{- end }}
+{{- end }}
+ volumes:
+ - name: package-manager
+ configMap:
+ name: package-manager
+ defaultMode: 0777
diff --git a/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/job.yaml b/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/job.yaml
index dd65c746a12..652fffa6af0 100644
--- a/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/job.yaml
+++ b/platforms/hyperledger-indy/charts/indy-key-mgmt/templates/job.yaml
@@ -7,276 +7,172 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: "{{ $.Values.metadata.name }}"
- namespace: "{{ $.Values.metadata.namespace }}"
+ name: {{ include "indy-key-mgmt.name" . }}-job
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ helm.sh/hook-delete-policy: "hook-succeeded"
labels:
- app: "{{ $.Values.metadata.name }}"
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-key-mgmt-job
+ app.kubernetes.io/component: key-mgmt-job
+ app.kubernetes.io/part-of: {{ include "indy-key-mgmt.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
+ backoffLimit: 3
template:
metadata:
labels:
- app: "{{ $.Values.metadata.name }}"
+ app: {{ .Release.Name }}
+ app.kubernetes.io/name: indy-key-mgmt-job
+ app.kubernetes.io/component: key-mgmt-job
+ app.kubernetes.io/part-of: {{ include "indy-key-mgmt.fullname" . }}
+ app.kubernetes.io/namespace: {{ .Release.Namespace }}
+ app.kubernetes.io/release: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: helm
spec:
restartPolicy: OnFailure
imagePullSecrets:
- - name: "{{ $.Values.image.pullSecret }}"
- serviceAccountName: {{ $.Values.account.service }}
+ {{- if .Values.image.pullSecret }}
+ - name: {{ .Values.image.pullSecret }}
+ {{- end }}
+ serviceAccountName: {{ .Values.global.serviceAccountName }}
containers:
- - name: "{{ $.Values.image.name }}"
- image: "{{ $.Values.image.repository }}"
+ - name: generate-keys
+ image: {{ .Values.image.keyUtils }}
imagePullPolicy: IfNotPresent
+ volumeMounts:
+ - name: package-manager
+ mountPath: /scripts/package-manager.sh
+ subPath: package-manager.sh
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: scripts-volume
+ mountPath: /scripts/bevel-vault.sh
+ subPath: bevel-vault.sh
+ env:
+ - name: VAULT_ADDR
+ value: "{{ .Values.global.vault.address }}"
+ - name: VAULT_SECRET_ENGINE
+ value: "{{ .Values.global.vault.secretEngine }}"
+ - name: VAULT_SECRET_PREFIX
+ value: "{{ .Values.global.vault.secretPrefix }}"
+ - name: KUBERNETES_AUTH_PATH
+ value: "{{ .Values.global.vault.authPath }}"
+ - name: VAULT_APP_ROLE
+ value: "{{ .Values.global.vault.role }}"
+ - name: VAULT_TYPE
+ value: "{{ .Values.global.vault.type }}"
+ {{- end }}
command: ["/bin/bash", "-c"]
args:
- - |-
- apt-get update;
- apt-get install curl -y;
- validateVaultResponse () {
- if echo ${2} | grep "errors"; then
- echo "ERROR: unable to retrieve ${1}: ${2}"
- exit 1
- fi
- if [ "$3" == "LOOKUPSECRETRESPONSE" ]
+ - |
+
+ # Install necessary packages using custom package manager script
+ . /scripts/package-manager.sh
+ packages_to_install="curl"
+ install_packages "$packages_to_install"
+ # Download kubectl binary
+ curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.27.0/bin/linux/amd64/kubectl;
+ chmod u+x kubectl && mv kubectl /usr/local/bin/kubectl;
+
+{{- if eq .Values.global.vault.type "hashicorp" }}
+ . /scripts/bevel-vault.sh
+ echo "Getting Vault Token..."
+ vaultBevelFunc "init"
+ # Function to store secrets into Vault as well as K8s
+ function safeWriteSecret {
+ path=$1
+ subpath=$2
+ value=$3
+ secretName=$(echo $subpath | sed 's/\//-/g' |sed 's/_/-/g')
+ vaultBevelFunc "readJson" "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/${path}/${subpath}"
+ if [ "$SECRETS_AVAILABLE" == "yes" ]
then
- http_code=$(curl -sS -o /dev/null -w "%{http_code}" \
- --header "X-Vault-Token: ${VAULT_TOKEN}" \
- ${VAULT_ADDR}/v1/${1})
- curl_response=$?
- if test "$http_code" != "200" ; then
- echo "Http response code from Vault - $http_code"
- if test "$curl_response" != "0"; then
- echo "Error: curl command failed with error code - $curl_response"
- exit 1
- fi
+ # Create the Kubernetes Secret with data from Vault
+ echo "Secret found in Vault, only creating k8s secrets"
+ kubectl get secret --namespace {{ $.Release.Namespace }} "${secretName}"
+ if [ $? -ne 0 ]; then
+ kubectl create secret --namespace {{ $.Release.Namespace }} generic "${secretName}" --from-literal="value=${VAULT_SECRET}"
fi
+ else
+ echo "Secret to be created on Vault and k8s"
+ # Store the value in Vault
+ echo "
+ {
+ \"data\": $value
+ }" > payload.json
+
+ vaultBevelFunc 'write' "${VAULT_SECRET_ENGINE}/${VAULT_SECRET_PREFIX}/${path}/${subpath}" 'payload.json'
+ rm payload.json
+ # Create the Kubernetes Secret using kubectl
+ kubectl create secret --namespace {{ $.Release.Namespace }} generic "${secretName}" --from-literal="value=$value"
fi
}
-
- KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token);
- curl --request POST --data '{"jwt": "'"$KUBE_TOKEN"'", "role": "{{ $.Values.account.role }}"}' {{ $.Values.vault.address }}/v1/auth/{{ $.Values.vault.auth_path }}/login | jq -j '.auth.client_token' > token;
- VAULT_TOKEN=$(cat token);
- response_status=$(curl -o /dev/null -s -w "%{http_code}\n" --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/auth/token/lookup-self)
- validateVaultResponse ${response_status};
-
- {{- if eq $.Values.vault.version "2" }}
- generate_identityv2 {{ $.Values.vault.identity }} {{ $.Values.vault.keyPath }} vault {{ $.Values.vault.address }} 2
- {{- else }}
- generate_identity {{ $.Values.vault.identity }} {{ $.Values.vault.keyPath }} vault {{ $.Values.vault.address }}
- {{- end }}
-
- echo "Check if certs are stored in vault"
- curl --request POST --data '{"jwt": "'"$KUBE_TOKEN"'", "role": "{{ $.Values.account.role }}"}' {{ $.Values.vault.address }}/v1/auth/{{ $.Values.vault.auth_path }}/login | jq -j '.auth.client_token' > token;
- VAULT_TOKEN=$(cat token);
- response_status=$(curl -o /dev/null -s -w "%{http_code}\n" --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/auth/token/lookup-self)
- validateVaultResponse ${response_status};
-
- trustees_path={{ $.Values.vault.certsecretprefix }}/data/trustees
- stewards_path={{ $.Values.vault.certsecretprefix }}/data/stewards
- endorsers_path={{ $.Values.vault.certsecretprefix }}/data/endorsers
-
- client_public_keys=false client_verif_keys=false client_private_keys=false client_sig_keys=false identity_private_keys=false identity_public_keys=false node_verif_keys=false node_bls_keys=false node_public_keys=false node_sig_keys=false node_private_bls_keys=false node_private_keys=false
- COUNTER=1
- while [ ${COUNTER} -lt {{ $.Values.vault.retries }} ]
- do
- # client_public_keys=false client_verif_keys=false client_private_keys=false client_sig_keys=false identity_private_keys=false identity_public_keys=false node_verif_keys=false node_bls_keys=false node_public_keys=false node_sig_keys=false node_private_bls_keys=false node_private_keys=false
-
- for field in $stewards_path $endorsers_path $trustees_path
- do
- if [ "$client_public_keys" == false ]
- then
- # Check if client public keys are stored in vault or not
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/client/public/public_keys | jq -r 'if .errors then . else . end')
- public_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["public_key"]' 2>&1)
- if [ "$public_key" == "null" ] || [ "$public_key" == "parse error"* ]
- then
- client_public_keys=false
- echo "Client public keys are not present in vault"
- else
- client_public_keys=true
- echo "Successfully got client public keys"
- fi
- fi
-
- # Check if client verif keys are stored in vault or not
- if [ "$client_verif_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/client/public/verif_keys | jq -r 'if .errors then . else . end')
- verification_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["verification-key"]' 2>&1)
- if [ "$verification_key" == "null" ] || [ "$verification_key" == "parse error"* ]
- then
- client_verif_keys=false
- echo "Client verif keys are not present in vault"
- else
- client_verif_keys=true
- echo "Successfully got client verification keys"
- fi
- fi
-
- # Check if client private keys are stored in vault or not
- if [ "$client_private_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/client/private/private_keys | jq -r 'if .errors then . else . end')
- private_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["{{ $.Values.vault.identity }}C.key_secret"]' 2>&1)
- if [ "$private_key" == "null" ] || [ "$private_key" == "parse error"* ]
- then
- client_private_keys=false
- echo "Client private keys are not present in vault"
- else
- client_private_keys=true
- echo "Successfully got client private keys"
- fi
- fi
-
- # Check if client sig keys are stored in vault or not
- if [ "$client_sig_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/client/private/sig_keys | jq -r 'if .errors then . else . end')
- sig_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["{{ $.Values.vault.identity }}C.key_secret"]' 2>&1)
- if [ "$sig_key" == "null" ] || [ "$sig_key" == "parse error"* ]
- then
- client_sig_keys=false
- echo "Client sig keys are not present in vault"
- else
- client_sig_keys=true
- echo "Successfully got client private signature keys"
- fi
- fi
-
- # Check if identity private keys are stored in vault or not
- if [ "$identity_private_keys" == false ]
- then
- # Check if identity keys are stored in vault or not
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/identity/private | jq -r 'if .errors then . else . end')
- private_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["seed"]' 2>&1)
- if [ "$private_key" == "null" ] || [ "$private_key" == "parse error"* ]
- then
- identity_private_keys=false
- echo "Identity private keys are not present in vault"
- else
- identity_private_keys=true
- echo "Successfully got identity private keys"
- fi
- fi
-
- # Check if identity public keys are stored in vault or not
- if [ "$identity_public_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/identity/public | jq -r 'if .errors then . else . end')
- public_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["did"]' 2>&1)
- if [ "$public_key" == "null" ] || [ "$public_key" == "parse error"* ]
- then
- identity_public_keys=false
- echo "Identity public keys are not present in vault"
- else
- identity_public_keys=true
- echo "Successfully got identity public keys"
- fi
- fi
-
- # Check if node verif keys are stored in vault or not
- if [ "$node_verif_keys" == false ]
- then
- # Check if node keys are stored in vault or not
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/node/public/verif_keys | jq -r 'if .errors then . else . end')
- verification_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["verification-key"]' 2>&1)
- if [ "$verification_key" == "null" ] || [ "$verification_key" == "parse error"* ]
- then
- node_verif_keys=false
- echo "Node verif keys are not present in vault"
- else
- node_verif_keys=true
- echo "Successfully got node verification keys"
- fi
- fi
-
- # Check if node bls keys are stored in vault or not
- if [ "$node_bls_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/node/public/bls_keys | jq -r 'if .errors then . else . end')
- bls_public_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["bls-public-key"]' 2>&1)
- bls_key_pop=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["bls-key-pop"]' 2>&1)
- bls_pk=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["bls_pk"]' 2>&1)
- if [ "$bls_public_key" = "null" ] || [ "$bls_key_pop" = "null" ] || [ "$bls_pk" = "null" ] || [ "$bls_public_key" == "parse error"* ] || [ "$bls_key_pop" == "parse error"* ] || [ "$bls_pk" == "parse error"* ]
- then
- node_bls_keys=false
- echo "Node bls keys are not present in vault"
- else
- node_bls_keys=true
- echo "Successfully got node bls keys"
- fi
- fi
-
- # Check if node public keys are stored in vault or not
- if [ "$node_public_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/node/public/public_keys | jq -r 'if .errors then . else . end')
- public_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["public_key"]' 2>&1)
- if [ "$public_key" == "null" ] || [ "$public_key" == "parse error"* ]
- then
- node_public_keys=false
- echo "Node public keys are not present in vault"
- else
- node_public_keys=true
- echo "Successfully got node public keys"
- fi
- fi
-
- # Check if node sig keys are stored in vault or not
- if [ "$node_sig_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/node/private/sig_keys | jq -r 'if .errors then . else . end')
- sig_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["{{ $.Values.vault.identity }}.key_secret"]' 2>&1)
- if [ "$sig_key" == "null" ] || [ "$sig_key" == "parse error"* ]
- then
- node_sig_keys=false
- echo "Node sig keys are not present in vault"
- else
- node_sig_keys=true
- echo "Successfully got node private signature keys"
- fi
- fi
-
- # Check if node private bls keys are stored in vault or not
- if [ "$node_private_bls_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/node/private/bls_keys | jq -r 'if .errors then . else . end')
- bls_sk=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["bls_sk"]' 2>&1)
- if [ "$bls_sk" == "null" ] || [ "$bls_sk" == "parse error"* ]
- then
- node_private_bls_keys=false
- echo "Node private bls keys are not present in vault"
- else
- node_private_bls_keys=true
- echo "Successfully got node private bls keys"
- fi
- fi
-
- # Check if node private keys are stored in vault or not
- if [ "$node_private_keys" == false ]
- then
- LOOKUP_SECRET_RESPONSE=$(curl -sS --header "X-Vault-Token: ${VAULT_TOKEN}" {{ $.Values.vault.address }}/v1/${field}/{{ $.Values.vault.identity }}/node/private/private_keys | jq -r 'if .errors then . else . end')
- private_key=$(echo ${LOOKUP_SECRET_RESPONSE} | jq -r '.data.data["{{ $.Values.vault.identity }}.key_secret"]' 2>&1)
- if [ "$private_key" == "null" ] || [ "$private_key" == "parse error"* ]
- then
- node_private_keys=false
- echo "Node private keys are not present in vault"
+{{- else }}
+ # When Vault type is not hahsicorp
+ # function to create kubernetes secrets, add additional conditions here if cloud KMS is used
+ function safeWriteSecret {
+ path=$1
+ subpath=$2
+ value=$3
+ secretName=$(echo $subpath | sed 's/\//-/g' |sed 's/_/-/g')
+ # Create the Kubernetes Secret using kubectl
+ kubectl get secret --namespace {{ $.Release.Namespace }} "${secretName}"
+ if [ $? -ne 0 ]; then
+ kubectl create secret --namespace {{ $.Release.Namespace }} generic "${secretName}" --from-literal="value=$value"
+ fi
+ }
+{{- end }}
+ # function to write/save all secrets by parsing the json
+ function writeAllSecret {
+ identity=$1
+ secretData=$2
+ path=$3
+ jq -r 'to_entries[] | "\(.key) \(.value)"' <<< "$secretData" | \
+ while read -r key value; do
+ jq -r 'to_entries[] | "\(.key) \(.value)"' <<< "$value" | \
+ while read -r subkey subvalue; do
+ if [ "$key" == "identity" ]; then
+ # Do not iterate as identity has only 1 level of keys
+ safeWriteSecret $path "$identity/$key/$subkey" "$subvalue"
else
- node_private_keys=true
- echo "Successfully got node private keys"
+ # Otherwise, iterate over next set of key-value pairs
+ jq -r 'to_entries[] | "\(.key) \(.value)"' <<< "$subvalue" | \
+ while read -r key1 value1; do
+ safeWriteSecret $path "$identity/$key/$subkey/$key1" "$value1"
+ done
fi
- fi
-
- if [ "$client_public_keys" == true ] || [ "$client_verif_keys" == true ] || [ "$client_private_keys" == true ] || [ "$client_sig_keys" == true ] || [ "$identity_private_keys" == true ] || [ "$identity_public_keys" == true ] || [ "$node_verif_keys" == true ] || [ "$node_bls_keys" == true ] || [ "$node_public_keys" == true ] || [ "$node_sig_keys" == true ] || [ "$node_private_bls_keys" == true ] || [ "$node_private_keys" == true ]
- then
- echo "All crypto materials are successfully stored in vault"
- break
- else
- echo "Crypto materials are not stored in vault"
- if [ "$COUNTER" -ge {{ $.Values.vault.retries }} ]
- then
- echo "Retry attempted $COUNTER times, certificates have not been saved in vault"
- exit 1
- fi
- fi
+ done
done
- COUNTER=`expr "$COUNTER" + 1`
- done
+ }
+ echo "Generating the secrets for each identity"
+ {{- if .Values.settings.identities.trustee }}
+ trustees_json=$(generate_identity {{ .Values.settings.identities.trustee }} trustees)
+ # Parse the JSON and create Kubernetes secrets
+ json=$(echo "$trustees_json" | jq -r '.trustees."{{ .Values.settings.identities.trustee }}"')
+ writeAllSecret "{{ .Values.settings.identities.trustee }}" "$json" "trustees"
+ {{- end }}
+ {{- if .Values.settings.identities.endorser }}
+ endorsers_json=$(generate_identity {{ .Values.settings.identities.endorser }} endorsers)
+ # Parse the JSON and create Kubernetes secrets
+ json=$(echo "$endorsers_json" | jq -r '.endorsers."{{ .Values.settings.identities.endorser }}"')
+ writeAllSecret "{{ .Values.settings.identities.endorser }}" "$json" "endorsers"
+ {{- end }}
+ {{- range .Values.settings.identities.stewards }}
+ stewards_json=$(generate_identity {{ . }} stewards)
+ # Parse the JSON and create Kubernetes secrets
+ json=$(echo "$stewards_json" | jq -r '.stewards."{{ . }}"')
+ writeAllSecret "{{ . }}" "$json" "stewards"
+ {{- end }}
+ volumes:
+ {{- if eq .Values.global.vault.type "hashicorp" }}
+ - name: scripts-volume
+ configMap:
+ name: bevel-vault-script
+ defaultMode: 0777
+ {{- end }}
+ - name: package-manager
+ configMap:
+ name: package-manager
+ defaultMode: 0777
diff --git a/platforms/hyperledger-indy/charts/indy-key-mgmt/values.yaml b/platforms/hyperledger-indy/charts/indy-key-mgmt/values.yaml
index f877a088930..81ea01bfa72 100644
--- a/platforms/hyperledger-indy/charts/indy-key-mgmt/values.yaml
+++ b/platforms/hyperledger-indy/charts/indy-key-mgmt/values.yaml
@@ -3,74 +3,47 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
-
-# Default values for indy-key-mgmt.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
-
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: bevel
- namespace:
-
- #Provide the name for indy-key-mgmt release
- #Eg. name: indy-key-mgmt
- name:
-
-network:
- #Provide the name for network
- #Eg. name: bevel
- name:
+---
+# The following are for overriding global values
+global:
+ #Provide the service account name which will be created.
+ serviceAccountName: vault-auth
+ cluster:
+ provider: aws # choose from: minikube | aws | azure | gcp
+ cloudNativeServices: false # only 'false' is implemented
+ #Provide the kubernetes host url
+ #Eg. kubernetesUrl: https://10.3.8.5:8443
+ kubernetesUrl:
+ vault:
+ #Provide the type of vault
+ type: hashicorp # hashicorp | kubernetes
+ #Provide the vault role used.
+ role: vault-role
+ #Provide the network type
+ network: indy
+ #Provide the vault server address
+ address:
+ #Provide the vault authPath configured to be used.
+ authPath: authority
+ #Provide the secret engine.
+ secretEngine: secretsv2
+ #Provide the vault path where the secrets will be stored
+ secretPrefix: "data/authority"
image:
- #Provide the image name for the indy-key-mgmt container
- #Eg. name: indy-key-mgmt
- name:
-
- #Provide the image repository for the indy-key-mgmt container
- #Eg. repository: indy-key-mgmt:latest
- repository:
-
- #Provide the image pull secret of image
+ #Provide the image for the job container
+ #Eg. keyUtils: ghcr.io/hyperledger/bevel-indy-key-mgmt:1.12.6
+ keyUtils: ghcr.io/hyperledger/bevel-indy-key-mgmt:1.12.6
+ #Provide the secret to use if private repository
#Eg. pullSecret: regcred
pullSecret:
+settings:
+ removeKeysOnDelete: true
+ identities:
+ trustee: authority-trustee
+ endorser:
+ stewards: []
-vault:
- #Provide the vault server address
- #Eg. address: http://54.226.163.39:8200
- address:
-
- #Provide the vault secret version address
- # Supported are "1" or "2"
- version: "1"
-
- #Provide the key path for vault
- #Eg. keyPath: provider.stewards
- keyPath:
-
- #Provide the identity for vault
- #Eg. identity: my-identity
- identity:
-
- #Provide the authpath
- #Eg. authpath: kubernetes-bevel-provider-admin-auth
- auth_path:
- # Provide the vault path where the certificates are stored
- # Eg. certsecretprefix: secret/organisation-name
- certsecretprefix:
- # The amount of times to retry fetching from/writing to Vault before giving up.
- # Eg. retries: 10
- retries: 10
- # The amount of time in seconds to wait after an error occurs when fetching from/writing to Vault.
- # Eg. sleepTimeAfterError: 15
- sleepTimeAfterError: 15
-
-account:
- #Provide the service account name
- #Eg. service: vault-auth-provider-agent-app
- service:
-
- #Provide the service account role
- #Eg. role: ro
- role:
diff --git a/platforms/hyperledger-indy/charts/indy-ledger-txn/Chart.yaml b/platforms/hyperledger-indy/charts/indy-ledger-txn/Chart.yaml
deleted file mode 100644
index 8590567a4f3..00000000000
--- a/platforms/hyperledger-indy/charts/indy-ledger-txn/Chart.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: v1
-appVersion: "2.0"
-description: "hyperledger-indy: Indy Ledger Script for Issuing a NYM Transaction"
-name: indy-ledger-chart
-version: 1.0.0
diff --git a/platforms/hyperledger-indy/charts/indy-ledger-txn/README.md b/platforms/hyperledger-indy/charts/indy-ledger-txn/README.md
deleted file mode 100644
index ff012480d1e..00000000000
--- a/platforms/hyperledger-indy/charts/indy-ledger-txn/README.md
+++ /dev/null
@@ -1,200 +0,0 @@
-[//]: # (##############################################################################################)
-[//]: # (Copyright Accenture. All Rights Reserved.)
-[//]: # (SPDX-License-Identifier: Apache-2.0)
-[//]: # (##############################################################################################)
-
-
-# indy-ledger-txn
-
-- [indy-ledger-txn Helm Chart](#indy-ledger-txn-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
-
-
-## indy-ledger-txn Helm Chart
----
-This [Helm chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-ledger-txn) helps to deploy indy ledger txn job.
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
-
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
-
-```
-indy-ledger-txn/
- |- templates/
- |- _helpers.tpl
- |- job.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
-```
-
-- `templates/`: This directory contains the template files for generating Kubernetes resources.
-- `_helpers.tpl`: Contains custom label definitions used in other templates.
-- `job.yaml`: This file provides information about the kubernetes job
-- `Chart.yaml`: Provides metadata about the chart, such as its name, version, and description.
-- `README.md`: This file provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the chart. It includes configuration for the metadata, image, node, Vault, etc.
-
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-ledger-txn/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
-
-## Parameters
----
-### metadata
-
-| Name | Description | Default Value |
-| ----------------| ----------------------------------------------- | ------------- |
-| namespace | Provide the namespace for organization's peer | bevel |
-| name | Provide the name for indy-ledger-txn release | indy-ledger-txn |
-
-
-### network
-
-| Name | Description | Default Value |
-| ------------ | ------------------------------------| ------------- |
-| name | Provide the name of the network | bevel |
-
-
-### organization
-
-| Name | Description | Default Value |
-| -------- | ----------------------------------| ------------- |
-| name | | bevel |
-| adminIdentity | Provide the admin identity name | |
-| name | Provide the admin identity name | admin_name |
-| path | Provide the admin identity path |admin_path |
-| newIdentity |
-| name | Provide the new identity name | identity_name |
-| path | Provide the new identity path | identity_path |
-| role | Provide the new identity role | identity_role |
-| did | Provide the new identity did | identity_did |
-| verkey | Provide the new identity verkey | verification key value |
-
-
-### image
-
-| Name | Description | Default Value |
-| ------------ | ---------------------------------------------------------- | ------------- |
-| name | Provide the image name for the indy-ledger-txn container | indy-ledger-txn |
-| repository | Provide the image pull secret of image |alpine:3.9.4 |
-| pullSecret | Provide the vault identity | regcred |
-
-### vault
-
-| Name | Description | Default Value |
-| -------------------- | --------------------------------------| ------------- |
-| address | Provide the vault server address | http://54.226.163.39:8200 |
-| role | Provide the service account role | ro |
-| serviceAccountName | Provide the authpath | vault-auth |
-| auth_path | Provide the indy-ledger-txn node name | kubernetes-bevel-provider-steward-1-auth|
-
-
-### node
-
-| Name | Description | Default Value |
-| --------------| --------------------------------------- | ------------ |
-| name | Provide the indy-ledger-txn node name | indy-ledger |
-
-
-
-
-## Deployment
----
-
-To deploy the indy-ledger-txn Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-ledger-txn/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./indy-ledger-txn
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the indy auth job to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the jobs, we can use the following command:
-```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the job was created. The command will display information about the jobs.
-
-
-
-## Updating the job
----
-
-If we need to update the job with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-ledger-txn/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./indy-ledger-txn
-```
-Replace `` with the name of the release. This command will apply the changes to the job , ensuring the job is up to date.
-
-
-
-## Deletion
----
-
-To delete the jobs and associated resources, run the following Helm command:
-```
-$ helm uninstall
-```
-Replace `` with the name of the release. This command will remove all the resources created by the Helm chart.
-
-
-
-## Contributing
----
-If you encounter any bugs, have suggestions, or would like to contribute to the [INDY authorization job Helm Chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-ledger-txn), please feel free to open an issue or submit a pull request on the [project's GitHub repository](https://github.com/hyperledger/bevel).
-
-
-
-## License
-
-This chart is licensed under the Apache v2.0 license.
-
-Copyright © 2023 Accenture
-
-### Attribution
-
-This chart is adapted from the [charts](https://hyperledger.github.io/bevel/) which is licensed under the Apache v2.0 License which is reproduced here:
-
-```
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-```
diff --git a/platforms/hyperledger-indy/charts/indy-ledger-txn/templates/_helpers.tpl b/platforms/hyperledger-indy/charts/indy-ledger-txn/templates/_helpers.tpl
deleted file mode 100644
index d43c09d8cef..00000000000
--- a/platforms/hyperledger-indy/charts/indy-ledger-txn/templates/_helpers.tpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{- define "labels.custom" }}
- {{ range $key, $val := $.Values.metadata.labels }}
- {{ $key }}: {{ $val }}
- {{ end }}
-{{- end }}
diff --git a/platforms/hyperledger-indy/charts/indy-ledger-txn/templates/job.yaml b/platforms/hyperledger-indy/charts/indy-ledger-txn/templates/job.yaml
deleted file mode 100644
index f602a70f9f3..00000000000
--- a/platforms/hyperledger-indy/charts/indy-ledger-txn/templates/job.yaml
+++ /dev/null
@@ -1,120 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-apiVersion: batch/v1
-kind: Job
-metadata:
- name: "{{ $.Values.metadata.name }}"
- namespace: "{{ $.Values.metadata.namespace }}"
- labels:
- app: "{{ $.Values.metadata.name }}"
- app.kubernetes.io/name: "{{ $.Values.metadata.name }}"
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
-spec:
- backoffLimit: 7
- template:
- metadata:
- labels:
- app: "{{ $.Values.metadata.name }}"
- app.kubernetes.io/name: "{{ $.Values.metadata.name }}"
- helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- spec:
- restartPolicy: OnFailure
- serviceAccountName: "{{ $.Values.vault.serviceAccountName }}"
- imagePullSecrets:
- - name: "{{ $.Values.image.cli.pullSecret }}"
- volumes:
- - name: {{ $.Values.organization.name }}-ptg
- configMap:
- name: {{ $.Values.organization.name }}-ptg
- - name: shared-data
- emptyDir:
- medium: Memory
- containers:
- - name: init-container
- image: "{{ $.Values.image.cli.repository }}"
- stdin: true
- tty: true
- command: ["sh", "-c"]
- args:
- - |-
- #!/usr/bin/env sh
- validateVaultResponse () {
- if echo ${2} | grep "errors"; then
- echo "ERROR: unable to retrieve ${1}: ${2}"
- exit 1
- fi
- }
-
- KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token);
- echo "Getting secrets from Vault Server: ${VAULT_ADDR}"
- # Login to Vault to get an approle token
- curl --request POST --data '{"jwt": "'"${KUBE_TOKEN}"'", "role": "{{ $.Values.vault.role }}"}' ${VAULT_ADDR}/v1/auth/{{ $.Values.vault.auth_path }}/login | jq -j '.auth.client_token' > token;
- VAULT_TOKEN=$(cat token);
- validateVaultResponse 'vault login token' "${VAULT_TOKEN}"
- QUERY_RES=$(curl -sS --header "X-Vault-Token: $VAULT_TOKEN" $VAULT_ADDR/v1/$ADMIN_PATH/$ADMIN_NAME/identity/private | jq -r 'if .errors then . else . end')
- validateVaultResponse 'Admin Seed' "${QUERY_RES}"
- admin_seed=$(echo ${QUERY_RES} | jq -r ".data.data[\"seed\"]");
- mkdir -p /data/seed;
- echo "${admin_seed}" > /data/seed/adminseed.txt;
- env:
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: KUBERNETES_AUTH_PATH
- value: "{{ $.Values.vault.authpath }}"
- - name: VAULT_ADDR
- value: "{{ $.Values.vault.address }}"
- - name: ADMIN_PATH
- value: "{{ $.Values.organization.adminIdentity.path }}"
- - name: ADMIN_NAME
- value: "{{ $.Values.organization.adminIdentity.name }}"
- - name: IDENTITY_NAME
- value: "{{ $.Values.organization.newIdentity.name }}"
- - name: IDENTITY_PATH
- value: "{{ $.Values.organization.newIdentity.path }}"
- volumeMounts:
- - name: shared-data
- mountPath: /data
- - name: "{{ $.Values.image.cli.name }}"
- image: "{{ $.Values.image.cli.repository }}"
- stdin: true
- tty: true
- command: ["sh", "-c"]
- args:
- - |-
- apt-get install curl -y
-
- ADMIN_SEED=$( cat /data/seed/adminseed.txt)
- echo "Running ledger Transaction Script...";
-
- ./home/indy-ledger.sh $ADMIN_DID $ADMIN_SEED $IDENTITY_DID $IDENTITY_ROLE $IDENTITY_VERKEY $POOL_GENESIS_PATH;
- env:
- - name: VAULT_APP_ROLE
- value: {{ $.Values.vault.role }}
- - name: KUBERNETES_AUTH_PATH
- value: "{{ $.Values.vault.authpath }}"
- - name: VAULT_ADDR
- value: "{{ $.Values.vault.address }}"
- - name: ADMIN_DID
- value: "{{ $.Values.organization.adminIdentity.did }}"
- - name: IDENTITY_DID
- value: "{{ $.Values.organization.newIdentity.did }}"
- - name: IDENTITY_ROLE
- value: "{{ $.Values.organization.newIdentity.role }}"
- - name: IDENTITY_VERKEY
- value: "{{ $.Values.organization.newIdentity.verkey }}"
- - name: POOL_GENESIS_PATH
- value: /var/lib/indy/genesis/{{ $.Values.network.name }}/pool_transactions_genesis
- volumeMounts:
- - name: {{ $.Values.organization.name }}-ptg
- mountPath: /var/lib/indy/genesis/{{ $.Values.network.name }}/pool_transactions_genesis
- subPath: pool_transactions_genesis
- - name: shared-data
- mountPath: /data
diff --git a/platforms/hyperledger-indy/charts/indy-ledger-txn/values.yaml b/platforms/hyperledger-indy/charts/indy-ledger-txn/values.yaml
deleted file mode 100644
index 0587ee09bc2..00000000000
--- a/platforms/hyperledger-indy/charts/indy-ledger-txn/values.yaml
+++ /dev/null
@@ -1,92 +0,0 @@
-##############################################################################################
-# Copyright Accenture. All Rights Reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-##############################################################################################
-
-# Default values for indy-ledger-txn.
-# This is a YAML-formatted file.
-# Declare variables to be passed into your templates.
-
-metadata:
- #Provide the namespace for organization's peer
- #Eg. namespace: bevel
- namespace:
-
- #Provide the name for indy-ledger-txn release
- #Eg. name: indy-ledger-txn
- name:
-
-network:
- #Provide the name for network
- #Eg. name: bevel
- name:
-
-organization:
- name:
- #Provide the organization name
- adminIdentity:
- #Provide the admin identity name
- #Eg. name: admin_name
- name:
-
- #Provide the admin identity path
- #Eg. path: admin_path
- path:
-
- newIdentity:
- #Provide the new identity name
- #Eg. name: identity_name
- name:
-
- #Provide the new identity path
- #Eg. path: identity_path
- path:
-
- #Provide the new identity role
- #Eg. role: identity_role
- role:
-
- #Provide the new identity did
- #Eg. did: identity_did
- did:
-
- #Provide the new identity did
- #Eg. verkey: verification key value
- verkey:
-
-image:
- cli:
- #Provide the image name for the indy-ledger-txn container
- #Eg. name: indy-ledger-txn
- name:
-
- #Provide the image repository for the indy-ledger-txn container
- #Eg. repository: alpine:3.9.4
- repository:
-
- #Provide the image pull secret of image
- #Eg. pullSecret: regcred
- pullSecret:
-
-vault:
- #Provide the vault server address
- #Eg. address: http://54.226.163.39:8200
- address:
-
- #Provide the service account role
- #Eg. role: ro
- role:
-
- #Provide the servicea ccount name for vault
- #Eg. serviceaccountname: vault-auth
- serviceAccountName:
-
- #Provide the authpath
- #Eg. authpath: kubernetes-bevel-provider-steward-1-auth
- auth_path:
-
-node:
- #Provide the indy-ledger-txn node name
- #Eg. name: indy-ledger
- name:
diff --git a/platforms/hyperledger-indy/charts/indy-node/Chart.yaml b/platforms/hyperledger-indy/charts/indy-node/Chart.yaml
index b53afcfc482..cc6da6d6140 100644
--- a/platforms/hyperledger-indy/charts/indy-node/Chart.yaml
+++ b/platforms/hyperledger-indy/charts/indy-node/Chart.yaml
@@ -3,9 +3,23 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
-
apiVersion: v1
-appVersion: "2.0"
-description: "hyperledger-indy: charts for indy-node StatefulSet"
name: indy-node
-version: 1.0.0
+description: Hyperledger Indy nodes for a SSI network
+version: 1.0.1
+appVersion: latest
+keywords:
+ - bevel
+ - identity
+ - indy
+ - hyperledger
+ - enterprise
+ - blockchain
+ - deployment
+ - accenture
+home: https://hyperledger-bevel.readthedocs.io/en/latest/
+sources:
+ - https://github.com/hyperledger/bevel
+maintainers:
+ - name: Hyperledger Bevel maintainers
+ email: bevel@lists.hyperledger.org
diff --git a/platforms/hyperledger-indy/charts/indy-node/README.md b/platforms/hyperledger-indy/charts/indy-node/README.md
index bf245d80fe8..acfa11ea0f9 100644
--- a/platforms/hyperledger-indy/charts/indy-node/README.md
+++ b/platforms/hyperledger-indy/charts/indy-node/README.md
@@ -3,238 +3,100 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)
[//]: # (##############################################################################################)
-
# indy-node
-- [indy-node Helm Chart](#indy-node-helm-chart)
-- [Prerequisites](#prerequisites)
-- [Chart Structure](#chart-structure)
-- [Configuration](#configuration)
-- [Deployment](#deployment)
-- [Verification](#verification)
-- [Updating the Deployment](#updating-the-deployment)
-- [Deletion](#deletion)
-- [Contributing](#contributing)
-- [License](#license)
-
-
-## indy-node Helm Chart
----
-This [Helm chart](https://github.com/hyperledger/bevel/tree/develop/platforms/hyperledger-indy/charts/indy-node) helps to deploy indy node job.
-
-
-## Prerequisites
----
-Before deploying the Helm chart, make sure to have the following prerequisites:
-
-- Kubernetes cluster up and running.
-- A HashiCorp Vault instance is set up and configured to use Kubernetes service account token-based authentication.
-- The Vault is unsealed and initialized.
-- Helm installed.
+This chart is a component of Hyperledger Bevel. The indy-node chart deploys a Hyperledger Indy node as a steward. See [Bevel documentation](https://hyperledger-bevel.readthedocs.io/en/latest/) for more details.
-
-## Chart Structure
----
-The structure of the Helm chart is as follows:
+## TL;DR
-```
-indy-node/
- |- templates/
- |- _helpers.tpl
- |- job.yaml
- |- Chart.yaml
- |- README.md
- |- values.yaml
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install university-steward-1 bevel/indy-node
```
-- `templates/`: This directory contains the template files for generating Kubernetes resources.
-- `helpers.tpl`: Contains custom label definitions used in other templates.
-- `job.yaml`: This file provides information about the kubernetes job
-- `Chart.yaml`: Provides metadata about the chart, such as its name, version, and description.
-- `README.md`: This file provides information and instructions about the Helm chart.
-- `values.yaml`: Contains the default configuration values for the chart. It includes configuration for the metadata, image, node, Vault, etc.
+## Prerequisites
-
-## Configuration
----
-The [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-node/values.yaml) file contains configurable values for the Helm chart. We can modify these values according to the deployment requirements. Here are some important configuration options:
+- Kubernetes 1.19+
+- Helm 3.2.0+
-## Parameters
----
-### metadata
-
-| Name | Description | Default Value |
-| ----------------| ----------------------------------------------- | ------------- |
-| namespace | Provide the namespace for organization's peer | bevel |
-| name | Provide the name for indy-node release | indy-node |
-
-
-### replicas
-
-| Name | Description | Default Value |
-| --------- | ---------------------------------------- | ------------- |
-| replicas | Provide the number of indy-node replicas | 1 |
-
-### network
-
-| Name | Description | Default Value |
-| ------- | ---------------------------- | ------------- |
-| name | Provide the name for network | bevel |
-
-
-### organization
-
-| Name | Description | Default Value |
-| -------- | ----------------------------------- | ------------- |
-| name | Provide the name for organization | provider |
-
-# add_new_org is true when adding new validator node to existing network
-add_new_org: false
-
-
-
-### image
-
-| Name | Description | Default Value |
-| ------------ | -------------------------------------------------------------- | ------------- |
-| initContainer |
-| name | Provide the image name for the indy-node init container | indy-node |
-| repository | provide the image repository for the indy-node init | alpine:3.9.4 |
-| cli | | |
-| name | Provide the image name for the indy-ledger-txn container | indy-ledger-txn |
-| repository | Provide the image repository for the indy-ledger-txn container | alpine:3.9.4 |
-| indyNode | | |
-| name | Provide the name for the indy node | indy-node |
-| repository | Provide the image name for the indy-node container | alpine:3.9.4 |
-| pullSecret | Provide the image pull secret of image | regcred |
-
-
-
-### node
-
-| Name | Description | Default Value |
-| -----------------| -------------------------| ------------- |
-| name | Provide the node name | indy-node |
-| ip | Provide the node ip | 0.0.0.0 |
-| publicIp | Provide the node ip | 0.0.0.0 |
-| port | Provide the node port | 9752 |
-| ambassadorPort | Provide the node port | 15911 |
-
-### client
-
-| Name | Description | Default Value |
-| -----------------| -------------------------| ------------- |
-| ip | Provide the node ip | 0.0.0.0 |
-| publicIp | Provide the node ip | 0.0.0.0 |
-| port | Provide the node port | 9752 |
-| ambassadorPort | Provide the node port | 15912 |
-
-#### service
-| Name | Description | Default Value |
-| -------------------- | ---------------------------------------------| ------------- |
-| type | Provide type of service (NodePort/ClusterIp) | NodePort |
-| ports | | |
-| nodePort | Provide the service node port | 9711 |
-| nodeTargetPort | Provide the service node target port | 9711 |
-| clientPort Provide | the service client port | 9712 |
-| clientTargetPort | Provide the service client target port | 9712 |
-
-### configmap
-
-| Name | Description | Default Value |
-| -------------------- | ---------------------------------------------| ------------- |
-| domainGenesis | Provide the domain genesis | "" |
-| poolGenesis | Provide the pool genesis | "" |
-
-
-
-### ambassador
-
-### vault
-
-| Name | Description | Default Value |
-| -------------------- | ---------------------------------------------| ------------- |
-| address | Provide the vault server address | http://54.226.163.39:8200 |
-| serviceAccountName | Provide the service account name for vault |vault-auth-provider-agent-app"" |
-| keyPath | Provide the key path for vault | /keys/udisp/keys/indy-node |
-| auth_path | Provide the authpath | kubernetes-bevel-provider-steward-1-auth |
-| nodeId | Provide the indy-node node Id | indy-node |
-| role | Provide the indy-node role | ro|
-
-
-### storage
-
-| Name | Description | Default Value |
-| -------------------- | -------------------------------------------------- | ------------- |
-| keys | | |
-| storagesize | Provide the storage size for storage for keys | 512Mi |
-| storageClassName | Provide the storageClassName for storage for keys | ebs |
-| data | | |
-| storagesize | Provide the storage size for storage for data | 5Gi|
-| storageClassName | Provide the storageClassName for storage for data | ebs |
-
-
-## Deployment
----
-
-To deploy the indy-node Helm chart, follow these steps:
-
-1. Modify the [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-node/values.yaml) file to set the desired configuration values.
-2. Run the following Helm command to install the chart:
- ```
- $ helm repo add bevel https://hyperledger.github.io/bevel/
- $ helm install ./indy-node
- ```
-Replace `` with the desired name for the release.
-
-This will deploy the indy auth job to the Kubernetes cluster based on the provided configurations.
-
-
-
-## Verification
----
-
-To verify the jobs, we can use the following command:
-```
-$ kubectl get jobs -n
-```
-Replace `` with the actual namespace where the job was created. The command will display information about the jobs.
+If Hashicorp Vault is used, then
+- HashiCorp Vault Server 1.13.1+
+> **Important**: Ensure the `indy-key-mgmt` and `indy-genesis` charts has been installed correctly before installing this.
-
-## Updating the job
----
+## Installing the Chart
-If we need to update the job with new configurations or changes, modify the same [values.yaml](https://github.com/hyperledger/bevel/blob/develop/platforms/hyperledger-indy/charts/indy-node/values.yaml) file with the desired changes and run the following Helm command:
-```
-$ helm upgrade ./indy-node
+To install the chart with the release name `university-steward-1`:
+
+```bash
+helm repo add bevel https://hyperledger.github.io/bevel
+helm install university-steward-1 bevel/indy-node
```
-Replace `