File node-feature-discovery.spec of Package node-feature-discovery

#
# spec file for package node-feature-discovery
#
# 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:           node-feature-discovery
Version:        0
Release:        0
Summary:        Advertises hardware features available on each Kubernetes node using node labels
License:        Apache-2.0
URL:            https://github.com/kubernetes-sigs/node-feature-discovery
Source:         %{name}-%{version}.tar
Source1:        vendor.tar.gz
BuildRequires:  golang(API) = 1.21
BuildRequires:  glibc-static
ExcludeArch:    s390
ExcludeArch:    %{ix86}

%description
Node-Feature-Discovery (NFD) software enables node feature discovery for Kubernetes. It detects hardware features available on each node in a
Kubernetes cluster, and advertises those features using node labels and optionally node extended resources, annotations and node taints.
Node Feature Discovery is compatible with any recent version of Kubernetes (v1.21+).

NFD consists of four software components:
- nfd-master:
    daemon responsible for communication towards the Kubernetes API. That is, it receives labeling requests from the worker and modifies node
    objects accordingly.
- nfd-worker:
    daemon responsible for feature detection. It then communicates the information to nfd-master which does the actual node labeling. One instance
    of nfd-worker is supposed to be running on each node of the cluster.
- nfd-topology-updater:
    daemon responsible for examining allocated resources on a worker node to account for resources available to be allocated to new pod on a per-zone
    basis (where a zone can be a NUMA node). It then creates or updates a NodeResourceTopology custom resource object specific to this node. One instance
    of nfd-topology-updater is supposed to be running on each node of the cluster.
- nfd-gc:
    daemon responsible for cleaning obsolete NodeFeature and NodeResourceTopology objects.
    One instance of nfd-gc is supposed to be running in the cluster.

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


%build
%define cgoenabled "1"
%define buildgotags "osusergo,netgo"
%define buildldflags '-s -w -linkmode=external -extldflags "-static -Wl,--fatal-warnings" -X sigs.k8s.io/node-feature-discovery/pkg/version.version=%{version} -X sigs.k8s.io/node-feature-discovery/pkg/utils/hostpath.pathPrefix=/'
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -trimpath -tags %{buildgotags} -ldflags %{buildldflags} -o kubectl-nfd ./cmd/kubectl-nfd
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -trimpath -tags %{buildgotags} -ldflags %{buildldflags} -o nfd-gc      ./cmd/nfd-gc
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -trimpath -tags %{buildgotags} -ldflags %{buildldflags} -o nfd-master  ./cmd/nfd-master
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -trimpath -tags %{buildgotags} -ldflags %{buildldflags} -o nfd-worker  ./cmd/nfd-worker
CGO_ENABLED=%{cgoenabled} go build -mod=vendor -trimpath -tags %{buildgotags} -ldflags %{buildldflags} -o nfd-topology-updater ./cmd/nfd-topology-updater


%install
install -D -m0755 kubectl-nfd %{buildroot}%{_bindir}/kubectl-nfd
install -D -m0755 nfd-gc %{buildroot}%{_bindir}/nfd-gc
install -D -m0755 nfd-master %{buildroot}%{_bindir}/nfd-master
install -D -m0755 nfd-worker %{buildroot}%{_bindir}/nfd-worker
install -D -m0755 nfd-topology-updater %{buildroot}%{_bindir}/nfd-topology-updater
install -D -m0644 ./deployment/components/worker-config/nfd-worker.conf.example %{buildroot}%{_sysconfdir}/kubernetes/node-feature-discovery/nfd-worker.conf


%files
%license LICENSE
%doc README.md
%{_bindir}/kubectl-nfd
%{_bindir}/nfd-gc
%{_bindir}/nfd-master
%{_bindir}/nfd-worker
%{_bindir}/nfd-topology-updater
%dir %{_sysconfdir}/kubernetes
%dir %{_sysconfdir}/kubernetes/node-feature-discovery
%{_sysconfdir}/kubernetes/node-feature-discovery/nfd-worker.conf

%changelog
openSUSE Build Service is sponsored by