File network-resources-injector.spec of Package network-resources-injector

#
# spec file for package network-resources-injector
#
# 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:           network-resources-injector
Version:        0
Release:        0
Summary:        Kubernetes admission controller able to patch pod spec's requests and limits on custom network resources
License:        Apache-2.0
URL:            https://github.com/k8snetworkplumbingwg/network-resources-injector
Source:         %{name}-%{version}.tar
Source1:        vendor.tar.gz
BuildRequires:  golang(API) = 1.21
ExcludeArch:    s390
ExcludeArch:    %{ix86}

%description
Network Resources Injector is a Kubernetes Dynamic Admission Controller application that provides functionality of
patching Kubernetes pod specifications with requests and limits of custom network resources (managed by device plugins
such as k8snetworkplumbingwg/sriov-network-device-plugin). Requires Multus Network-Attach-Definition (NAD) custom
objects to be created before creating the pod object referring/pointing to them; custom network resources' request and
limits to add to the pod spec are inferred from the pointed NAD/s.

%prep
%autosetup -a1 -n %{name}-%{version} -p1

%build
%define cgoenabled "0"
%define buildgotags "no_openssl"
%define buildldflags "-w -s"
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -buildmode=pie -trimpath -ldflags %{buildldflags} -tags %{buildgotags} -o installer ./cmd/installer
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -buildmode=pie -trimpath -ldflags %{buildldflags} -tags %{buildgotags} -o webhook ./cmd/webhook


%install
install -D -m0755 installer %{buildroot}%{_bindir}/installer
install -D -m0755 webhook %{buildroot}%{_bindir}/webhook


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

%changelog
openSUSE Build Service is sponsored by