Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ jobs:
uses: actions/checkout@v2
with:
path: src/github.com/vmware-tanzu/velero-plugin-for-vsphere
- name: Download essential GVDDK libraries
run: |
cd src/github.com/vmware-tanzu/velero-plugin-for-vsphere && mkdir .libs && cd .libs
wget --quiet https://gvddk-libs.s3-us-west-1.amazonaws.com/VMware-vix-disklib-7.0.2-17696664.x86_64.tar.gz
tar xzf VMware-vix-disklib-7.0.2-17696664.x86_64.tar.gz
chmod 644 $(find vmware-vix-disklib-distrib/lib64/ -type f)
- name: Make CI
env:
GOPATH: ${GITHUB_WORKSPACE}
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ jobs:
uses: actions/checkout@v4
with:
path: src/github.com/vmware-tanzu/velero-plugin-for-vsphere
- name: Download essential GVDDK libraries
run: |
cd src/github.com/vmware-tanzu/velero-plugin-for-vsphere && mkdir .libs && cd .libs
wget --quiet https://gvddk-libs.s3-us-west-1.amazonaws.com/VMware-vix-disklib-7.0.2-17696664.x86_64.tar.gz
tar xzf VMware-vix-disklib-7.0.2-17696664.x86_64.tar.gz
chmod 644 $(find vmware-vix-disklib-distrib/lib64/ -type f)
- name: Make CI
env:
GOPATH: ${GITHUB_WORKSPACE}
Expand Down
20 changes: 0 additions & 20 deletions Dockerfile-backup-driver

This file was deleted.

21 changes: 0 additions & 21 deletions Dockerfile-datamgr

This file was deleted.

4 changes: 0 additions & 4 deletions Dockerfile-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
FROM photon:5.0
RUN tdnf -y upgrade && tdnf clean all
ADD /bin/linux/amd64/velero-* /plugins/
ADD /bin/linux/amd64/data-* /
ADD /bin/linux/amd64/backup-driver* /
COPY /bin/linux/amd64/install.sh /scripts/
COPY /bin/linux/amd64/lib/vmware-vix-disklib/lib64/* /plugins/
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/plugins
RUN ["chmod", "+x", "/scripts/install.sh"]
ENTRYPOINT ["/bin/sh","/scripts/install.sh"]
97 changes: 12 additions & 85 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,15 @@

# This repo's root import path (under GOPATH).
PKG := github.com/vmware-tanzu/velero-plugin-for-vsphere
ASTROLABE:= github.com/vmware-tanzu/astrolabe


# The Virtual Disk Development Kit (VDDK) is required for interfacing with vSphere and VADP.
# Please refer to https://github.com/vmware/virtual-disks#dependency for the dependency.
# To compile plugin, we need to download the VDDK tarball
# under $(PKG)/.libs directory (create the directory if it unexists)
LIB_DIR := $(PKG)/.libs
VDDK_LIBS:= $(LIB_DIR)/vmware-vix-disklib-distrib/lib64

# The binary to build (just the basename).
PLUGIN_BIN ?= velero-plugin-for-vsphere
DATAMGR_BIN ?= data-manager-for-plugin
BACKUPDRIVER_BIN ?= backup-driver
VSPHERE_ASTROLABE ?= vsphere-astrolabe
BIN ?= $(PLUGIN_BIN)

RELEASE_REGISTRY = ?vsphereveleroplugin
REGISTRY ?= dpcpinternal
PLUGIN_IMAGE ?= $(REGISTRY)/$(PLUGIN_BIN)
DATAMGR_IMAGE ?= $(REGISTRY)/$(DATAMGR_BIN)
BACKUPDRIVER_IMAGE ?= $(REGISTRY)/$(BACKUPDRIVER_BIN)

# The default container runtime is docker, but others are supported (e.g. podman, nerdctl).
DOCKER ?= docker
Expand All @@ -60,50 +48,33 @@ GIT_DIRTY = $(shell git status --porcelain 2> /dev/null)
platform_temp = $(subst -, ,$(ARCH))
GOOS = $(word 1, $(platform_temp))
GOARCH = $(word 2, $(platform_temp))
SOURCE_PHOTON_IMAGE ?= golang:1.23
SOURCE_PHOTON_IMAGE ?= golang:1.25
BUILDER_IMAGE := $(SOURCE_PHOTON_IMAGE)
PLUGIN_DOCKERFILE ?= Dockerfile-plugin
DATAMGR_DOCKERFILE ?= Dockerfile-datamgr
BACKUPDRIVER_DOCKERFILE ?= Dockerfile-backup-driver

all: dep plugin vsphere-astrolabe

dep:
ifeq (,$(wildcard $(GOPATH)/src/$(VDDK_LIBS)))
$(error "$(GOPATH)/src/$(VDDK_LIBS) cannot find vddk libs in path. Please refer to: https://github.com/vmware/virtual-disks#dependency, download the VDDK tarball to the directory $(GOPATH)/src/$(LIB_DIR)/ and untar it")
endif
all: plugin

plugin: datamgr backup-driver
plugin:
@echo "making: $@"
$(MAKE) build BIN=$(PLUGIN_BIN) VERSION=$(VERSION)

datamgr:
@echo "making: $@"
$(MAKE) build BIN=$(DATAMGR_BIN) VERSION=$(VERSION)

backup-driver:
@echo "making: $@"
$(MAKE) build BIN=$(BACKUPDRIVER_BIN) VERSION=$(VERSION)

vsphere-astrolabe:
@echo "making: $@"
$(MAKE) build BIN=$(VSPHERE_ASTROLABE) VERSION=$(VERSION)

local: build-dirs
GOOS=$(GOOS) \
GOARCH=$(GOARCH) \
PKG=$(PKG) \
BIN=$(BIN) \
REGISTRY=$(REGISTRY) \
VERSION=$(VERSION) \
GIT_SHA=$(GIT_SHA) \
GIT_DIRTY="$(GIT_DIRTY)" \
OUTPUT_DIR=$$(pwd)/_output/bin/$(GOOS)/$(GOARCH) \
GO111MODULE=on \
GOFLAGS=-mod=readonly \
GOFLAGS=-mod=readonly \
./hack/build.sh

build: _output/bin/$(GOOS)/$(GOARCH)/$(BIN)

_output/bin/$(GOOS)/$(GOARCH)/$(BIN): build-dirs copy-astrolabe
_output/bin/$(GOOS)/$(GOARCH)/$(BIN): build-dirs
@echo "building: $@"
$(MAKE) shell CMD="-c '\
GOOS=$(GOOS) \
Expand All @@ -129,7 +100,6 @@ shell: build-dirs
-i $(TTY) \
--rm \
-u $$(id -u):$$(id -g) \
-v $$(pwd)/.libs/vmware-vix-disklib-distrib:/usr/local/vmware-vix-disklib-distrib:delegated \
-v $$(pwd)/.go/pkg:/go/pkg:delegated \
-v $$(pwd)/.go/src:/go/src:delegated \
-v $$(pwd)/.go/std:/go/std:delegated \
Expand All @@ -147,94 +117,51 @@ build-dirs:
@mkdir -p _output/bin/$(GOOS)/$(GOARCH)
@mkdir -p .go/src/$(PKG) .go/pkg .go/bin .go/std/$(GOOS)/$(GOARCH) .go/go-build

copy-astrolabe:
ifeq (,$(wildcard $(GOPATH)/src/$(ASTROLABE)))
@echo "skip copying astrolabe as it is not available at $(GOPATH)/src/$(ASTROLABE)"
else
@echo "copy astrolabe to .go/src directory"
@rm -rf $$(pwd)/.go/src/$(ASTROLABE)
@mkdir -p $$(pwd)/.go/src/$(ASTROLABE)
@cp -R $(GOPATH)/src/$(ASTROLABE)/* $$(pwd)/.go/src/$(ASTROLABE)
endif


container-name:
@echo "container: $(IMAGE):$(VERSION)"

copy-vix-libs:
mkdir -p _output/bin/$(GOOS)/$(GOARCH)/lib/vmware-vix-disklib/lib64
cp -R $(GOPATH)/src/$(VDDK_LIBS)/* _output/bin/$(GOOS)/$(GOARCH)/lib/vmware-vix-disklib/lib64
# Some of the libraries have the executable bit set and this causes plugin startup to fail
chmod 644 _output/bin/$(GOOS)/$(GOARCH)/lib/vmware-vix-disklib/lib64/*

copy-install-script:
cp $$(pwd)/scripts/install.sh _output/bin/$(GOOS)/$(GOARCH)

build-container: copy-vix-libs container-name
build-container: container-name
cp $(DOCKERFILE) _output/bin/$(GOOS)/$(GOARCH)/$(DOCKERFILE)
$(DOCKER) build --platform $(GOOS)/$(GOARCH) -t $(IMAGE):$(VERSION) -f _output/bin/$(GOOS)/$(GOARCH)/$(DOCKERFILE) _output

plugin-container: all copy-install-script
$(MAKE) build-container IMAGE=$(PLUGIN_IMAGE) DOCKERFILE=$(PLUGIN_DOCKERFILE) VERSION=$(VERSION)

datamgr-container: datamgr
$(MAKE) build-container BIN=$(DATAMGR_BIN) IMAGE=$(DATAMGR_IMAGE) DOCKERFILE=$(DATAMGR_DOCKERFILE) VERSION=$(VERSION)

backup-driver-container: backup-driver
$(MAKE) build-container BIN=$(BACKUPDRIVER_BIN) IMAGE=$(BACKUPDRIVER_IMAGE) DOCKERFILE=$(BACKUPDRIVER_DOCKERFILE) VERSION=$(VERSION)

container: plugin-container datamgr-container backup-driver-container

update:
@echo "updating CRDs"
./hack/update-generated-crd-code.sh
container: plugin-container

push-plugin: plugin-container
$(DOCKER) push $(PLUGIN_IMAGE):$(VERSION)

push-datamgr: datamgr-container
$(DOCKER) push $(DATAMGR_IMAGE):$(VERSION)

push-backup-driver: backup-driver-container
$(DOCKER) push $(BACKUPDRIVER_IMAGE):$(VERSION)

push: push-datamgr push-plugin push-backup-driver
push: push-plugin

QUALIFIED_TAG ?=
RELEASE_TAG ?= latest
release:
ifneq (,$(QUALIFIED_TAG))
$(DOCKER) pull $(DATAMGR_IMAGE):$(QUALIFIED_TAG)
$(DOCKER) pull $(PLUGIN_IMAGE):$(QUALIFIED_TAG)
$(DOCKER) pull $(BACKUPDRIVER_IMAGE):$(QUALIFIED_TAG)
$(DOCKER) tag $(BACKUPDRIVER_IMAGE):$(QUALIFIED_TAG) $(RELEASE_REGISTRY)/$(BACKUPDRIVER_BIN):$(RELEASE_TAG)
$(DOCKER) tag $(DATAMGR_IMAGE):$(QUALIFIED_TAG) $(RELEASE_REGISTRY)/$(DATAMGR_BIN):$(RELEASE_TAG)
$(DOCKER) tag $(PLUGIN_IMAGE):$(QUALIFIED_TAG) $(RELEASE_REGISTRY)/$(PLUGIN_BIN):$(RELEASE_TAG)
$(DOCKER) push $(RELEASE_REGISTRY)/$(BACKUPDRIVER_BIN):$(RELEASE_TAG)
$(DOCKER) push $(RELEASE_REGISTRY)/$(DATAMGR_BIN):$(RELEASE_TAG)
$(DOCKER) push $(RELEASE_REGISTRY)/$(PLUGIN_BIN):$(RELEASE_TAG)
endif

verify:
@echo "verify: Started"
@echo "verify: Completed"

TARGETS ?= ./pkg/...
TIMEOUT ?= 300s
VERBOSE ?= # empty by default
DISABLE_CACHE ?= # empty by default
RUN_SINGLE_CASE ?= # empty by default
test: build-dirs
@$(MAKE) shell CMD="-c '\
VDDK_LIBS=$(VDDK_LIBS) \
TARGETS=$(TARGETS) \
TIMEOUT=$(TIMEOUT) \
VERBOSE=$(VERBOSE) \
DISABLE_CACHE=$(DISABLE_CACHE) \
RUN_SINGLE_CASE=$(RUN_SINGLE_CASE) \
hack/test.sh'"

ci: all verify test
ci: all test

clean:
@echo "cleaning"
Expand Down
43 changes: 7 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

![Velero Plugin For vSphere CICD Pipeline](https://github.com/vmware-tanzu/velero-plugin-for-vsphere/workflows/Velero%20Plugin%20For%20vSphere%20CICD%20Pipeline/badge.svg)

The main branch of this repo contains code for the upcoming Velero vSphere Plugin 2.0. This is a breaking change. Velero vSphere Plugin 1.6.x and earlier, including the Backup Driver and the Data Mover, are not supported by Velero vSphere Plugin 2.0. If you need information regarding an earlier release, please refer to [release-1.16 document](https://github.com/vmware-tanzu/velero-plugin-for-vsphere/tree/release-1.6?tab=readme-ov-file#velero-plugin-for-vsphere).


## Overview

This repository contains the Velero Plugin for vSphere. This plugin provides crash-consistent snapshots of vSphere block volumes and backup of volume data into S3 compatible storage.
This repository contains the Velero Plugin for vSphere. This plugin provides plugins for velero based on [go-plugin](https://github.com/hashicorp/go-plugin).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the very beginning of README, please add a section like this:

The main branch of this repo contains code for the upcoming Velero vSphere Plugin 2.0. This is a breaking change. Velero vSphere Plugin 1.6.x and earlier, including the Backup Driver and the Data Mover, are not supported by Velero vSphere Plugin 2.0. If you need information regarding an earlier release, please refer to https://github.com/vmware-tanzu/velero-plugin-for-vsphere/tree/release-1.6.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

The plugins are BackupItemAction and RestoreItemAction to filter resources for backup and restore. Furthermore, the RestoreItemAction also makes some necessary modifications for the VKS resources.

## Releases

Expand All @@ -14,42 +18,9 @@ For releases, please refer to the [releases](https://github.com/vmware-tanzu/vel

**Velero Plugin for vSphere** supports the following Kubernetes distributions:

- [Vanilla Kubernetes](https://github.com/kubernetes/kubernetes)
- [vSphere with Tanzu](https://blogs.vmware.com/vsphere/2019/08/introducing-project-pacific.html)
- [Tanzu Kubernetes Grid Service/TKGS](https://blogs.vmware.com/vsphere/2020/03/vsphere-7-tanzu-kubernetes-clusters.html)

For more information on **vSphere with Tanzu**, (formerly known as **vSphere with Kubernetes** and **Project Pacific**), and especially for information about the role of the Supervisor Cluster, please see [vSphere with Tanzu Configuration and Management](https://docs.vmware.com/en/VMware-vSphere/7.0/vmware-vsphere-with-kubernetes/GUID-152BE7D2-E227-4DAA-B527-557B564D9718.html).

For more information on TKGS, the ```Tanzu Kubernetes Grid Service```, please see [Provisioning and Managing Tanzu Kubernetes Clusters Using the Tanzu Kubernetes Grid Service](https://docs.vmware.com/en/VMware-vSphere/7.0/vmware-vsphere-with-kubernetes/GUID-7E00E7C2-D1A1-4F7D-9110-620F30C02547.html).

## Important note on vSphere with Tanzu networking requirements

**vSphere with Tanzu** supports two distinct networking deployments with the release of vSphere 7.0 Update 1 (U1). The first deployment leverages ```NSX-T``` to provide load balancing services as well as overlay networking for Pod VM to Pod VM communication in the Supervisor Cluster. The second networking configuration supported by vSphere with Tanzu uses native vSphere network distributed switches and a ```HA Proxy``` to provide load balancing services. Native vSphere networking does not provide any overlay networking capabilities, and thus this deployment does not currently support Pod VMs in the Supervisor. Since Pod VMs are a requirement when wish to use the **Velero Plugin for vSphere** in vSphere with Tanzu, it currently requires a networking deployment that uses NSX-T. vSphere with Tanzu deployments that use native vSphere distributed switch networking and the HA Proxy for load balancing cannot currently be backed up using the Velero Plugin for vSphere.

**TKGS** is the Tanzu Kubernetes Grid Service, a service available in vSphere with Tanzu to enable the deployment of TKG (guest) clusters in vSphere with Tanzu namespaces. Whilst TKGS is available in both deployments types of vSphere with Tanzu (NSX-T and native vSphere networking), the ability to backup TKGS guest clusters also requires the Supervisor Cluster to have the Velero Plugin for vSphere to be installed in the Supervisor Cluster. Since this is not possible with vSphere with Tanzu which uses native vSphere distributed switch networking, the Velero Plugin for vSphere is currently unable to backup and restore TKG guest clustes in these deployments.

## Architecture

Velero handles Kubernetes metadata during backup and retore. Velero relies on its plugin to backup and retore PVCs. Velero Plugin for vSphere includes the following components:
* Velero vSphere Operator - a Supervisor Service that helps users install Velero and its vSphere plugin on the Supervisor Cluster; must be enabled through vSphere UI to support backup and restore on Supervisor and Guest Clusters
* vSphere Plugin - deployed with Velero; called by Velero to backup and restore a PVC
* Backupdriver - handles the backup and restore of PVCs; relies on the Data Mover to upload or download data
* Data Mover - handles upload of snapshot data to object store and download of snapshot data from object store
* Note: The Data Mover is only functionally tested and it is not meant to work at scale and does not promise any performance expectations. It is not meant to backup business critical applications in production.

![Velero Plugin for vSphere Architecture](docs/vsphere-plugin-architecture.png)

Backup and restore workflows are described in details [here](docs/backup-restore-workflows.md).

## Velero Plugin for vSphere Installation and Configuration details

For details on how to use Velero Plugin for vSphere for each Kubernetes flavor, refer to the following documents:

- [Guide for Vanilla Kubernetes](docs/vanilla.md)
- [Guide for vSphere with Tanzu](docs/supervisor.md)
- [Guide for Tanzu Kubernetes Grid Service](docs/guest.md)
- vSphere Kubernetes Service/VKS

Note: Velero needs to be installed in each TKG workload cluster.
For more information on VKS supervisor, the ```VCF Kubernetes Service supervisor```, please see [Managing vSphere Kubernetes Service with vSphere Supervisor](https://techdocs.broadcom.com/us/en/vmware-cis/vcf/vsphere-supervisor-services-and-standalone-components/latest/managing-vsphere-kubernetes-service.html).

## Known issues

Expand Down
34 changes: 0 additions & 34 deletions cmd/backup-driver/main.go

This file was deleted.

Loading
Loading