Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Vitess Dependency to Latest #659

Merged
merged 7 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/controller-tools v0.16.1
sigs.k8s.io/kustomize v2.0.3+incompatible
vitess.io/vitess v0.10.3-0.20250124174950-8412fe81d4a5
vitess.io/vitess v0.10.3-0.20250201220950-78c7470f540e
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -866,5 +866,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77Vzej
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
vitess.io/vitess v0.10.3-0.20250124174950-8412fe81d4a5 h1:zA8m6IgiK7+AfaUV+1MuXasnnUnhk4OpZNc9S6GhMIg=
vitess.io/vitess v0.10.3-0.20250124174950-8412fe81d4a5/go.mod h1:kKWkRaLpz9Dox87PUiWDS3N5oHWV/eAvNRRnalnyD88=
vitess.io/vitess v0.10.3-0.20250201220950-78c7470f540e h1:SxFz1k7oiefC2bMQ+fe/gZRFb4ZGdR4J1mwFMISScBA=
vitess.io/vitess v0.10.3-0.20250201220950-78c7470f540e/go.mod h1:kKWkRaLpz9Dox87PUiWDS3N5oHWV/eAvNRRnalnyD88=
5 changes: 1 addition & 4 deletions test/endtoend/backup_restore_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@ echo "Building the docker image"
docker build -f build/Dockerfile.release -t vitess-operator-pr:latest .
echo "Setting up the kind config"
setupKindConfig
echo "Creating Kind cluster"
kind create cluster --wait 30s --name kind-${BUILDKITE_BUILD_ID} --config ./vtdataroot/config.yaml --image ${KIND_VERSION}
echo "Loading docker image into Kind cluster"
kind load docker-image vitess-operator-pr:latest --name kind-${BUILDKITE_BUILD_ID}
createKindCluster

cd "$PWD/test/endtoend/operator"
killall kubectl
Expand Down
39 changes: 15 additions & 24 deletions test/endtoend/backup_schedule_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,30 @@ function verifyListBackupsOutputWithSchedule() {
checkVitessBackupScheduleStatusWithTimeout "example-vbsc-every-five-minute(.*)"

echo -e "Check for number of backups in the cluster"
# Sleep for 6 minutes, during this time we should have at the very minimum 7 backups.
# At least: 6 backups from the every-minute schedule, and 1 backup from the every-five-minute schedule.
sleep 360
# Sleep for over 6 minutes, during this time we should have at the very minimum
# 7 backups. At least: 6 backups from the every-minute schedule, and 1 backup
# from the every-five-minute schedule.
for i in {1..6} ; do
# Ensure that we can view the backup files from the host.
docker exec -it $(docker container ls --format '{{.Names}}' | grep kind) chmod o+rwx -R /backup > /dev/null

backupCount=$(kubectl get vtb --no-headers | wc -l)
backupCount=$(kubectl get vtb --no-headers | wc -l)
echo "Found ${backupCount} backups"
if [[ "${backupCount}" -ge 7 ]]; then
break
fi
sleep 100
done
if [[ "${backupCount}" -lt 7 ]]; then
echo "Did not find at least 7 backups"
return 0
exit 1
fi

echo -e "Check for Jobs' pods"
checkPodStatusWithTimeout "example-vbsc-every-minute-(.*)0/1(.*)Completed(.*)" 3
checkPodStatusWithTimeout "example-vbsc-every-five-minute-(.*)0/1(.*)Completed(.*)" 2
}

function setupKindConfig() {
if [[ "$BUILDKITE_BUILD_ID" != "0" ]]; then
# The script is being run from buildkite, so we can't mount the current
# working directory to kind. The current directory in the docker is workdir
# So if we try and mount that, we get an error. Instead we need to mount the
# path where the code was checked out be buildkite
dockerContainerName=$(docker container ls --filter "ancestor=docker" --format '{{.Names}}')
CHECKOUT_PATH=$(docker container inspect -f '{{range .Mounts}}{{ if eq .Destination "/workdir" }}{{println .Source }}{{ end }}{{end}}' "$dockerContainerName")
BACKUP_DIR="$CHECKOUT_PATH/vtdataroot/backup"
else
BACKUP_DIR="$PWD/vtdataroot/backup"
fi
cat ./test/endtoend/kindBackupConfig.yaml | sed "s,PATH,$BACKUP_DIR,1" > ./vtdataroot/config.yaml
}

# Test setup
STARTING_DIR="$PWD"
echo "Make temporary directory for the test"
Expand All @@ -69,10 +63,7 @@ echo "Building the docker image"
docker build -f build/Dockerfile.release -t vitess-operator-pr:latest .
echo "Setting up the kind config"
setupKindConfig
echo "Creating Kind cluster"
kind create cluster --wait 30s --name kind-${BUILDKITE_BUILD_ID} --config ./vtdataroot/config.yaml --image ${KIND_VERSION}
echo "Loading docker image into Kind cluster"
kind load docker-image vitess-operator-pr:latest --name kind-${BUILDKITE_BUILD_ID}
createKindCluster

cd "$PWD/test/endtoend/operator"
killall kubectl
Expand Down
52 changes: 35 additions & 17 deletions test/endtoend/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,30 @@ function takeBackup() {
initialBackupCount=$(kubectl get vtb --no-headers | wc -l)
finalBackupCount=$((initialBackupCount+1))

# issue the backupShard command to vtctldclient
# Issue the BackupShard command to vtctldclient.
vtctldclient BackupShard "$keyspaceShard"

for i in {1..600} ; do
out=$(kubectl get vtb --no-headers | wc -l)
echo "$out" | grep "$finalBackupCount" > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "Backup created"
return 0
fi
sleep 3
done
echo -e "ERROR: Backup not created - $out. $backupCount backups expected."
exit 1
if [[ $? -ne 0 ]]; then
echo "Backup failed"
exit 1
fi
# Ensure that we can view the backup files from the host.
docker exec -it $(docker container ls --format '{{.Names}}' | grep kind) chmod o+rwx -R /backup > /dev/null
echo "Backup completed"
}

function verifyListBackupsOutput() {
backupCount=$(kubectl get vtb --no-headers | wc -l)
for i in {1..600} ; do
out=$(vtctldclient LegacyVtctlCommand -- ListBackups "$keyspaceShard" | wc -l)
for i in {1..30} ; do
backupCount=$(kubectl get vtb --no-headers | wc -l)
out=$(vtctldclient GetBackups "$keyspaceShard" | wc -l)
echo "$out" | grep "$backupCount" > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "ListBackupsOutputCorrect"
echo "GetBackups output is correct"
return 0
fi
sleep 3
done
echo -e "ERROR: ListBackups output not correct - $out. $backupCount backups expected."
echo -e "ERROR: GetBackups output not correct - $out. $backupCount backups expected."
exit 1
}

Expand Down Expand Up @@ -274,6 +270,28 @@ function setupKubectlAccessForCI() {
fi
}

function setupKindConfig() {
if [[ "$BUILDKITE_BUILD_ID" != "0" ]]; then
# The script is being run from buildkite, so we can't mount the current
# working directory to kind. The current directory in the docker is workdir
# So if we try and mount that, we get an error. Instead we need to mount the
# path where the code was checked out be buildkite
dockerContainerName=$(docker container ls --filter "ancestor=docker" --format '{{.Names}}')
CHECKOUT_PATH=$(docker container inspect -f '{{range .Mounts}}{{ if eq .Destination "/workdir" }}{{println .Source }}{{ end }}{{end}}' "$dockerContainerName")
BACKUP_DIR="$CHECKOUT_PATH/vtdataroot/backup"
else
BACKUP_DIR="$PWD/vtdataroot/backup"
fi
cat ./test/endtoend/kindBackupConfig.yaml | sed "s,PATH,$BACKUP_DIR,1" > ./vtdataroot/config.yaml
}

function createKindCluster() {
echo "Creating Kind cluster"
kind create cluster --wait 30s --name kind-${BUILDKITE_BUILD_ID} --config ./vtdataroot/config.yaml --image ${KIND_VERSION}
echo "Loading docker image into Kind cluster"
kind load docker-image vitess-operator-pr:latest --name kind-${BUILDKITE_BUILD_ID}
}

# get_started:
# $1: operator file to use
# $2: initial config file to use
Expand Down