Skip to content

Commit 57a1283

Browse files
wwvelacartermckinnonndbaker1
authored
feat: option to install containerd 1.7 from S3 (#2339)
* install containerd 1.7 from internal s3 * add containerd_rpm_url property to allow install containerd rpm from outside url * fix nit * install containerd binary with patches from s3 * fix lint * Update templates/al2/provisioners/install-worker.sh Co-authored-by: Carter <mckdev@amazon.com> * install binary from s3 if INSTALL_CONTAINERD_FROM_S3 * update the s3 path * Update templates/al2023/provisioners/install-worker.sh Co-authored-by: Carter <mckdev@amazon.com> * Update templates/al2/provisioners/install-worker.sh Co-authored-by: Carter <mckdev@amazon.com> * Update templates/al2/provisioners/install-worker.sh Co-authored-by: Carter <mckdev@amazon.com> * Update templates/al2023/provisioners/install-worker.sh Co-authored-by: Nick Baker <ndbaker1@outlook.com> * fix nit * exclude the containerd from dnf and yum conf * add pull bianry according to arch and update the generate-version-info script for containerd * update the key in al2 * fix nit * fix lint * fix lint * fix nit * pin fully-format containerd version in variables file --------- Co-authored-by: Carter <mckdev@amazon.com> Co-authored-by: Nick Baker <ndbaker1@outlook.com>
1 parent 99eff32 commit 57a1283

File tree

11 files changed

+141
-7
lines changed

11 files changed

+141
-7
lines changed

doc/usage/al2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
| `cache_container_images` | |
2323
| `cni_plugin_version` | |
2424
| `containerd_version` | |
25+
| `install_containerd_from_s3` | |
2526
| `creator` | |
2627
| `docker_version` | Docker is not installed on Kubernetes v1.25+ |
2728
| `enable_fips` | Install openssl and enable fips related kernel parameters |

doc/usage/al2023.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
| `binary_bucket_name` | |
2020
| `binary_bucket_region` | |
2121
| `containerd_version` | |
22+
| `install_containerd_from_s3` | |
2223
| `creator` | |
2324
| `enable_accelerator` | Vendor that provides the GPU or accelerator hardware. Currently we support Neuron and NVIDIA. |
2425
| `enable_efa` | Valid options are ```true``` or ```false```. Wheather or not to install the software needed to use AWS Elastic Fabric Adapter (EFA) network interfaces. |

templates/al2/provisioners/install-worker.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,27 @@ sudo yum install -y runc-${RUNC_VERSION}
149149
sudo yum versionlock runc-*
150150

151151
# install containerd and lock version
152-
sudo yum install -y containerd-${CONTAINERD_VERSION}
153-
sudo yum versionlock containerd-*
152+
if [[ "$INSTALL_CONTAINERD_FROM_S3" == "true" ]]; then
153+
CONTAINERD_BINARIES=(
154+
containerd
155+
containerd-shim-runc-v2
156+
ctr
157+
)
158+
echo "Installing containerd from S3..."
159+
for binary in "${CONTAINERD_BINARIES[@]}"; do
160+
aws s3 cp --region ${BINARY_BUCKET_REGION} s3://${BINARY_BUCKET_NAME}/containerd/${CONTAINERD_VERSION}/${MACHINE}/${binary} .
161+
sudo chmod +x $binary
162+
sudo mv $binary /usr/bin/
163+
done
164+
sudo mkdir -p /var/lib/containerd
165+
sudo mv $WORKING_DIR/containerd.service /etc/systemd/system/containerd.service
166+
sudo chown root:root /etc/systemd/system/containerd.service
167+
# exclude containerd from yum.conf as versionlock doesn't work in this case
168+
echo "exclude=containerd*,docker*" | sudo tee -a /etc/yum.conf
169+
else
170+
sudo yum install -y containerd-${CONTAINERD_VERSION}
171+
sudo yum versionlock containerd-*
172+
fi
154173

155174
# install cri-tools for crictl, needed to interact with containerd's CRI server
156175
sudo yum install -y cri-tools
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright The containerd Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
[Unit]
16+
Description=containerd container runtime
17+
Documentation=https://containerd.io
18+
After=network.target local-fs.target dbus.service
19+
20+
[Service]
21+
#uncomment to enable the experimental sbservice (sandboxed) version of containerd/cri integration
22+
#Environment="ENABLE_CRI_SANDBOXES=sandboxed"
23+
ExecStartPre=-/sbin/modprobe overlay
24+
ExecStart=/usr/bin/containerd
25+
26+
Type=notify
27+
Delegate=yes
28+
KillMode=process
29+
Restart=always
30+
RestartSec=5
31+
# Having non-zero Limit*s causes performance problems due to accounting overhead
32+
# in the kernel. We recommend using cgroups to do container-local accounting.
33+
LimitNPROC=infinity
34+
LimitCORE=infinity
35+
LimitNOFILE=infinity
36+
# Comment TasksMax if your systemd version does not supports it.
37+
# Only systemd 226 and above support this version.
38+
TasksMax=infinity
39+
OOMScoreAdjust=-999
40+
41+
[Install]
42+
WantedBy=multi-user.target

templates/al2/template.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"cache_container_images": null,
1919
"cni_plugin_version": null,
2020
"containerd_version": null,
21+
"install_containerd_from_s3": null,
2122
"creator": null,
2223
"docker_version": null,
2324
"enable_fips": null,
@@ -205,6 +206,7 @@
205206
"CACHE_CONTAINER_IMAGES={{user `cache_container_images`}}",
206207
"CNI_PLUGIN_VERSION={{user `cni_plugin_version`}}",
207208
"CONTAINERD_VERSION={{user `containerd_version`}}",
209+
"INSTALL_CONTAINERD_FROM_S3={{user `install_containerd_from_s3`}}",
208210
"DOCKER_VERSION={{user `docker_version`}}",
209211
"KUBERNETES_BUILD_DATE={{user `kubernetes_build_date`}}",
210212
"KUBERNETES_VERSION={{user `kubernetes_version`}}",

templates/al2/variables-default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"binary_bucket_region": "us-west-2",
1414
"cache_container_images": "false",
1515
"cni_plugin_version": "v1.2.0",
16-
"containerd_version": "1.7.*",
16+
"containerd_version": "1.7.27",
17+
"install_containerd_from_s3": "false",
1718
"creator": "{{env `USER`}}",
1819
"docker_version": "none",
1920
"enable_fips": "false",

templates/al2023/provisioners/install-worker.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,26 @@ fi
146146
###############################################################################
147147
### Containerd setup ##########################################################
148148
###############################################################################
149-
150149
sudo dnf install -y runc-${RUNC_VERSION}
151-
sudo dnf install -y containerd-${CONTAINERD_VERSION}
152-
sudo dnf versionlock containerd-*
150+
if [[ "$INSTALL_CONTAINERD_FROM_S3" == "true" ]]; then
151+
CONTAINERD_BINARIES=(
152+
containerd
153+
containerd-shim-runc-v2
154+
ctr
155+
)
156+
for binary in "${CONTAINERD_BINARIES[@]}"; do
157+
echo "Installing containerd from S3..."
158+
aws s3 cp --region ${BINARY_BUCKET_REGION} s3://${BINARY_BUCKET_NAME}/containerd/${CONTAINERD_VERSION}/${MACHINE}/${binary} .
159+
sudo chmod +x $binary
160+
sudo mv $binary /usr/bin/
161+
# exclude containerd from yum.conf as versionlock doesn't work in this case
162+
echo "exclude=containerd*" | sudo tee -a /etc/dnf/dnf.conf
163+
done
164+
sudo mkdir -p /var/lib/containerd
165+
else
166+
sudo dnf install -y containerd-${CONTAINERD_VERSION}
167+
sudo dnf versionlock containerd-*
168+
fi
153169

154170
sudo systemctl enable ebs-initialize-bin@containerd
155171

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright The containerd Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
[Unit]
16+
Description=containerd container runtime
17+
Documentation=https://containerd.io
18+
After=network.target local-fs.target dbus.service
19+
20+
[Service]
21+
#uncomment to enable the experimental sbservice (sandboxed) version of containerd/cri integration
22+
#Environment="ENABLE_CRI_SANDBOXES=sandboxed"
23+
ExecStartPre=-/sbin/modprobe overlay
24+
ExecStart=/usr/bin/containerd
25+
26+
Type=notify
27+
Delegate=yes
28+
KillMode=process
29+
Restart=always
30+
RestartSec=5
31+
# Having non-zero Limit*s causes performance problems due to accounting overhead
32+
# in the kernel. We recommend using cgroups to do container-local accounting.
33+
LimitNPROC=infinity
34+
LimitCORE=infinity
35+
LimitNOFILE=infinity
36+
# Comment TasksMax if your systemd version does not supports it.
37+
# Only systemd 226 and above support this version.
38+
TasksMax=infinity
39+
OOMScoreAdjust=-999
40+
41+
[Install]
42+
WantedBy=multi-user.target

templates/al2023/template.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"binary_bucket_name": null,
1616
"binary_bucket_region": null,
1717
"containerd_version": null,
18+
"install_containerd_from_s3": null,
1819
"creator": null,
1920
"enable_accelerator": null,
2021
"enable_efa": null,
@@ -208,6 +209,7 @@
208209
"BINARY_BUCKET_NAME={{user `binary_bucket_name`}}",
209210
"BINARY_BUCKET_REGION={{user `binary_bucket_region`}}",
210211
"CONTAINERD_VERSION={{user `containerd_version`}}",
212+
"INSTALL_CONTAINERD_FROM_S3={{user `install_containerd_from_s3`}}",
211213
"KUBERNETES_BUILD_DATE={{user `kubernetes_build_date`}}",
212214
"KUBERNETES_VERSION={{user `kubernetes_version`}}",
213215
"RUNC_VERSION={{user `runc_version`}}",

templates/al2023/variables-default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"aws_session_token": "{{env `AWS_SESSION_TOKEN`}}",
1111
"binary_bucket_name": "amazon-eks",
1212
"binary_bucket_region": "us-west-2",
13-
"containerd_version": "1.7.*",
13+
"containerd_version": "1.7.27",
14+
"install_containerd_from_s3": "false",
1415
"creator": "{{env `USER`}}",
1516
"enable_accelerator": "",
1617
"enable_efa": "false",

0 commit comments

Comments
 (0)