-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds velero plugin for vsphere rock and sanity test
Adds the rock for the mentioned velero plugin. Note that we're only building for amd64, since the plugin depends on VDDX libraries from VMWare, and there doesn't seem to be support for arm64.
- Loading branch information
1 parent
b936b12
commit 6ad78e1
Showing
3 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Dockerfile: https://github.com/vmware-tanzu/velero-plugin-for-vsphere/blob/v1.5.2/Dockerfile-plugin | ||
name: velero-plugin-for-vsphere | ||
summary: Velero Plugin for vSphere rock | ||
description: | | ||
A rock containing the Velero Plugin for vSphere. | ||
Velero gives you tools to back up and restore your Kubernetes cluster | ||
resources and persistent volumes. | ||
license: Apache-2.0 | ||
version: 1.5.2 | ||
|
||
base: [email protected] | ||
build-base: [email protected] | ||
run-user: _daemon_ | ||
|
||
platforms: | ||
amd64: | ||
|
||
environment: | ||
APP_VERSION: 1.5.2 | ||
LD_LIBRARY_PATH: /plugins | ||
|
||
# Services to be loaded by the Pebble entrypoint | ||
services: | ||
install-plugin: | ||
override: replace | ||
startup: enabled | ||
command: /scripts/install.sh | ||
on-success: shutdown | ||
on-failure: shutdown | ||
|
||
parts: | ||
dependencies: | ||
plugin: dump | ||
# From: https://gvddk-libs.s3-us-west-1.amazonaws.com/VMware-vix-disklib-7.0.2-17696664.x86_64.tar.gz | ||
# From: https://github.com/vmware-tanzu/velero-plugin-for-vsphere/blob/v1.5.2/.github/workflows/ci.yml#L19 | ||
source: ./VMware-vix-disklib-7.0.2-17696664.x86_64.tar.gz | ||
source-type: tar | ||
override-build: | | ||
craftctl default | ||
# We need these libs for building and running the plugin. | ||
mkdir /usr/local/vmware-vix-disklib-distrib | ||
cp -r ./* /usr/local/vmware-vix-disklib-distrib/ | ||
organize: | ||
# The LD_LIBRARY_PATH is set to /plugins. | ||
lib64: ./plugins | ||
prime: | ||
- ./plugins | ||
|
||
build-plugin: | ||
after: [dependencies] | ||
plugin: go | ||
source: https://github.com/vmware-tanzu/velero-plugin-for-vsphere.git | ||
source-type: git | ||
source-tag: v${CRAFT_PROJECT_VERSION} | ||
source-depth: 1 | ||
build-snaps: | ||
- go/1.18/stable | ||
build-environment: | ||
- CGO_ENABLED: 1 | ||
- GO111MODULE: "on" | ||
- GOOS: linux | ||
- GOARCH: $CRAFT_ARCH_BUILD_FOR | ||
- VERSION: ${CRAFT_PROJECT_VERSION} | ||
- PKG: github.com/vmware-tanzu/velero-plugin-for-vsphere | ||
- REGISTRY: canonical | ||
- LDFLAGS: > | ||
-X ${PKG}/pkg/buildinfo.Version=${VERSION} -X ${PKG}/pkg/buildinfo.Registry=${REGISTRY} | ||
go-buildtags: | ||
- mod=readonly | ||
- installsuffix=static | ||
go-generate: | ||
- ./cmd/datamgr | ||
- ./cmd/backup-driver | ||
- ./cmd/plugin | ||
override-build: | | ||
craftctl default | ||
mkdir -p "${CRAFT_PART_INSTALL}/scripts/" | ||
cp scripts/install.sh "${CRAFT_PART_INSTALL}/scripts/" | ||
chmod +x "${CRAFT_PART_INSTALL}/scripts/install.sh" | ||
organize: | ||
bin/data-*: ./ | ||
bin/backup-driver*: ./ | ||
bin/velero-*: ./plugins/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# Copyright 2024 Canonical, Ltd. | ||
# | ||
|
||
import os | ||
|
||
from k8s_test_harness.util import docker_util | ||
|
||
ROCK_EXPECTED_FILES = [ | ||
"/backup-driver", | ||
"/data-manager-for-plugin", | ||
"/plugins/libvixDiskLib.so", | ||
"/plugins/velero-plugin-for-vsphere", | ||
"/scripts/install.sh", | ||
] | ||
|
||
|
||
def test_velero_plugin_for_vsphere_rock(): | ||
"""Test Velero plugin for vSphere rock.""" | ||
|
||
image_variable = "ROCK_VELERO_PLUGIN_FOR_VSPHERE" | ||
image = os.getenv(image_variable) | ||
assert image is not None, f"${image_variable} is not set" | ||
|
||
# check rock filesystem. | ||
docker_util.ensure_image_contains_paths(image, ROCK_EXPECTED_FILES) | ||
|
||
# check binaries. | ||
process = docker_util.run_in_docker(image, ["/backup-driver", "--help"]) | ||
assert "Backup driver is a component in Velero vSphere plugin" in process.stdout | ||
|
||
process = docker_util.run_in_docker(image, ["/data-manager-for-plugin", "--help"]) | ||
assert "Data manager is a component in Velero vSphere plugin" in process.stdout | ||
|
||
process = docker_util.run_in_docker( | ||
image, ["/plugins/velero-plugin-for-vsphere"], False | ||
) | ||
expected_err = ( | ||
"This binary is a plugin. These are not meant to be executed directly." | ||
) | ||
assert expected_err in process.stderr | ||
|
||
# check script. | ||
process = docker_util.run_in_docker(image, ["/scripts/install.sh"], False) | ||
assert "No namespace specified in the namespace file" in process.stdout |