-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
deps(al2): update logic for pulling cni plugins and bump version #2048
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,9 +272,30 @@ elif [ "$BINARY_BUCKET_REGION" = "eu-isoe-west-1" ]; then | |
elif [ "$BINARY_BUCKET_REGION" = "us-isof-south-1" ]; then | ||
S3_DOMAIN="csp.hci.ic.gov" | ||
fi | ||
|
||
# TODO: start deprecating these. | ||
S3_URL_BASE="https://$BINARY_BUCKET_NAME.s3.$BINARY_BUCKET_REGION.$S3_DOMAIN/$KUBERNETES_VERSION/$KUBERNETES_BUILD_DATE/bin/linux/$ARCH" | ||
S3_PATH="s3://$BINARY_BUCKET_NAME/$KUBERNETES_VERSION/$KUBERNETES_BUILD_DATE/bin/linux/$ARCH" | ||
|
||
function s3_binary_path() { | ||
local binary_name="" | ||
local os="linux" | ||
local arch="$ARCH" | ||
local version="" | ||
while getopts 'n:o:a:v:' OPTION; do | ||
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. using this in a function is a bit odd IMO. positional args would be more verbose in some places, but simpler to grok 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. i agree 😅 looking for something with sane defaults and the ability to override that wasn't too verbose, ill either keep iterating on it or just inline all the paths |
||
case "$OPTION" in | ||
n) binary_name="$OPTARG" ;; | ||
o) os="$OPTARG" ;; | ||
a) arch="$OPTARG" ;; | ||
v) version="$OPTARG" ;; | ||
esac | ||
done | ||
echo "bin/$binary_name/$version/$os/$arch/$binary_name" | ||
} | ||
|
||
S3_URI_BASE="s3://$BINARY_BUCKET_NAME" | ||
S3_HTTP_BASE="https://$BINARY_BUCKET_NAME.s3.$BINARY_BUCKET_REGION.$S3_DOMAIN" | ||
|
||
BINARIES=( | ||
kubelet | ||
aws-iam-authenticator | ||
|
@@ -313,21 +334,22 @@ if [ "$PULL_CNI_FROM_GITHUB" = "true" ]; then | |
wget "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGIN_VERSION}/${CNI_PLUGIN_FILENAME}.tgz.sha512" | ||
sudo sha512sum -c "${CNI_PLUGIN_FILENAME}.tgz.sha512" | ||
rm "${CNI_PLUGIN_FILENAME}.tgz.sha512" | ||
sudo tar -xvf "${CNI_PLUGIN_FILENAME}.tgz" -C /opt/cni/bin | ||
rm "${CNI_PLUGIN_FILENAME}.tgz" | ||
else | ||
if [[ -n "$AWS_ACCESS_KEY_ID" ]]; then | ||
echo "AWS cli present - using it to copy binaries from s3." | ||
aws s3 cp --region $BINARY_BUCKET_REGION $S3_PATH/${CNI_PLUGIN_FILENAME}.tgz . | ||
aws s3 cp --region $BINARY_BUCKET_REGION $S3_PATH/${CNI_PLUGIN_FILENAME}.tgz.sha256 . | ||
aws s3 cp --region $BINARY_BUCKET_REGION $S3_URI_BASE/$(s3_binary_path -n cni-plugins -v $CNI_PLUGIN_VERSION).tgz . | ||
aws s3 cp --region $BINARY_BUCKET_REGION $S3_URI_BASE/$(s3_binary_path -n cni-plugins -v $CNI_PLUGIN_VERSION).tgz.sha256 . | ||
else | ||
echo "AWS cli missing - using wget to fetch cni binaries from s3. Note: This won't work for private bucket." | ||
sudo wget "$S3_URL_BASE/${CNI_PLUGIN_FILENAME}.tgz" | ||
sudo wget "$S3_URL_BASE/${CNI_PLUGIN_FILENAME}.tgz.sha256" | ||
sudo wget "$S3_HTTP_BASE/$(s3_binary_path -n cni-plugins -v $CNI_PLUGIN_VERSION).tgz" | ||
sudo wget "$S3_HTTP_BASE/$(s3_binary_path -n cni-plugins -v $CNI_PLUGIN_VERSION).tgz.sha256" | ||
fi | ||
sudo sha256sum -c "${CNI_PLUGIN_FILENAME}.tgz.sha256" | ||
sudo sha256sum -c cni-plugins.tgz.sha256 | ||
sudo tar -xvf cni-plugins.tgz -C /opt/cni/bin | ||
rm cni-plugins.tgz | ||
fi | ||
sudo tar -xvf "${CNI_PLUGIN_FILENAME}.tgz" -C /opt/cni/bin | ||
rm "${CNI_PLUGIN_FILENAME}.tgz" | ||
|
||
sudo rm ./*.sha256 | ||
|
||
sudo mkdir -p /etc/kubernetes/kubelet | ||
|
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 could we support a version marker for binaries? e.g.