How to start contributing to mayactl

What is mayactl?

  • mayactl is the command line tool for interacting with OpenEBS volumes. mayactl is not used/required while provisioning or managing the OpenEBS volumes, but it is currently used while debugging and troubleshooting.
  • mayactl is the client like kubectl which requests to maya-apiserver to get specific information whereas kubectl requests to Kubernetes apiserver to get specific information.
  • mayactl helps retrieve storage related information for debugging/troubleshooting storage related issues. mayactl provides various commands to create volume, get volume details and create, list and revert snapshot and many more.

To know more about mayactl visit:

https://docs.openebs.io/docs/next/mayactl.html

To know about the OpenEBS visit: https://docs.openebs.io/docs/next/introduction.html

These few things are required to be installed in your system (with Ubuntu host) to run mayactl

  1. Docker
  • To install docker run these commands
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker.io
  • Or you can visit the official docker website to install docker

2. open-iscsi package

  • To install open-iscsi package run these commands
sudo apt-get update
sudo apt-get install open-iscsi
sudo service open-iscsi restart

3. Golang

4. Minikube

  • To install minikube run these commands
# minikube requires virtualbox to be installed as a dependency
sudo apt-get install virtualbox virtualbox-ext-pack
sudo apt-get update
# minikube version 0.24.0
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

5. Kubectl

  • To install kubectl run these commands
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

How to run mayactl in your local machine for the development purpose?

  1. Open the openebs repo (link — https://github.com/openebs/openebs) and star the openebs repo.. 😄 (Not Mandatory)
  2. Fork the openebs and maya repo into you github account.
  • visit and click on fork option (both repo)

3. Clone the openebs and maya repo inside your gopath.

  • Run these following commands to clone
# if directories not present create the directories in same hierarchy
cd $GOPATH/src/github.com/openebs
git clone https://github.com/<your-github-username>/openebs.git
git clone https://github.com/<your-github-username>/maya.git

4. Run the single node cluster using minikube command

minikube start --vm-driver=none
# To check whether minikube is configured and running
minikube status

5. Installing openebs

  • To install openebs run these following commands
cd $GOPATH/src/github.com/openebs/openebs/k8s/
kubectl apply -f openebs-operator.yaml
kubectl apply -f openebs-storageclasses.yaml

6. Now we have running openebs-provisioner and maya-apiserver as a pod in kubernetes (minikube) cluster

  • To get pods, run this command
kubectl get pods
NAME                                   READY     STATUS    RESTARTS   AGE
maya-apiserver-7b8d5496cc-kgmnn 1/1 Running 0 3m
openebs-provisioner-6797d44769-phnnc 1/1 Running 2 3m

7. Now to run/access mayactl you will have to login/execute into the maya-apiserver pod on Kubernetes.

  • Find out the name of the maya api-server pod, to find the name of the maya-apiserver pod and login/exec into the pod run these following commands
kubectl get pods
# It will access the bash shell inside the pod
kubectl exec -it <maya-apiserver-podname> /bin/bash

8. Now you can run all the mayactl commands as you are inside the maya-apiserver pod

  • Try running these command after exec/login into pod
mayactl -help

Go through the issues (https://github.com/openebs/maya/issues) start modifying the code of mayactl which is in $GOPATH/src/github.com/openebs/maya/cmd/mayactl and start contributing to OpenEBS. Also you can start contributing by writing small unit tests code in mayactl. For every PR you raise you will also get a goodies from the OpenEBS team. 😃

How to test the changes you made in mayactl?

  1. After modifying the mayactl code go into the maya directory i.e $GOPATH/src/github.com/openebs/maya and run these commands
# run this if not currently in maya directory
cd $GOPATH/src/github.com/openebs/maya
# this will create the mayactl binary into the bin folder inside maya directory
make mayactl

2. After the build has been completed copy the mayactl binary from bin folder to maya-apiserver pod using the command

kubectl cp $GOPATH/src/github.com/openebs/maya/bin/maya/mayactl <maya-apiserver-podname>:/tmp/

3. login/execute into the maya-apiserver pod to run mayactl binary

kubectl exec -it <maya-apiserver-podname> /bin/bash
cd /tmp/

4. Here the mayactl binary is present which you copied

  • To run that binary use
./mayactl -help

Now you can see the changes you made in mayactl command line tool. And also you are ready to raise the PR’s. 😃

Reference: