Skip to content

Add support for static storage container name #215

Add support for static storage container name

Add support for static storage container name #215

Workflow file for this run

---
name: Integration tests with Kind and DevStack
on: [pull_request]
jobs:
lint:
name: "Linters (go v${{ matrix.go-version }})"
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: [ '1.20' ]
steps:
- name: Checkout velero-plugin-for-openstack
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Check formatting
run: |
test -z $(gofmt -l -s ./)
- name: Check go vet
run: |
go vet ./...
- name: Verify dependencies
run: |
go mod verify
- name: Check if plugin can be built
run: |
go build -v .
unit-test:
name: "Unit tests (go v${{ matrix.go-version }})"
needs: lint
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: [ '1.20' ]
steps:
- name: Checkout velero-plugin-for-openstack
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run unit tests
run: |
go test -v ./...
integration-test:
name: "Integration tests (go v${{ matrix.go-version }})"
needs: unit-test
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: [ '1.20' ]
env:
VELERO_CLI_VERSION: 1.11.0
# Contains Velero 1.11.0
VELERO_CHART_VERSION: 4.0.1
VELERO_RESTORE_NAME: my-test-restore-01
VELERO_BACKUP_NAME: my-test-backup-01
# From tag 1.27.x
CINDER_CSI_CHART_VERSION: 2.27.3
MANILA_CSI_CHART_VERSION: 2.27.3
DOCKER_IMAGE_NAME: velero-plugin-for-openstack
SWIFT_CONTAINER_NAME: my-swift-container
TESTS_DIRECTORY: tests/actions/integration-tests
steps:
- name: Checkout velero-plugin-for-openstack
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build Docker image
run: |
docker buildx build \
--file docker/Dockerfile \
--tag "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" \
--build-arg VERSION=${GITHUB_REF_NAME} \
--build-arg GIT_SHA=${GITHUB_SHA} \
--platform linux/amd64 \
--load \
.
- name: Install Kind
uses: helm/[email protected]
with:
# Kubernetes 1.27.x
version: v0.20.0
cluster_name: kind
wait: 120s
- name: Load new velero-plugin-for-openstack image to kind cluster
run: |
kind load docker-image "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}"
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 'v3.14.1'
- name: Install Velero CLI
run: |
wget --quiet "https://github.com/vmware-tanzu/velero/releases/download/v${VELERO_CLI_VERSION}/velero-v${VELERO_CLI_VERSION}-linux-amd64.tar.gz"
tar -zxvf "velero-v${VELERO_CLI_VERSION}-linux-amd64.tar.gz"
sudo mv "velero-v${VELERO_CLI_VERSION}-linux-amd64/velero" /usr/local/bin/velero
chmod 750 /usr/local/bin/velero
- name: Deploy DevStack
uses: EmilienM/[email protected]
with:
branch: 'stable/2023.2'
enable_workaround_docker_io: 'false'
conf_overrides: |
SWIFT_ENABLE_TEMPURLS=True
SWIFT_TEMPURL_KEY=secretkey
SWIFT_HASH=12394u39845623984j28hf93d9173
SWIFT_DEFAULT_BIND_PORT=15492
SERVICE_TIMEOUT=200
enable_service key rabbit mysql s-proxy s-object s-container s-account c-bak c-api c-vol c-sch n-api n-crt n-cpu n-cond n-sch n-api-meta n-sproxy placement-api placement-client
CINDER_ISCSI_HELPER=tgtadm
enable_plugin manila https://github.com/openstack/manila stable/2023.2
# LVM Backend config options
MANILA_SERVICE_IMAGE_ENABLED=False
SHARE_DRIVER=manila.share.drivers.lvm.LVMShareDriver
MANILA_ENABLED_BACKENDS=chicago,denver
MANILA_BACKEND1_CONFIG_GROUP_NAME=chicago
MANILA_BACKEND2_CONFIG_GROUP_NAME=denver
MANILA_SHARE_BACKEND1_NAME=CHICAGO
MANILA_SHARE_BACKEND2_NAME=DENVER
MANILA_OPTGROUP_chicago_driver_handles_share_servers=False
MANILA_OPTGROUP_denver_driver_handles_share_servers=False
SHARE_BACKING_FILE_SIZE=32000M
MANILA_DEFAULT_SHARE_TYPE_EXTRA_SPECS='snapshot_support=True create_share_from_snapshot_support=True revert_to_snapshot_support=True mount_snapshot_support=True'
MANILA_CONFIGURE_DEFAULT_TYPES=True
MANILA_INSTALL_TEMPEST_PLUGIN_SYSTEMWIDE=false
- name: Prepare Swift container for velero backups
run: |
source "${{ github.workspace }}/devstack/openrc"
source "/opt/stack/data/venv/bin/activate"
SWIFT_TMP_URL_KEY=$(dd if=/dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
swift post "${SWIFT_CONTAINER_NAME}"
swift post -m "Temp-URL-Key:${SWIFT_TMP_URL_KEY}"
- name: Install Velero helm chart
run: |
export HOST_IP=$(hostname -I | awk '{print $1}')
export OS_AUTH_URL=$(echo -n "http://${HOST_IP}/identity" | base64)
envsubst < "${TESTS_DIRECTORY}/velero-credentials.yaml" > "${TESTS_DIRECTORY}/velero-credentials-templated.yaml"
kubectl create namespace velero
kubectl apply -f "${TESTS_DIRECTORY}/velero-credentials-templated.yaml"
helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
helm repo update
helm install velero vmware-tanzu/velero \
--namespace velero \
--version "${VELERO_CHART_VERSION}" \
--values "${TESTS_DIRECTORY}/velero-helm-values.yaml" \
--set "initContainers[0].image=${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" \
--timeout 10m \
--wait \
--wait-for-jobs
- name: Create test backup and validate it
run: |
# Create Cinder/Manila PVC
# Checks
velero backup-location get
velero snapshot-location get
# Do backup
velero backup create --storage-location swift "${VELERO_BACKUP_NAME}"
sleep 120
kubectl logs -n velero -l app.kubernetes.io/name=velero
velero describe backups "${VELERO_BACKUP_NAME}"
velero backup logs "${VELERO_BACKUP_NAME}"
if ! velero describe backups "${VELERO_BACKUP_NAME}" | grep -q "^Phase:.*Completed"; then
echo "Backup ${VELERO_BACKUP_NAME} failed";
exit 1
else
echo "Backup ${VELERO_BACKUP_NAME} was successful";
fi
# Do restore
velero restore create "${VELERO_RESTORE_NAME}" --from-backup "${VELERO_BACKUP_NAME}"
sleep 120
kubectl logs -n velero -l app.kubernetes.io/name=velero
velero describe restore "${VELERO_RESTORE_NAME}"
velero restore logs "${VELERO_RESTORE_NAME}"
if ! velero describe restore "${VELERO_RESTORE_NAME}" | grep -q "^Phase:.*Completed"; then
echo "Restore ${VELERO_RESTORE_NAME} failed";
exit 1
else
echo "Restore ${VELERO_RESTORE_NAME} was successful";
fi