Skip to content

Commit

Permalink
Add containerd2 package (microsoft#11427)
Browse files Browse the repository at this point in the history
As containerd 2.0 GA recently, we want to provide containerd 2.0 in azure linux 3.0 to enhance our distro. Currently we wanted to keep the current containerd version in the existing package and offer container 2.0 in a new package so that users can try and test as their needs. This PR is adds a new containerd2 package with version 2.0.0.
  • Loading branch information
liunan-ms authored and durgajagadeesh committed Dec 31, 2024
1 parent f9f05ce commit 8ebe049
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions LICENSES-AND-NOTICES/SPECS/data/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,7 @@
"cloud-hypervisor-cvm",
"cmake-fedora",
"containerd",
"containerd2",
"coredns",
"dcos-cli",
"debugedit",
Expand Down
15 changes: 15 additions & 0 deletions SPECS/containerd2/containerd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target

[Service]
ExecStartPre=/sbin/modprobe overlay
ExecStart=/usr/bin/containerd
Restart=always
Delegate=yes
KillMode=process
OOMScoreAdjust=-999

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions SPECS/containerd2/containerd.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version = 2
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
[plugins."io.containerd.grpc.v1.cri".containerd]
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
7 changes: 7 additions & 0 deletions SPECS/containerd2/containerd2.signatures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Signatures": {
"containerd.service": "a07bfcf412669b06673190b0779f48e652c9adcf1758289e849a00802804eec8",
"containerd.toml": "5b3821236f09b4c858e0e098bbe1400f4dbbb47d360e39d21c61858b088c2896",
"containerd-2.0.0.tar.gz": "346d644e1b96e1f4a39bfe9d1eb0eb01ca676f806c12d95e5dbe35325bbc1780"
}
}
85 changes: 85 additions & 0 deletions SPECS/containerd2/containerd2.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
%global debug_package %{nil}
%define upstream_name containerd
%define commit_hash 207ad711eabd375a01713109a8a197d197ff6542

Summary: Industry-standard container runtime
Name: %{upstream_name}2
Version: 2.0.0
Release: 1%{?dist}
License: ASL 2.0
Group: Tools/Container
URL: https://www.containerd.io
Vendor: Microsoft Corporation
Distribution: Azure Linux

Source0: https://github.com/containerd/containerd/archive/v%{version}.tar.gz#/%{upstream_name}-%{version}.tar.gz
Source1: containerd.service
Source2: containerd.toml

%{?systemd_requires}

BuildRequires: golang
BuildRequires: go-md2man
BuildRequires: make
BuildRequires: systemd-rpm-macros

Requires: runc >= 1.2.2

%description
containerd is an industry-standard container runtime with an emphasis on
simplicity, robustness and portability. It is available as a daemon for Linux
and Windows, which can manage the complete container lifecycle of its host
system: image transfer and storage, container execution and supervision,
low-level storage and network attachments, etc.

containerd is designed to be embedded into a larger system, rather than being
used directly by developers or end-users.

%prep
%autosetup -p1 -n %{upstream_name}-%{version}

%build
export BUILDTAGS="-mod=vendor"
make VERSION="%{version}" REVISION="%{commit_hash}" binaries man

%check
export BUILDTAGS="-mod=vendor"
make VERSION="%{version}" REVISION="%{commit_hash}" test

%install
make VERSION="%{version}" REVISION="%{commit_hash}" DESTDIR="%{buildroot}" PREFIX="/usr" install install-man

mkdir -p %{buildroot}/%{_unitdir}
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/containerd.service
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/containerd/config.toml
install -vdm 755 %{buildroot}/opt/containerd/{bin,lib}

%post
%systemd_post containerd.service

if [ $1 -eq 1 ]; then # Package install
systemctl enable containerd.service > /dev/null 2>&1 || :
systemctl start containerd.service > /dev/null 2>&1 || :
fi

%preun
%systemd_preun containerd.service

%postun
%systemd_postun_with_restart containerd.service

%files
%license LICENSE NOTICE
%{_bindir}/*
%{_mandir}/*
%config(noreplace) %{_unitdir}/containerd.service
%config(noreplace) %{_sysconfdir}/containerd/config.toml
%dir /opt/containerd
%dir /opt/containerd/bin
%dir /opt/containerd/lib

%changelog
* Wed Dec 11 2024 Nan Liu <[email protected]> - 2.0.0-1
- Created a standalone package for containerd 2.0.0
- Initial CBL-Mariner import from Azure
- Initial version and License verified
10 changes: 10 additions & 0 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "containerd2",
"version": "2.0.0",
"downloadUrl": "https://github.com/containerd/containerd/archive/v2.0.0.tar.gz"
}
}
},
{
"component": {
"type": "other",
Expand Down

0 comments on commit 8ebe049

Please sign in to comment.