From 7bca6486a823780e61e2a5cc35d9f51812797d44 Mon Sep 17 00:00:00 2001 From: Arashad Ahamad Date: Wed, 29 Sep 2021 20:29:31 +0530 Subject: [PATCH] Updated readme --- README.md | 59 ++++++++++++++++++++------------- scripts/apply-required-setup.sh | 48 +++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 scripts/apply-required-setup.sh diff --git a/README.md b/README.md index 23dd9c41..0593c5f1 100644 --- a/README.md +++ b/README.md @@ -3,25 +3,49 @@ [![Build Status](https://prow.k8s.io/badge.svg?jobs=pull-ibm-vpc-block-csi-driver-build)](https://prow.k8s.io) [![Coverage Status](https://coveralls.io/repos/github/kubernetes-sigs/ibm-vpc-block-csi-driver/badge.svg?branch=master)](https://coveralls.io/github/kubernetes-sigs/ibm-vpc-block-csi-driver?branch=master) -ibm-vpc-block-csi-driver is a CSI plugin for creating and mounting VPC block storage on IBM VPC infrastructure based openshift or kubernetes cluster +[`IBM VPC Block CSI Driver`](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-block) Container Storage Interface (CSI) Driver provides a [`CSI`](https://github.com/container-storage-interface/spec/blob/master/spec.md) based used by Container Orchestrators to manage the lifecycle of IBM VPC Block Data volumes. # Supported orchestration platforms -The following table details orchestration platforms suitable for deployment of the IBM VPC block storage CSI driver. +The following are the supported orchestration platforms suitable for deployment for IBM VPC Block CSI Driver. |Orchestration platform|Version|Architecture| |----------------------|-------|------------| |Red Hat® OpenShift®|4.7|x86| +|Red Hat® OpenShift®|4.8|x86| +|Kubernetes| 1.19|x86| +|Kubernetes| 1.20|x86| +|Kubernetes| 1.21|x86| # Prerequisites -To use the Block Storage for IBM VPC driver, complete the following tasks: +Following are the prerequisites to use the IBM VPC Block CSI Driver: -1. Create a cluster based on IBM VPC infrastructure +1. User should have either Red Hat® OpenShift® or kubernetes cluster on IBM VPC Gen 2 infrastructure. +2. Should have compatible orchestration platform. +3. Install and configure `ibmcloud is` CLI or get the required worker/node details from cloud.ibm.com +4. Cluster's worker node should have following labels, if not please apply labels before deploying IBM VPC Block CSI Driver. +``` +"ibm-cloud.kubernetes.io/worker-id" +"failure-domain.beta.kubernetes.io/region" +"failure-domain.beta.kubernetes.io/zone" +"topology.kubernetes.io/region" +"topology.kubernetes.io/zone" +``` + +## Apply worker labels + +Please use [`apply-required-setup.sh`](https://github.com/kubernetes-sigs/ibm-vpc-block-csi-driver/blob/master/scripts/apply-required-setup.sh) script for all the nodes in the cluster which will need couple of inputs like  + +`instanceID`:  That you can get from `ibmcloud is ins`  +`node-name`: this is as per node name in the kubernetes node check by using `kubectl get nodes` +`region-of-instanceID`:  region of the instanceID, this you can get the by using `ibmcloud is in ` +`zone-of-instanceID`: Zone of the instanceID, this you can get the by using `ibmcloud is in ` +ex :- ./apply-required-setup.sh # Build the driver -For building the driver `docker` and `GO` should be installed +For building the driver `docker` and `GO` should be installed on the system 1. On your local machine, install [`docker`](https://docs.docker.com/install/) and [`Go`](https://golang.org/doc/install). 2. GO version should be >=1.16 @@ -49,7 +73,7 @@ For building the driver `docker` and `GO` should be installed ## Push image to registry - Image should be pushed to any registry from which the worker nodes have access to pull + Image should be pushed to any registry from which cluster worker nodes have access to pull You can push the driver image to [docker.io](https://hub.docker.com/) registry or [IBM public registry](https://cloud.ibm.com/docs/Registry?topic=Registry-registry_overview#registry_regions_local) under your namespace. @@ -76,14 +100,14 @@ For building the driver `docker` and `GO` should be installed # Deploy CSI driver on your cluster -- Edit [slclient_Gen2.toml](https://github.com/kubernetes-sigs/ibm-vpc-block-csi-driver/blob/master/deploy/kubernetes/driver/kubernetes/slclient_Gen2.toml) for VPC Gen2 clusters. - +- Edit [slclient_Gen2.toml](https://github.com/kubernetes-sigs/ibm-vpc-block-csi-driver/blob/master/deploy/kubernetes/driver/kubernetes/slclient_Gen2.toml) for your cluster. VPC endpoints which supports Gen2 is documented [here](https://cloud.ibm.com/docs/vpc?topic=vpc-service-endpoints-for-vpc) - Install `kustomize` tool. The instructions are available [here](https://kubectl.docs.kubernetes.io/installation/kustomize/) -- Export cluster config -- Deploy CSI plugin on your cluster - - You can use any overlays available under `deploy/kubernetes/driver/kubernetes/overlays/` and edit the image tag +- Export cluster config i.e configuring kubectl command +- Deploy IBM VPC Block CSI Driver on your cluster + - You can use any overlays available under `deploy/kubernetes/driver/kubernetes/overlays/` and edit the image tag if you want to use your own build image from this source code, although defualt overalys are already using released IBM VPC Block CSI Driver image + - Example using `stage` overlay to update the image tag - Change `iks-vpc-block-driver` image name in `deploy/kubernetes/driver/kubernetes/overlays/stage/controller-server-images.yaml` - Change `iks-vpc-block-driver` image name in `deploy/kubernetes/driver/kubernetes/overlays/stage/node-server-images.yaml` @@ -119,15 +143,4 @@ Pull requests are very welcome! Make sure your patches are well tested. Ideally 5. Create new Pull Request -6. Add the test results in the PR - - -# Licensing - -Copyright 2020 IBM Corp. - -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. +6. Add the test results in the PR \ No newline at end of file diff --git a/scripts/apply-required-setup.sh b/scripts/apply-required-setup.sh new file mode 100644 index 00000000..674739e3 --- /dev/null +++ b/scripts/apply-required-setup.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +function help() +{ + echo "You need to run this script like as follows ...." + echo "./apply-required-setup.sh " + exit 1 +} + +function apply_labels() +{ + kubectl label nodes $1 "ibm-cloud.kubernetes.io/worker-id"=$2 + kubectl label nodes $1 "failure-domain.beta.kubernetes.io/region"=$3 + kubectl label nodes $1 "failure-domain.beta.kubernetes.io/zone"=$4 + kubectl label nodes $1 "topology.kubernetes.io/region"=$3 + kubectl label nodes $1 "topology.kubernetes.io/zone"=$4 +} + +function verify_node() +{ + kubectl get nodes | grep $1 + if (( $? == 0 )) + then + return 0 + else + return 1 + fi +} + +if (( $# < 4 )) +then + help +fi + +node=$1 +instanceID=$2 +region=$3 +zone=$4 + +verify_node $node +if (( $? == 0 )) +then + apply_labels $node $instanceID $region $zone +else + echo "Node " \'$node\' " not found in the cluster, please check the node or passing correct parameters while executing script" + help +fi +