-
Notifications
You must be signed in to change notification settings - Fork 161
CLOUD-940 Use authenticated calls to check backup existence #2113
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
Conversation
| sleep 10 | ||
| ((retry += 1)) | ||
| done | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| check_backup_deletion_gcs "$logical_dest" | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| } | ||
|
|
||
| function check_backup_deletion_gcs() { | ||
| backup_dest_gcp=$1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| backup_dest_gcp=$1 | |
| backup_dest_gcp=$1 |
| while gsutil ls "$gcs_path" >/dev/null 2>&1; do | ||
| if [ $retry -ge 15 ]; then | ||
| echo "max retry count $retry reached. something went wrong with operator or kubernetes cluster" | ||
| echo "Backup $gcs_path still exists in $storage_name (expected it to be deleted)" | ||
| exit 1 | ||
| fi | ||
| echo "waiting for backup to be deleted from $storage_name" | ||
| sleep 10 | ||
| ((retry += 1)) | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| while gsutil ls "$gcs_path" >/dev/null 2>&1; do | |
| if [ $retry -ge 15 ]; then | |
| echo "max retry count $retry reached. something went wrong with operator or kubernetes cluster" | |
| echo "Backup $gcs_path still exists in $storage_name (expected it to be deleted)" | |
| exit 1 | |
| fi | |
| echo "waiting for backup to be deleted from $storage_name" | |
| sleep 10 | |
| ((retry += 1)) | |
| done | |
| while gsutil ls "$gcs_path" >/dev/null 2>&1; do | |
| if [ $retry -ge 15 ]; then | |
| echo "max retry count $retry reached. something went wrong with operator or kubernetes cluster" | |
| echo "Backup $gcs_path still exists in $storage_name (expected it to be deleted)" | |
| exit 1 | |
| fi | |
| echo "waiting for backup to be deleted from $storage_name" | |
| sleep 10 | |
| ((retry += 1)) | |
| done |
| ((retry += 1)) | ||
| done | ||
|
|
||
| echo "Backup $gcs_path not found in $storage_name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| echo "Backup $gcs_path not found in $storage_name" | |
| echo "Backup $gcs_path not found in $storage_name" |
| sleep 10 | ||
| ((retry += 1)) | ||
| done | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| local secret_name="aws-s3-secret" | ||
|
|
||
| if [[ -n "$AWS_ACCESS_KEY_ID" ]] && [[ -n "$AWS_SECRET_ACCESS_KEY" ]]; then | ||
| echo "AWS credentials already set in environment" | ||
| return 0 | ||
| fi | ||
|
|
||
| echo "Setting up AWS credentials from secret: $secret_name" | ||
|
|
||
| # Disable tracing for the entire credential section | ||
| local trace_was_on=0 | ||
| if [[ $- == *x* ]]; then | ||
| trace_was_on=1 | ||
| set +x | ||
| fi | ||
|
|
||
| AWS_ACCESS_KEY_ID=$(kubectl get secret "$secret_name" -o jsonpath='{.data.AWS_ACCESS_KEY_ID}' 2>/dev/null | base64 -d 2>/dev/null) | ||
| AWS_SECRET_ACCESS_KEY=$(kubectl get secret "$secret_name" -o jsonpath='{.data.AWS_SECRET_ACCESS_KEY}' 2>/dev/null | base64 -d 2>/dev/null) | ||
|
|
||
| if [[ -z "$AWS_ACCESS_KEY_ID" ]] || [[ -z "$AWS_SECRET_ACCESS_KEY" ]]; then | ||
| # Re-enable tracing before error message if it was on | ||
| [[ $trace_was_on -eq 1 ]] && set -x | ||
| echo "Failed to extract AWS credentials from secret" | ||
| return 1 | ||
| fi | ||
|
|
||
| export AWS_ACCESS_KEY_ID | ||
| export AWS_SECRET_ACCESS_KEY | ||
|
|
||
| # Re-enable tracing if it was on | ||
| [[ $trace_was_on -eq 1 ]] && set -x | ||
|
|
||
| echo "AWS credentials configured successfully" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| local secret_name="aws-s3-secret" | |
| if [[ -n "$AWS_ACCESS_KEY_ID" ]] && [[ -n "$AWS_SECRET_ACCESS_KEY" ]]; then | |
| echo "AWS credentials already set in environment" | |
| return 0 | |
| fi | |
| echo "Setting up AWS credentials from secret: $secret_name" | |
| # Disable tracing for the entire credential section | |
| local trace_was_on=0 | |
| if [[ $- == *x* ]]; then | |
| trace_was_on=1 | |
| set +x | |
| fi | |
| AWS_ACCESS_KEY_ID=$(kubectl get secret "$secret_name" -o jsonpath='{.data.AWS_ACCESS_KEY_ID}' 2>/dev/null | base64 -d 2>/dev/null) | |
| AWS_SECRET_ACCESS_KEY=$(kubectl get secret "$secret_name" -o jsonpath='{.data.AWS_SECRET_ACCESS_KEY}' 2>/dev/null | base64 -d 2>/dev/null) | |
| if [[ -z "$AWS_ACCESS_KEY_ID" ]] || [[ -z "$AWS_SECRET_ACCESS_KEY" ]]; then | |
| # Re-enable tracing before error message if it was on | |
| [[ $trace_was_on -eq 1 ]] && set -x | |
| echo "Failed to extract AWS credentials from secret" | |
| return 1 | |
| fi | |
| export AWS_ACCESS_KEY_ID | |
| export AWS_SECRET_ACCESS_KEY | |
| # Re-enable tracing if it was on | |
| [[ $trace_was_on -eq 1 ]] && set -x | |
| echo "AWS credentials configured successfully" | |
| local secret_name="aws-s3-secret" | |
| if [[ -n $AWS_ACCESS_KEY_ID ]] && [[ -n $AWS_SECRET_ACCESS_KEY ]]; then | |
| echo "AWS credentials already set in environment" | |
| return 0 | |
| fi | |
| echo "Setting up AWS credentials from secret: $secret_name" | |
| # Disable tracing for the entire credential section | |
| local trace_was_on=0 | |
| if [[ $- == *x* ]]; then | |
| trace_was_on=1 | |
| set +x | |
| fi | |
| AWS_ACCESS_KEY_ID=$(kubectl get secret "$secret_name" -o jsonpath='{.data.AWS_ACCESS_KEY_ID}' 2>/dev/null | base64 -d 2>/dev/null) | |
| AWS_SECRET_ACCESS_KEY=$(kubectl get secret "$secret_name" -o jsonpath='{.data.AWS_SECRET_ACCESS_KEY}' 2>/dev/null | base64 -d 2>/dev/null) | |
| if [[ -z $AWS_ACCESS_KEY_ID ]] || [[ -z $AWS_SECRET_ACCESS_KEY ]]; then | |
| # Re-enable tracing before error message if it was on | |
| [[ $trace_was_on -eq 1 ]] && set -x | |
| echo "Failed to extract AWS credentials from secret" | |
| return 1 | |
| fi | |
| export AWS_ACCESS_KEY_ID | |
| export AWS_SECRET_ACCESS_KEY | |
| # Re-enable tracing if it was on | |
| [[ $trace_was_on -eq 1 ]] && set -x | |
| echo "AWS credentials configured successfully" |
| # Re-enable tracing if it was on | ||
| [[ $trace_was_on -eq 1 ]] && set -x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| # Re-enable tracing if it was on | |
| [[ $trace_was_on -eq 1 ]] && set -x | |
| # Re-enable tracing if it was on | |
| [[ $trace_was_on -eq 1 ]] && set -x |
| # Re-enable tracing if it was on | ||
| [[ $trace_was_on -eq 1 ]] && set -x | ||
|
|
||
| echo "Azure credentials configured successfully" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| echo "Azure credentials configured successfully" | |
| echo "Azure credentials configured successfully" |
| sleep 10 | ||
| ((retry += 1)) | ||
| done | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| sleep 10 | ||
| ((retry += 1)) | ||
| done | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
| sleep 10 | ||
| ((retry += 1)) | ||
| done | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
commit: a1bead7 |
CHANGE DESCRIPTION
Problem
The operator-testing S3 bucket is now private, so its objects can no longer be accessed through unauthenticated object URLs. As a result, tests that verify the existence of backups in this bucket are failing.
Solution
Use the respective cloud CLIs, authenticated via the pipeline credentials, to verify the existence of backups.
Also, use PBM 2.11.0 as default in e2e-tests until K8SPSMDB-1522 is fixed
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability