Blob Blame History Raw
# Generated by go2rpm 1.8.2
%ifnarch %{ix86} %{arm}
%bcond_without check
%endif

# https://github.com/google/cadvisor
%global goipath         github.com/google/cadvisor
Version:                0.45.0

%gometa

%global common_description %{expand:
cAdvisor (Container Advisor) provides container users an understanding of the
resource usage and performance characteristics of their running containers. It
is a running daemon that collects, aggregates, processes, and exports
information about running containers. Specifically, for each container it keeps
resource isolation parameters, historical resource usage, histograms of complete
historical resource usage and network statistics. This data is exported by
container and machine-wide.

cAdvisor has native support for Docker containers and should support just about
any other container type out of the box. We strive for support across the board
so feel free to open an issue if that is not the case. cAdvisor's container
abstraction is based on lmctfy's so containers are inherently nested
hierarchically.}

%global golicenses      LICENSE
%global godocs          docs AUTHORS CHANGELOG.md CONTRIBUTING.md README.md

Name:           cadvisor
Release:        %autorelease
Summary:        Analyzes resource usage and performance characteristics of running containers

License:        Apache-2.0
URL:            %{gourl}
Source:         %{gosource}
Source1:        cadvisor
Source2:        cadvisor.service
# Use github.com/influxdata/influxdb1-client as influx client
Patch0:         0001-Use-github.com-influxdata-influxdb1-client-as-influx.patch

BuildRequires:  git-core
BuildRequires:  systemd
BuildRequires:  glibc-static

%description %{common_description}

%gopkg

%prep
%goprep
%patch -P0 -p1

%generate_buildrequires
%go_generate_buildrequires

%build
%gobuild -o %{gobuilddir}/bin/cadvisor %{goipath}/cmd

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

# install systemd/sysconfig
install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig/
install -p -m 0660 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -d -m 0755 %{buildroot}%{_unitdir}
install -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service

%post
%systemd_post cadvisor.service

%preun
%systemd_preun cadvisor.service

%postun
%systemd_postun cadvisor.service

%if %{with check}
%check
%gocheck -d integration/tests/api -d integration/tests/healthz -d machine -d github.com/google/cadvisor/container/containerd
%endif

%files
%license LICENSE
%doc docs AUTHORS CHANGELOG.md CONTRIBUTING.md README.md
%{_bindir}/cadvisor
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}

%gopkgfiles

%changelog
%autochangelog