1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

Remove hardcoding of nfd source path (#94)

* Make rdt-discovery buildable outside hardcoded path

Do not assume that nfd sources always reside under hardcoded directory
"/go/src/github.com/kubernetes-incubator/node-feature-discovery/". This
makes it possible e.g. to build nfd locally outside the Docker
container.

* Do not hardcode the path for RDT helper binaries

Utilize the standard PATH env variable, instead.
This commit is contained in:
Markus Lehtonen 2018-03-16 18:56:35 +02:00 committed by Balaji Subramaniam
parent aaeba895c6
commit 348f3a7f89
3 changed files with 8 additions and 10 deletions

View file

@ -5,6 +5,10 @@ ADD . /go/src/github.com/kubernetes-incubator/node-feature-discovery
WORKDIR /go/src/github.com/kubernetes-incubator/node-feature-discovery
ENV PATH="/go/src/github.com/kubernetes-incubator/node-feature-discovery/rdt-discovery:${PATH}"
ENV CMT_CAT_SRCDIR="/go/src/github.com/kubernetes-incubator/node-feature-discovery/intel-cmt-cat"
ARG NFD_VERSION
RUN case $(dpkg --print-architecture) in \

View file

@ -1,6 +1,6 @@
CC=gcc
LIBDIR=/usr/local/lib
INCDIR=/go/src/github.com/kubernetes-incubator/node-feature-discovery/intel-cmt-cat/lib/
INCDIR=$(CMT_CAT_SRCDIR)/lib/
LDFLAGS=-L$(LIBDIR)
LDLIBS=-lpqos

View file

@ -18,16 +18,10 @@ package rdt
import (
"os/exec"
"path"
"github.com/golang/glog"
)
const (
// RDTBin is the path to RDT detection helpers.
RDTBin = "/go/src/github.com/kubernetes-incubator/node-feature-discovery/rdt-discovery"
)
// Source implements FeatureSource.
type Source struct{}
@ -38,7 +32,7 @@ func (s Source) Name() string { return "rdt" }
func (s Source) Discover() ([]string, error) {
features := []string{}
cmd := exec.Command("bash", "-c", path.Join(RDTBin, "mon-discovery"))
cmd := exec.Command("bash", "-c", "mon-discovery")
if err := cmd.Run(); err != nil {
glog.Errorf("support for RDT monitoring was not detected: %v", err)
} else {
@ -46,7 +40,7 @@ func (s Source) Discover() ([]string, error) {
features = append(features, "RDTMON")
}
cmd = exec.Command("bash", "-c", path.Join(RDTBin, "l3-alloc-discovery"))
cmd = exec.Command("bash", "-c", "l3-alloc-discovery")
if err := cmd.Run(); err != nil {
glog.Errorf("support for RDT L3 allocation was not detected: %v", err)
} else {
@ -54,7 +48,7 @@ func (s Source) Discover() ([]string, error) {
features = append(features, "RDTL3CA")
}
cmd = exec.Command("bash", "-c", path.Join(RDTBin, "l2-alloc-discovery"))
cmd = exec.Command("bash", "-c", "l2-alloc-discovery")
if err := cmd.Run(); err != nil {
glog.Errorf("support for RDT L2 allocation was not detected: %v", err)
} else {