-
Notifications
You must be signed in to change notification settings - Fork 237
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
K8SPXC-1475 use aws cli #1048
Open
hors
wants to merge
7
commits into
main
Choose a base branch
from
use-aws-cli
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
K8SPXC-1475 use aws cli #1048
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
000ddb9
use aws-cli
hors 31d3835
aws lib
hors 903ee38
add post_backup script
hors a76dc33
fix build
hors 788ff3c
Merge branch 'main' into use-aws-cli
hors 7f220ff
K8SPXC-1475 use aws cli
hors bdc7dd9
add aws cli for pxc 5.7 backups
hors File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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 |
---|---|---|
|
@@ -32,13 +32,17 @@ LABEL org.opencontainers.image.version=${PXC_VERSION} | |
# check repository package signature in secure way | ||
RUN set -ex; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 4D1BB29D63D98E422B2113B19334A25F8507EFA5 3E6D826D3FBAB389C2F38E34BC4D06A08D8B756F; \ | ||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 4D1BB29D63D98E422B2113B19334A25F8507EFA5 3E6D826D3FBAB389C2F38E34BC4D06A08D8B756F FB5DB77FD5C118B80511ADA8A6310ACC4672475C; \ | ||
gpg --batch --export --armor 4D1BB29D63D98E422B2113B19334A25F8507EFA5 > ${GNUPGHOME}/PERCONA-PACKAGING-KEY; \ | ||
gpg --batch --export --armor 3E6D826D3FBAB389C2F38E34BC4D06A08D8B756F > ${GNUPGHOME}/RPM-GPG-KEY-oracle; \ | ||
rpmkeys --import ${GNUPGHOME}/PERCONA-PACKAGING-KEY ${GNUPGHOME}/RPM-GPG-KEY-oracle; \ | ||
gpg --batch --export --armor FB5DB77FD5C118B80511ADA8A6310ACC4672475C > ${GNUPGHOME}/RPM-GPG-KEY-aws; \ | ||
rpmkeys --import ${GNUPGHOME}/PERCONA-PACKAGING-KEY ${GNUPGHOME}/RPM-GPG-KEY-oracle ${GNUPGHOME}/RPM-GPG-KEY-aws; \ | ||
microdnf install -y findutils; \ | ||
curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ | ||
rpmkeys --checksig /tmp/percona-release.rpm; \ | ||
curl -o /tmp/awscliv2.zip https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip; \ | ||
curl -o /tmp/awscliv2.sig https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig; \ | ||
gpg --verify /tmp/awscliv2.sig /tmp/awscliv2.zip; \ | ||
rpm -i /tmp/percona-release.rpm; \ | ||
rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ | ||
rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY | ||
|
@@ -66,9 +70,13 @@ RUN set -ex; \ | |
iputils \ | ||
procps-ng \ | ||
util-linux \ | ||
unzip \ | ||
findutils; \ | ||
microdnf clean all; \ | ||
rm -rf /var/cache/dnf /var/cache/yum | ||
unzip -q /tmp/awscliv2.zip -d /tmp/; \ | ||
/tmp/aws/install; \ | ||
aws --version; \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this? |
||
rm -rf /var/cache/dnf /var/cache/yum /tmp/awscliv2.zip /tmp/awscliv2.sig /tmp/aws | ||
|
||
# create mysql user/group before mysql installation | ||
RUN groupadd -g 1001 mysql; \ | ||
|
@@ -90,7 +98,8 @@ RUN set -ex; \ | |
|
||
COPY LICENSE /licenses/LICENSE.Dockerfile | ||
RUN cp /usr/share/doc/percona-xtrabackup-80/LICENSE /licenses/LICENSE.xtrabackup; \ | ||
cp /usr/share/doc/percona-xtradb-cluster-garbd-3/COPYING /licenses/LICENSE.garbd | ||
cp /usr/share/doc/percona-xtradb-cluster-garbd-3/COPYING /licenses/LICENSE.garbd; \ | ||
curl -o /licenses/LICENSE.aws-cli https://raw.githubusercontent.com/aws/aws-cli/refs/heads/master/LICENSE.txt | ||
|
||
RUN set -ex; \ | ||
curl -o /usr/bin/kubectl -LO \ | ||
|
@@ -103,15 +112,6 @@ RUN set -ex; \ | |
RUN install -d -o 1001 -g 0 -m 0775 /backup; \ | ||
mkdir /usr/lib/pxc | ||
|
||
ENV MC_VERSION=RELEASE.2024-07-08T20-59-24Z | ||
ENV MC_SHA256SUM=e111d2b4bea05aadbffaa3fc8d2436a3fefedf030cd1318568bccb72810024f0 | ||
RUN set -ex; \ | ||
curl -o /usr/bin/mc -O https://dl.minio.io/client/mc/release/linux-amd64/archive/mc.${MC_VERSION} \ | ||
&& chmod +x /usr/bin/mc \ | ||
&& echo "${MC_SHA256SUM} /usr/bin/mc" | sha256sum -c - \ | ||
&& curl -o /licenses/LICENSE.mc \ | ||
https://raw.githubusercontent.com/minio/mc/${MC_VERSION}/LICENSE | ||
|
||
COPY lib/pxc /usr/lib/pxc | ||
COPY recovery-*.sh run_backup.sh backup.sh post_backup.sh get-pxc-state /usr/bin/ | ||
|
||
|
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,29 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
|
||
export AWS_SHARED_CREDENTIALS_FILE='/tmp/aws-credfile' | ||
export AWS_ENDPOINT_URL="${ENDPOINT:-https://s3.amazonaws.com}" | ||
export AWS_REGION="${DEFAULT_REGION:-us-west-2}" | ||
|
||
if [ -n "$VERIFY_TLS" ] && [[ $VERIFY_TLS == "false" ]]; then | ||
AWS_S3_NO_VERIFY_SSL='--no-verify-ssl' | ||
fi | ||
|
||
is_object_exist() { | ||
local bucket="$1" | ||
local object="$2" | ||
|
||
aws $AWS_S3_NO_VERIFY_SSL s3api head-object --bucket $bucket --key "$object" || NOT_EXIST=true | ||
if [[ -z "$NOT_EXIST" ]]; then | ||
return 1 | ||
fi | ||
} | ||
|
||
s3_add_bucket_dest() { | ||
{ set +x; } 2>/dev/null | ||
aws configure set aws_access_key_id "$ACCESS_KEY_ID" | ||
aws configure set aws_secret_access_key "$SECRET_ACCESS_KEY" | ||
set -x | ||
} | ||
|
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
do we need this?