Documentation for version v1.1.0 is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
kubectl installedmkdir $HOME/go
export GOPATH=$HOME/go
go get github.com/vmware-tanzu/velero
Where go is your
import path for Go.
For Go development, it is recommended to add the Go import path ($HOME/go in this example) to your path.
Download the archive named Source code from the
release page and extract it in your Go import path as src/github.com/vmware-tanzu/velero.
Note that the Makefile targets assume building from a git repository. When building from an archive, you will be limited to the go build commands described below.
There are a number of different ways to build velero depending on your needs. This section outlines the main possibilities.
When building by using make, it will place the binaries under _output/bin/$GOOS/$GOARCH. For example, you will find the binary for darwin here: _output/bin/darwin/amd64/velero, and the binary for linux here: _output/bin/linux/amd64/velero. make will also splice version and git commit information in so that velero version displays proper output.
Note: velero install will also use the version information to determine which tagged image to deploy. If you would like to overwrite what image gets deployed, use the image flag (see below for instructions on how to build images).
To build the velero binary on your local machine, compiled for your OS and architecture, run one of these two commands:
go build ./cmd/velero
make local
To build the velero binary targeting linux/amd64 within a build container on your local machine, run:
make build
For any specific platform, run make build-<GOOS>-<GOARCH>.
For example, to build for the Mac, run make build-darwin-amd64.
Velero’s Makefile has a convenience target, all-build, that builds the following platforms:
If after installing Velero you would like to change the image used by its deployment to one that contains your code changes, you may do so by updating the image:
kubectl -n velero set image deploy/velero velero=myimagerepo/velero:$VERSION
To build a Velero container image, first set the $REGISTRY environment variable. For example, if you want to build the gcr.io/my-registry/velero:main image, set $REGISTRY to gcr.io/my-registry. If this variable is not set, the default is gcr.io/heptio-images.
Optionally, set the $VERSION environment variable to change the image tag. Then, run:
make container
To push your image to the registry, run:
make push
Note: if you want to update the image but not change its name, you will have to trigger Kubernetes to pick up the new image. One way of doing so is by deleting the Velero deployment pod:
kubectl -n velero delete pods -l deploy=velero
To help you get started, see the documentation.