Upload helm chart in S3

Upload helm chart package in 0chain-helm-chart S3 Bucket

For development purpose , we use development branch of 0helm.

dev => dev helm charts are based on the staging branch of all the repositories.

  • Helm charts inside s3 stable repositories are loadBalancer, zchain, zdns, blobber, zbox, cleanDir, authorizer , znft , zs3server , zswap , zchainDel , blobberDel , graphNode , loadtest , magicblock & keygen .

Pre-requisites

  1. Install the AWS CLI on client/local.

    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    unzip awscliv2.zip
    sudo ./aws/install
  2. Configure AWS on client/local with the following command and input the ACCESS_KEY, SECRET_KEY & REGION.

    aws configure
  3. Install & validate Helm v3 on client/local.

    sudo curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
  4. Install the helm-s3 plugin for Amazon S3.

    helm plugin install https://github.com/hypnoglow/helm-s3.git

Helm Repo

1. Add the Amazon S3 repository to Helm on the client/local machine.

  • Use the following command inorder to add s3 repository to client/local. Below commands are an example to update helm charts over s3 dev. As there are 16 helm charts, any/all commands can be used to add s3 repo to client/local according to the requirements.

helm repo add stable-zchain s3://0chain-helm-chart/stable/zchain
helm repo add stable-zdns s3://0chain-helm-chart/stable/zdns
helm repo add stable-blobber s3://0chain-helm-chart/stable/blobber
helm repo add stable-stake s3://0chain-helm-chart/stable/blobberStake
helm repo add stable-zblock s3://0chain-helm-chart/stable/zblock
helm repo add stable-explorer s3://0chain-helm-chart/stable/explorer
helm repo add stable-zproxy s3://0chain-helm-chart/stable/zproxy
helm repo add stable-zbox s3://0chain-helm-chart/stable/zbox
helm repo add stable-zsearch s3://0chain-helm-chart/stable/zsearch
helm repo add stable-magma s3://0chain-helm-chart/stable/magma
helm repo add stable-provider s3://0chain-helm-chart/stable/provider
helm repo add stable-consumer s3://0chain-helm-chart/stable/consumer
helm repo add stable-authorizer s3://0chain-helm-chart/stable/authorizer
helm repo add stable-cleanDir s3://0chain-helm-chart/stable/cleanDir
  • Note: In the same way we can add the repository for s3 staging repos also. Just specify the staging in s3 directory path i.e. s3://0chain-helm-chart/staging/zchain etc.

2. Clone 0helm repository to client/local machine

  • Clone the repo on client/local machine. Checkout to the branch for updation.

    git clone https://github.com/0chain/0helm.git
    cd 0helm
    git checkout stable
  • There are two branches for helm charts that are used for deployment over the s3 bucket -

    • staging ==> staging helm charts are based on the staging branch of all the repositories. It also refers to s3 staging repository.

    NOTE - staging branch of 0helm is not up-to-date right now we are using development branch and dev s3.

    • development ==> development helm charts are also based on the staging branch of all the repositories. However development branch is used to test most recent changes made in all staging branch of all repos. when development branch code become stable, same is also updated in 0helm staging branch and s3 staging helm repository also.

  1. Upgrading the helm charts versions

  • Semantic versioning is used for upgrading the helm charts for example: major.minor.patch-->1.2.0. If there is any patch, we increment the patch count. If there is any minor release, we increment the miner count. If there is any major release, we increment the major count.

  • Helm charts version can be modified from there respective directories from key version: 0.2.4 inside Charts.yaml.

  • Example after cloning 0helm repo on client/local machine & checkout to specific branch as in step 2.

    cd 0chain
    1. Edit/Update any file/files inside 0chain directory.

    2. Check for templates if they getting rendered without an error using the command below:

      helm template -n helm 0chain ./ --debug
    3. Check by dry running to check if there is any error on run time or not.

      helm install -n helm 0chain ./ --dry-run
    4. If above steps ii & iii are fine, check and verify by installing on your local. You can also refer to link, if any other issue occurs.

    5. If step iv is also successful, change the chart version from Charts.yaml file.

    6. Create a new helm package by using below command. It will create a new zchain0.2.4.tgz inside dist folder.

      helm package ./ -d dist
  • Note: In the same way other helm charts can also be updated/upgraded by moving into the specific directories & following the same above steps i to vi. Please change the chart name 0chain to directory name. For example: When inside 0dns directory helm install -n helm 0dns ./ --dry-run.

4. Pushing new helm charts versions to S3

  • Push the helm package to s3 repo i.e. generated inside dist folder from step 3 by using the below command: Repo i.e. added in step 1 will be used here for pushing it to the s3.

    helm s3 push --force  ./dist/zchain0.2.4.tgz staging-zchain
  • If you have changed the version inside Charts.yml, you must also update the index.yaml file i.e. located inside s3://0chain-helm-chart/staging/index.yaml.

    ****
    zchain:
    - apiVersion: v2
      appVersion: 1.17.0
      created: "2021-08-23T14:47:25.786330985Z"
      description: A Helm chart for 0chain
      digest: b93cac03652c7caacaa8b590e0cd6bd1373e4a54826075540224b8da3d56c343
      name: zchain
      type: application
      urls:
      - http://0chain-helm-chart.s3-website.us-east-2.amazonaws.com/staging/zchain/chain-0.2.4.tgz
      version: 0.2.4
    ****
  • Note: In the same way other helm charts can also be pushed into their specific directories & by following the same as above.

4. Helm other useful commands.

  • Helm add command to add s3 repo.

    helm repo add 0chain-helm http://0chain-helm-chart.s3-website.us-east-2.amazonaws.com/staging/
  • Helm update repositories.

    helm repo update
  • Verify the updated Helm chart.

    helm search repo 0chain-staging
  • Helm upgrade command for deployments.

    helm upgrade --install --wait --timeout 90s 0chain -n helm 0chain-staging/zchain --version 0.2.4
  • Roll back to a previous version.

    helm rollback 0chain 1 -n helm

Last updated