File sriov-network-operator.spec of Package sriov-network-operator

#
# spec file for package sriov-network-operator
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           sriov-network-operator
Version:        0
Release:        0
Summary:        Implements a Kubernetes operator for handling SRIOV VF resources
License:        Apache-2.0
URL:            https://github.com/k8snetworkplumbingwg/sriov-network-operator
Source:         sriov-network-operator-%{version}.tar
Source1:        vendor.tar.gz
BuildRequires:  golang(API) = 1.23
ExcludeArch:    s390
ExcludeArch:    %{ix86}

%description
The SRIOV Network Operator implements a Kubernetes operator for handling SRIOV VF resources. It helps users to
provision and configure SR-IOV CNI plugins and SR-IOV Device plugin in a kubernetes cluster.

Handling (i.e., assigning, removing) SRIOV Virtual Functions (VF) across workloads orchestrated by a kubernetes
cluster requires different components to be provisioned and configured accordingly; the SRIOV Network
Operator takes care of deploying and coordinating all those required components, providing an elegant API to
simplify the process.

%package common
Summary:        SRIOV Network Operator Common
Group:          System/Management

%description common
The SRIOV Network Operator implements a Kubernetes operator for handling SRIOV VF resources.
This subpackage is required to take ownership of the bindata files shared across subpackages.

%package manager
Summary:        SRIOV Network Operator Manager
Group:          System/Management
Requires:       %{name}-common = %{version}

%description manager
The SRIOV Network Operator implements a Kubernetes operator for handling SRIOV VF resources.
This subpackage provides the controllers' manager and the config-cleanup binaries.

%package config-dm
Summary:        SRIOV Network Operator Config Daemon
Group:          System/Management
Requires:       %{name}-common = %{version}

%description config-dm
The SRIOV Network Operator implements a Kubernetes operator for handling SRIOV VF resources.
This subpackage provides the config-daemon binary.

%package webhook
Summary:        SRIOV Network Operator Webhook
Group:          System/Management

%description webhook
The SRIOV Network Operator implements a Kubernetes operator for handling SRIOV VF resources.
This subpackage provides the webhook binary.

%prep
%autosetup -a1 -n sriov-network-operator-%{version} -p1

%build
# CGO is disable by default in upstream Makefile
%define cgoenabled "0"
%define buildldflags "-X github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/version.Raw=%{version} -s -w"
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -buildmode=pie -trimpath -ldflags %{buildldflags} -o manager main.go
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -buildmode=pie -trimpath -ldflags %{buildldflags} -o sriov-network-operator-config-cleanup ./cmd/sriov-network-operator-config-cleanup
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -buildmode=pie -trimpath -ldflags %{buildldflags} -o sriov-network-config-daemon ./cmd/sriov-network-config-daemon
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -buildmode=pie -trimpath -ldflags %{buildldflags} -o webhook ./cmd/webhook

%install
install -D -m0755 manager %{buildroot}%{_bindir}/sriov-network-operator
install -D -m0755 sriov-network-operator-config-cleanup %{buildroot}%{_bindir}/sriov-network-operator-config-cleanup
install -D -m0755 sriov-network-config-daemon %{buildroot}%{_bindir}/sriov-network-config-daemon
install -D -m0755 webhook %{buildroot}%{_bindir}/webhook
mkdir -p %{buildroot}/bindata
cp -aR bindata/* %{buildroot}/bindata/
chmod 755 %{buildroot}/bindata/scripts/*

%files common
%license LICENSE
%doc README.md
/bindata

%files manager
%license LICENSE
%doc README.md
%{_bindir}/sriov-network-operator
%{_bindir}/sriov-network-operator-config-cleanup

%files config-dm
%license LICENSE
%doc README.md
%{_bindir}/sriov-network-config-daemon

%files webhook
%license LICENSE
%doc README.md
%{_bindir}/webhook

%changelog
openSUSE Build Service is sponsored by