commit 82afe79b89cede59bd78e89f57ce9b22ea2bd3c8
Author: Jan Chaloupka <jchaloup(a)redhat.com>
Date: Thu Oct 9 16:55:56 2014 +0200
Move cadvisor.service and cadvisor config file from patch into repo
Fix the build, thanks to Lokesh
cadvisor | 46 ++++++++++++++++++++++++++++++++++++++++++++++
cadvisor.service | 18 ++++++++++++++++++
cadvisor.spec | 31 ++++++++++++-------------------
3 files changed, 76 insertions(+), 19 deletions(-)
---
diff --git a/cadvisor b/cadvisor
new file mode 100644
index 0000000..8a2c793
--- /dev/null
+++ b/cadvisor
@@ -0,0 +1,46 @@
+# config options for cAdvisor
+#
+#
+
+# Docker endpoint to connect to
+# Default: unix:///var/run/docker.sock
+CADVISOR_DOCKER_ENDPOINT="unix:///var/run/docker.sock"
+
+# Port to listen on
+# Default: 8080
+# kubernetes expects it on port 4194
+CADVISOR_PORT="4194"
+
+# Samples
+# Number of samples to keep
+# Default: 1024
+CADVISOR_SAMPLES="1024"
+
+# Storage driver
+# Default: none/blank
+#
+# Available Options:
+# - [none]
+# - bigquery
+# - influxdb
+CADVISOR_STORAGE_DRIVER=""
+
+# Storage driver host
+# Default: localhost:8086"
+CADVISOR_STORAGE_DRIVER_HOST="localhost:8086"
+
+# Storage driver password
+# Default: root
+CADVISOR_STORAGE_DRIVER_PASSWORD="root"
+
+# Storage driver secure connection
+# Default: false
+CADVISOR_STORAGE_DRIVER_SECURE="false"
+
+# Storage driver user
+# Default: root
+CADVISOR_STORAGE_DRIVER_USER="root"
+
+# Log to stderr (and thus to journal)
+# Default: false
+CADVISOR_LOG_TO_STDERR="true"
diff --git a/cadvisor.service b/cadvisor.service
new file mode 100644
index 0000000..c465783
--- /dev/null
+++ b/cadvisor.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=cAdvisor
+
+[Service]
+EnvironmentFile=/etc/sysconfig/cadvisor
+ExecStart=/usr/bin/cadvisor \
+ --docker=${CADVISOR_DOCKER_ENDPOINT} \
+ --port=${CADVISOR_PORT} \
+ --samples=${CADVISOR_SAMPLES} \
+ --storage_driver=${CADVISOR_STORAGE_DRIVER} \
+ --storage_driver_host=${CADVISOR_STORAGE_DRIVER_HOST} \
+ --storage_driver_password=${CADVISOR_STORAGE_DRIVER_PASSWORD} \
+ --storage_driver_secure=${CADVISOR_STORAGE_DRIVER_SECURE} \
+ --storage_driver_user=${CADVISOR_STORAGE_DRIVER_USER} \
+ --logtostderr=${CADVISOR_LOG_TO_STDERR}
+
+[Install]
+WantedBy=multi-user.target
diff --git a/cadvisor.spec b/cadvisor.spec
index 211f056..52ea30e 100644
--- a/cadvisor.spec
+++ b/cadvisor.spec
@@ -11,14 +11,16 @@
Name: %{repo}
Version: 0.3.0
-Release: 0.3.git%{shortcommit}%{?dist}
+Release: 0.4.git%{shortcommit}%{?dist}
Summary: Analyzes resource usage and performance characteristics of running containers
License: ASL 2.0
URL: https://%{import_path}
Source0: https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
-Patch0: 0001-add-systemd-unit-file-sysconfig.patch
+Source1: cadvisor
+Source2: cadvisor.service
BuildRequires: docker-io-pkg-devel
BuildRequires: systemd
+BuildRequires: glibc-static
BuildRequires: golang >= 1.2.1-3
BuildRequires:
golang(github.com/docker/libcontainer)
BuildRequires:
golang(github.com/fsouza/go-dockerclient)
@@ -30,6 +32,7 @@ BuildRequires:
golang(github.com/influxdb/influxdb/client)
BuildRequires:
golang(github.com/stretchr/testify)
BuildRequires:
golang(github.com/stretchr/objx)
BuildRequires:
golang(github.com/golang/glog)
+Requires: docker-io
ExclusiveArch: x86_64
%description
@@ -102,8 +105,6 @@ so containers are inherently nested hierarchically.
%prep
%setup -n %{name}-%{commit} -q
-%patch0 -p1
-
%build
mkdir _build
@@ -113,19 +114,7 @@ pushd _build
popd
export GOPATH=$(pwd)/_build:%{buildroot}%{gopath}:%{gopath}
-### FIXME
-### Upstream uses this invocation of go build but it fails with the following:
-# go build --ldflags '-extldflags "-static"'
github.com/google/cadvisor
-# #
github.com/google/cadvisor
-# /usr/bin/ld: cannot find -lpthread
-# /usr/bin/ld: cannot find -lc
-# collect2: error: ld returned 1 exit status
-# /usr/lib/golang/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status
0x100
-#
-# It *seems* fine without it, but I assume upstream has a reason for doing
-# this, however I've yet to get a response on why and if it's necessary.
-
-go build
github.com/google/cadvisor
+go build --ldflags '-extldflags "-static"'
github.com/google/cadvisor
%install
# main package binary
@@ -134,9 +123,9 @@ install -p -m0755 cadvisor %{buildroot}%{_bindir}
# install systemd/sysconfig
install -d -m0755 %{buildroot}%{_sysconfdir}/sysconfig/
-install -p -m0660 sysconfig/%{name} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
+install -p -m0660 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -d -m0755 %{buildroot}%{_unitdir}
-install -p -m0644 init/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
+install -p -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
# devel package golang libs
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
@@ -190,6 +179,10 @@ done
%{gopath}/src/%{import_path}/utils/*
%changelog
+* Thu Oct 09 2014 jchaloup <jchaloup(a)redhat.com> - 0.3.0-0.4.git9d158c3
+- Move cadvisor.service and cadvisor config file from patch into repo
+- Fix the build, thanks to Lokesh
+
* Fri Sep 19 2014 Lokesh Mandvekar <lsm5(a)fedoraproject.org> - 0.3.0-0.3.git9d158c3
- own parent directory of <gopath</src/<import_path>
- preserve timestamps of copied files in -devel