Skip to content

saima-s/data-restore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

data-restore

Table of Contents

Introduction

Getting Started

Run Code

Reference

Introduction

The data-restore is a custom kubernetes controller written in Go. Following are the key features of this controller:

  1. Watch on newly create CR(Snap, Restore).
  2. On Addition of custom(Snap) CR, it takes snapshot of PVC.
  3. On Addition of custom(restore) CR, it takes the backup the snapshot created into a new PVC.

Getting started

Below instruction will help in setting up project locally as well as up and running in cluster:

Dependencies:

To run the controller on Local System,need to install following Software Dependencies.

Go

Docker

Minikube

Run code

Locally

To run the data-restore controller on local machine:

  1. Open a terminal and run below commands:
go build
./data-restore
  1. Create a snapCR custom resource by following command:
 cd manifests/kubectl create -f snapCR.yaml
  1. Create a restoreCR custom resource by following command:
 cd manifests/kubectl create -f restoreCR.yaml

Cluster

Start cluster and enable addon:

 minikube start
minikube addons enable volumesnapshots
minikube addons enable csi-hostpath-driver

To run application on cluster:

  1. Dockerize application by writing Dockerfile. Build and push image to docker hub repository here.
  2. Create service account, clusterrole and clusterrolebinding to access custom resource and watch it by running following command:
cd manifests/kubectl create -f sa.yaml
cd manifests/kubectl create -f role.yaml
  1. Deploy the application by running following command:
 cd manifests/kubectl create -f deployment.yaml
  1. exec into pod and run:
./data-restore

References

  1. https://pkg.go.dev/k8s.io/client-go
  2. https://pkg.go.dev/k8s.io/apimachinery
  3. https://pkg.go.dev/github.com/mitchellh/go-homedir
  4. https://minikube.sigs.k8s.io/docs/tutorials/volume_snapshots_and_csi/
  5. https://pkg.go.dev/github.com/kubernetes-csi/external-snapshotter/v6

Docker commands

  1. docker build -t data-restore:10.0.0 .
  2. docker tag data-restore:10.0.0 sultanasaima/data-restore:10.0.0
  3. docker push sultanasaima/data-restore:10.0.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published