From 611991aa5e6ca98b1e98a69dfa27f7f0697e6b7f Mon Sep 17 00:00:00 2001 From: suvajit-sarkar Date: Thu, 18 Jan 2024 10:06:02 +0000 Subject: [PATCH] update add sc tutorial Signed-off-by: suvajit-sarkar --- .../tutorials/adding-new-storageclass.md | 139 +++++------------- 1 file changed, 33 insertions(+), 106 deletions(-) diff --git a/docs/source/tutorials/adding-new-storageclass.md b/docs/source/tutorials/adding-new-storageclass.md index 4aad25fb460..2cfd0238ae0 100644 --- a/docs/source/tutorials/adding-new-storageclass.md +++ b/docs/source/tutorials/adding-new-storageclass.md @@ -3,109 +3,36 @@ [//]: # (SPDX-License-Identifier: Apache-2.0) [//]: # (##############################################################################################) - -# Adding a new storageclass -As storageclass templates vary as per requirements and cloud provider specifications, this guide will help in using a new storageclass which is not supported by Hyperledger Bevel - - - [Adding a new storage class for Hyperledger Fabric](#fabric) - - [Adding a new storage class for R3-Corda](#corda) - - [Adding a new storage class for Hyperledger Indy](#indy) - - [Adding a new storage class for Quorum](#quorum) - - - -## Adding a new storage class for Hyperledger Fabric - -To add a new storageclass for Hyperledger Fabric, perform the following steps: - -1. Add the new storageclass template `sample_sc.tpl`, under `platforms/hyperledger-fabric/configuration/roles/create/storageclass/templates` with `metadata.name` (storageclass name) as the variable `sc_name`. For example, -```yaml -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: {{ sc_name }} -provisioner: kubernetes.io/aws-ebs -parameters: - type: gp2 - encrypted: "true" -``` -2. Mention the template file, which you created above, under `platforms/hyperledger-fabric/configuration/roles/create/storageclass/vars/main.yaml` with a variable reference. For example, -``` -sc_templates: - sample-sc: sample_sc.tpl -``` -3. Set the `type` variable to `sample-sc` (variable created in step 2) in the task `Create Storage Class value file for orderers` and `Create Storage Class value file for Organizations`, located in `platforms/hyperledger-fabric/configuration/roles/create/storageclass/tasks/main.yaml` - - - -## Adding a new storage class for R3-Corda - -To add a new storageclass for R3-Corda, perform the following steps: - -1. Add the new storageclass template `sample_sc.tpl`, under `platforms/r3-corda/configuration/roles/create/k8_component/templates` with `metadata.name` (storageclass name) as the variable `component_name`. For example, -```yaml -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: {{ component_name }} -provisioner: kubernetes.io/aws-ebs -reclaimPolicy: Delete -volumeBindingMode: Immediate -parameters: - encrypted: "true" -``` -2. Mention the template file, which you created above, under `platforms/r3-corda/configuration/roles/create/k8_component/vars/main.yaml` with a variable reference. For example, -``` -dlt_templates: - sample-sc: sample_sc.tpl -``` -3. Set the `component_type` and `component_name` variable to `sample-sc` (variable created in step 2) in the task `Create storageclass`, located in `platforms/r3-corda/configuration/roles/create/storageclass/tasks/main.yaml` - - - -## Adding a new storage class for Hyperledger Indy - -To add a new storageclass for Hyplerledger Indy, perform the following steps: - -1. Add the new storageclass template `sample_sc.tpl`, under `platforms/hyperledger-indy/configuration/roles/create/k8_component/templates` with `metadata.name` (storageclass name) as the variable `component_name`. For example, -```yaml -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: {{ component_name }} -provisioner: kubernetes.io/aws-ebs -reclaimPolicy: Delete -volumeBindingMode: Immediate -parameters: - encrypted: "true" -``` -2. Mention the template file, which you created above, under `platforms/hyperledger-indy/configuration/roles/create/k8_component/vars/main.yaml` with a variable reference. For example, -``` -k8_templates: - sample-sc: sample_sc.tpl -``` -3. Set the `component_name` variable to `sample-sc` (variable created in step 2) in the task `Create Storage Class`, located in `platforms/hyperledger-indy/configuration/deploy-network.yaml` - - -## Adding a new storage class for Quorum - -To add a new storageclass for Quorum, perform the following steps: - -1. Add the new storageclass template `sample_sc.tpl`, under `platforms/quorum/configuration/roles/create/k8_component/templates` with `metadata.name` (storageclass name) as the variable `component_name`. For example, -```yaml -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: {{ component_name }} -provisioner: kubernetes.io/aws-ebs -reclaimPolicy: Delete -volumeBindingMode: Immediate -parameters: - encrypted: "true" -``` -2. Mention the template file, which you created above, under `platforms/quorum/configuration/roles/create/k8_component/vars/main.yaml` with a variable reference. For example, -``` -dlt_templates: - sample-sc: sample_sc.tpl -``` -3. Set the `component_type` and `component_name` variable to `sample-sc` (variable created in step 2) in the task `Create storageclass`, located in `platforms/quorum/configuration/roles/create/storageclass/tasks/main.yaml` +Storageclass templates vary as per requirements and cloud provider specifications, this guide will help in adding and using a new storageclass in Hyperlegder Bevel. + +Steps: + +1. Add the storageclass provisioner as per cloud provider specifications, under `platforms/shared/charts/bevel-storageclass/templates/_helpers.tpl`. + + ```yaml + --8<-- "platforms/shared/charts/bevel-storageclass/templates/_helpers.tpl:30:40" + ``` + For example, storageclass for `cloud_provider_x` with required `provisioner_x` should be added as + ```jinja + ... + {{- else if eq .Values.global.cluster.provider "cloud_provider_x" }} + provisioner: provisioner_x + ... + ``` + +2. Update the `cloud_provider` enum under `platforms/network-schema.json` file with the new cloud provider name. + For example, + ```json + "cloud_provider": { + "type": "string", + "enum": [ + "aws", + "aws-baremetal", + "azure", + "gcp", + "minikube", + "cloud_provider_x" + ]} + ``` + +3. Use the the cloud provider in your network configuration file `cloud_provider` field under organization section. \ No newline at end of file