-
Notifications
You must be signed in to change notification settings - Fork 35
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
Distribute mountpoint binary instead of package #48
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9323ed2
Distribute mountpoint binary instead of package
jjkr b2bf64e
Fix unit tests
jjkr 454e1e9
Checkstyle
jjkr f5716f0
Update helm chart to match deploy
jjkr dda8308
Add missing volume to helm
jjkr ea9c703
Remove aws-credentials mount
jjkr f6ab23c
Add CSI_NODE_NAME back to helm
jjkr 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,47 +14,53 @@ | |
|
||
ARG MOUNTPOINT_VERSION=1.1.0 | ||
|
||
# Download and verify the mountpoint's RPM and DEB in this container | ||
FROM --platform=$BUILDPLATFORM public.ecr.aws/amazonlinux/amazonlinux:2023 as mp_builder | ||
# Download the mountpoint tarball and produce an installable directory | ||
# Building on Amazon Linux 2 because it has an old libc version. libfuse from the os | ||
# is being packaged up in the container and a newer version linking to a too new glibc | ||
# can cause portability issues | ||
FROM --platform=$TARGETPLATFORM public.ecr.aws/amazonlinux/amazonlinux:2 as mp_builder | ||
ARG MOUNTPOINT_VERSION | ||
ARG TARGETARCH | ||
ARG TARGETPLATFORM | ||
# We need the full version of GnuPG | ||
RUN dnf install -y --allowerasing wget gnupg2 | ||
RUN yum install -y gzip wget gnupg2 tar fuse-libs binutils patchelf | ||
|
||
RUN MP_ARCH=`echo ${TARGETARCH} | sed s/amd64/x86_64/` && \ | ||
wget -q "https://s3.amazonaws.com/mountpoint-s3-release/${MOUNTPOINT_VERSION}/$MP_ARCH/mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.rpm" && \ | ||
wget -q "https://s3.amazonaws.com/mountpoint-s3-release/${MOUNTPOINT_VERSION}/$MP_ARCH/mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.rpm.asc" && \ | ||
wget -q "https://s3.amazonaws.com/mountpoint-s3-release/${MOUNTPOINT_VERSION}/$MP_ARCH/mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.deb" && \ | ||
wget -q "https://s3.amazonaws.com/mountpoint-s3-release/${MOUNTPOINT_VERSION}/$MP_ARCH/mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.deb.asc" && \ | ||
wget -q "https://s3.amazonaws.com/mountpoint-s3-release/${MOUNTPOINT_VERSION}/$MP_ARCH/mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.tar.gz" && \ | ||
wget -q "https://s3.amazonaws.com/mountpoint-s3-release/${MOUNTPOINT_VERSION}/$MP_ARCH/mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.tar.gz.asc" && \ | ||
wget -q https://s3.amazonaws.com/mountpoint-s3-release/public_keys/KEYS | ||
|
||
# Import the key and validate it has the fingerprint we expect | ||
RUN gpg --import KEYS && \ | ||
(gpg --fingerprint [email protected] | grep "673F E406 1506 BB46 9A0E F857 BE39 7A52 B086 DA5A") | ||
|
||
# Verify the downloaded binary | ||
# Verify the downloaded tarball, extract it, and fixup the binary | ||
RUN MP_ARCH=`echo ${TARGETARCH} | sed s/amd64/x86_64/` && \ | ||
gpg --verify mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.rpm.asc && \ | ||
gpg --verify mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.deb.asc && \ | ||
mv mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.rpm /mount-s3.rpm && \ | ||
mv mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.deb /mount-s3.deb | ||
gpg --verify mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.tar.gz.asc && \ | ||
mkdir -p /mountpoint-s3 && \ | ||
tar -xvzf mount-s3-${MOUNTPOINT_VERSION}-$MP_ARCH.tar.gz -C /mountpoint-s3 && \ | ||
# strip debugging information to reduce binary size | ||
strip --strip-debug /mountpoint-s3/bin/mount-s3 && \ | ||
# set rpath for dynamic library loading | ||
patchelf --set-rpath '$ORIGIN' /mountpoint-s3/bin/mount-s3 | ||
|
||
# Build driver | ||
FROM --platform=$BUILDPLATFORM golang:1.21.1-bullseye as builder | ||
# Build driver. Use BUILDPLATFORM not TARGETPLATFORM for cross compilation | ||
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/golang:1.21-bullseye as builder | ||
ARG TARGETARCH | ||
|
||
WORKDIR /go/src/github.com/awslabs/mountpoint-s3-csi-driver | ||
COPY . . | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod \ | ||
TARGETARCH=${TARGETARCH} make bin | ||
|
||
FROM --platform=$TARGETPLATFORM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi:latest-al2 AS linux-amazon | ||
FROM --platform=$TARGETPLATFORM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi:latest AS linux-amazon | ||
ARG MOUNTPOINT_VERSION | ||
ENV MOUNTPOINT_VERSION=${MOUNTPOINT_VERSION} | ||
|
||
# MP Installer | ||
COPY --from=mp_builder /mount-s3.rpm /mount-s3.rpm | ||
COPY --from=mp_builder /mount-s3.deb /mount-s3.deb | ||
COPY --from=mp_builder /mountpoint-s3 /mountpoint-s3 | ||
COPY --from=mp_builder /lib64/libfuse.so.2 /mountpoint-s3/bin/ | ||
COPY --from=mp_builder /lib64/libgcc_s.so.1 /mountpoint-s3/bin/ | ||
COPY ./cmd/install-mp.sh /install-mp.sh | ||
|
||
# Install driver | ||
|
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 |
---|---|---|
|
@@ -2,75 +2,5 @@ | |
|
||
set -euox pipefail | ||
|
||
NSENTER_HOST="nsenter --target 1 --mount --net" | ||
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. 🚀 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. Yep glad to see this go. It was gross. And now we don't have to run with |
||
CSI_DIR="/csi/" | ||
HOST_CSI_DIR="/var/lib/kubelet/plugins/s3.csi.aws.com/" | ||
RPM_FILE=mount-s3.rpm | ||
DEB_FILE=mount-s3.deb | ||
|
||
get_os_info() { | ||
local key=$1 | ||
local value=$($NSENTER_HOST cat /etc/os-release | grep "^$key=" | cut -d= -f2-) | ||
# Remove potential quotes around the value | ||
echo ${value//\"/} | ||
} | ||
|
||
# Determine the package manager based on the ID_LIKE or ID from os-release | ||
determine_package_manager() { | ||
local id_like=$(get_os_info ID_LIKE) | ||
local id=$(get_os_info ID) | ||
|
||
if [[ "$id_like" == *"debian"* || "$id" == "debian" || "$id" == "ubuntu" ]]; then | ||
echo "apt" | ||
elif [[ "$id_like" == *"fedora"* || "$id_like" == *"rhel"* || "$id" == "fedora" || "$id" == "centos" ]]; then | ||
echo "yum" | ||
else | ||
echo "unknown" | ||
fi | ||
} | ||
|
||
cleanup_rpm() { | ||
rm -f "${CSI_DIR}${RPM_FILE}" | ||
} | ||
|
||
cleanup_deb() { | ||
rm -f "${CSI_DIR}${DEB_FILE}" | ||
} | ||
|
||
install_mountpoint_rpm() { | ||
echo "Using yum to install S3 Mountpoint..." | ||
local rpm_package_name=$(rpm -qp --queryformat '%{NAME}\n' "/${RPM_FILE}") | ||
local installed_mp_version=$($NSENTER_HOST rpm -q --queryformat '%{VERSION}-%{RELEASE}\n' "${rpm_package_name}" || true) | ||
local package_mp_version=$(rpm -qp --queryformat '%{VERSION}-%{RELEASE}\n' "/${RPM_FILE}") | ||
echo "Installed S3 Mountpoint version: ${installed_mp_version}" | ||
echo "Package S3 Mountpoint version: ${package_mp_version}" | ||
|
||
if [[ "${installed_mp_version}" != "${package_mp_version}" ]]; then | ||
cp "/${RPM_FILE}" "${CSI_DIR}${RPM_FILE}" | ||
trap cleanup_rpm EXIT SIGINT SIGTERM | ||
# If install fails try downgrade | ||
$NSENTER_HOST yum install -y "${HOST_CSI_DIR}${RPM_FILE}" || \ | ||
$NSENTER_HOST yum downgrade -y "${HOST_CSI_DIR}${RPM_FILE}" | ||
else | ||
echo "S3 Mountpoint already up to date" | ||
fi | ||
} | ||
|
||
install_mountpoint_deb() { | ||
echo "Using apt to install S3 Mountpoint..." | ||
$NSENTER_HOST apt-get update | ||
cp "/${DEB_FILE}" "${CSI_DIR}${DEB_FILE}" | ||
trap cleanup_deb EXIT SIGINT SIGTERM | ||
$NSENTER_HOST apt-get install -y --allow-downgrades "${HOST_CSI_DIR}${DEB_FILE}" | ||
} | ||
|
||
package_manager=$(determine_package_manager) | ||
|
||
if [ "$package_manager" == "apt" ]; then | ||
install_mountpoint_deb | ||
elif [ "$package_manager" == "yum" ]; then | ||
install_mountpoint_rpm | ||
else | ||
echo "Package manager not supported or not detected." | ||
exit 1 | ||
fi | ||
cp -rf "/mountpoint-s3" "${CSI_DIR}" |
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
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.
how many MBs we're saving with that? is it a good trade-off? as I understand this will make MPs traces unreadable
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.
also taking into the account that MP operational runbooks may rely on this info
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.
The binary goes from 55 MB to 12, so it's not insignificant. I will double check with the mountpoint team though.