blob: d4ac3d6932e538e5e8aeac4579f90193656ab142 [file] [log] [blame]
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
EAPI=6
inherit eutils golang-vcs-snapshot toolchain-funcs systemd
EGO_PN="k8s.io/node-problem-detector"
DESCRIPTION="node-problem-detector"
HOMEPAGE="https://github.com/kubernetes/node-problem-detector"
SRC_URI="https://github.com/kubernetes/node-problem-detector/archive/${PV}.tar.gz -> ${P}.tar.gz"
# This includes the licenses of dependencies as the binary is statically linked.
#
# If LICENSE contains BSD, ISC, or MIT, then chromite will scan the source for
# copyright attribution. If the package vendors its dependencies or includes a
# THIRD_PARTY_LICENSES/ directory, then chromite will properly attribute all
# dependencies in about_os_credits.html.
#
# This list was determined by inspecting the output of:
# go-licenses csv k8s.io/node-problem-detector/cmd/nodeproblemdetector
# inside a clone of the package repo.
# https://github.com/google/go-licenses
LICENSE="Apache-2.0 BSD-2 BSD ISC MIT"
SLOT="0"
KEYWORDS="*"
IUSE=""
DEPEND="
sys-apps/systemd
"
RDEPEND="
sys-apps/systemd
"
S="${WORKDIR}/${P}/src/${EGO_PN}"
src_compile() {
export GOPATH="${WORKDIR}/${P}"
GO=$(tc-getGO)
export GO
go() {
echo "${GO} $@" 1>&2
"${GO}" "$@"
}
export -f go
emake VERSION="${PV}" bin/node-problem-detector
unset -f go
}
src_install() {
insinto /etc/node_problem_detector
doins "${FILESDIR}"/system-stats-monitor.json
doins "${FILESDIR}"/docker-monitor.json
doins "${FILESDIR}"/kernel-monitor.json
doins "${FILESDIR}"/stackdriver-exporter.json
doins "${FILESDIR}"/boot-disk-size-consistency-monitor.json
# add exec permission for to check boot disk size consistency
insopts -m0100
doins "${FILESDIR}"/check_boot_disk_size_consistency.sh
dosbin bin/node-problem-detector
systemd_dounit "${FILESDIR}"/node-problem-detector.service
}