N
NiceOS Build Portal
Enterprise build observability for published NiceOS package builds.

input/cni.spec

raw · 4.4 KiB

%define network_required 0

%bcond_with tests

%ifarch x86_64
%global goarch amd64
%endif

%ifarch aarch64
%global goarch arm64
%endif

%global cni_plugins_dir /opt/cni/bin
%global debug_package %{nil}
%global __strip /bin/true

Name:           cni-plugins
Version:        1.9.1
Release:        2%{?dist}
Summary:        Container Network Interface plugins
Summary(ru):    Плагины Container Network Interface

License:        Apache-2.0
URL:            https://github.com/containernetworking/plugins
Source0:        https://github.com/containernetworking/plugins/archive/refs/tags/v%{version}.tar.gz#%{name}-%{version}.tar.gz

Packager:       ООО "НАЙС СОФТ ГРУПП" 5024245440 <niceos@ncsgp.ru>
Vendor:         NiceSOFT
Distribution:   NiceOS.Core
BugURL:         https://niceos.ru/package/%{name}

Group:          System Environment/Base

# Compatibility names used by Kubernetes packages in different distributions.
Provides:       kubernetes-cni = %{version}-%{release}
Provides:       kubernetes-cni%{?_isa} = %{version}-%{release}
Provides:       cni = %{version}-%{release}
Provides:       cni%{?_isa} = %{version}-%{release}
Obsoletes:      cni < %{version}-%{release}

BuildRequires:  bash
BuildRequires:  coreutils
BuildRequires:  findutils
BuildRequires:  go >= 1.24
BuildRequires:  grep
BuildRequires:  make
BuildRequires:  sed
BuildRequires:  tar

Requires:       iproute2
Requires:       iptables

%description
CNI plugins provide reference and example Container Network Interface
binaries used by container runtimes and Kubernetes networking providers.

The package installs CNI plugin binaries under /opt/cni/bin. It does not
install a default Kubernetes network configuration. The actual cluster
network configuration is expected to be installed by a CNI provider such
as Calico, Cilium or Flannel.

%description -l ru
cni-plugins предоставляет базовые и справочные бинарные плагины Container
Network Interface, используемые container runtime и сетевыми решениями
Kubernetes.

Пакет устанавливает CNI-бинарники в /opt/cni/bin. Он не устанавливает
дефолтную сетевую конфигурацию Kubernetes. Реальная конфигурация сети
кластера должна устанавливаться CNI-провайдером, например Calico, Cilium
или Flannel.


%prep
%autosetup -n plugins-%{version}

# Upstream release tarball contains vendored Go modules.
# NiceOS builds this package without network access.
test -d vendor
test -f vendor/modules.txt


%build
export GOTOOLCHAIN=local
export GOPROXY=off
export GOSUMDB=off
export GONOSUMDB=*
export GOPRIVATE=*
export GO111MODULE=on
export GOOS=linux
export GOARCH=%{goarch}
export CGO_ENABLED=0
export GOFLAGS="-mod=vendor -trimpath"

# build_linux.sh builds the Linux CNI plugin set into ./bin.
sh ./build_linux.sh


%install
install -d -m 0755 %{buildroot}%{cni_plugins_dir}
install -p -m 0755 bin/* %{buildroot}%{cni_plugins_dir}/


%check
test -x %{buildroot}%{cni_plugins_dir}/loopback
test -x %{buildroot}%{cni_plugins_dir}/bridge
test -x %{buildroot}%{cni_plugins_dir}/host-local
test -x %{buildroot}%{cni_plugins_dir}/portmap
test -x %{buildroot}%{cni_plugins_dir}/bandwidth
test -x %{buildroot}%{cni_plugins_dir}/firewall
test -x %{buildroot}%{cni_plugins_dir}/tuning

%if %{with tests}
export GOTOOLCHAIN=local
export GOPROXY=off
export GOSUMDB=off
export GONOSUMDB=*
export GOPRIVATE=*
export GO111MODULE=on
export GOOS=linux
export GOARCH=%{goarch}
export CGO_ENABLED=0
export GOFLAGS="-mod=vendor -trimpath"

go test ./...
%endif


%files
%defattr(-,root,root)
%license LICENSE
%doc README.md
%dir /opt/cni
%dir %{cni_plugins_dir}
%{cni_plugins_dir}/*

%changelog
* Sun May 10 2026 NiceOS Team <support@niceos.ru> - 1.9.1-2
- Added compatibility Provides: kubernetes-cni and cni-plugins.
- Fixed CNI plugin directory macro usage.
- Added /etc/cni/net.d ownership.
- Fixed VCS URL typo.
- Kept CNI binaries under /opt/cni/bin.

* Sun May 10 2026 ООО "НАЙС СОФТ ГРУПП" <niceos@ncsgp.ru> - 1.9.1-1
- Reworked CNI plugins packaging for NiceOS.
- Renamed package from cni to cni-plugins.
- Added compatibility Provides: kubernetes-cni and cni.
- Installed CNI plugin binaries under /opt/cni/bin.
- Kept /etc/cni/net.d empty to avoid conflicts with Kubernetes CNI providers.
- Added offline Go build environment for reproducible NiceOS builds.