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:
parent
aaeba895c6
commit
348f3a7f89
3 changed files with 8 additions and 10 deletions
|
@ -5,6 +5,10 @@ ADD . /go/src/github.com/kubernetes-incubator/node-feature-discovery
|
||||||
|
|
||||||
WORKDIR /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
|
ARG NFD_VERSION
|
||||||
|
|
||||||
RUN case $(dpkg --print-architecture) in \
|
RUN case $(dpkg --print-architecture) in \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
CC=gcc
|
CC=gcc
|
||||||
LIBDIR=/usr/local/lib
|
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)
|
LDFLAGS=-L$(LIBDIR)
|
||||||
LDLIBS=-lpqos
|
LDLIBS=-lpqos
|
||||||
|
|
|
@ -18,16 +18,10 @@ package rdt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"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.
|
// Source implements FeatureSource.
|
||||||
type Source struct{}
|
type Source struct{}
|
||||||
|
|
||||||
|
@ -38,7 +32,7 @@ func (s Source) Name() string { return "rdt" }
|
||||||
func (s Source) Discover() ([]string, error) {
|
func (s Source) Discover() ([]string, error) {
|
||||||
features := []string{}
|
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 {
|
if err := cmd.Run(); err != nil {
|
||||||
glog.Errorf("support for RDT monitoring was not detected: %v", err)
|
glog.Errorf("support for RDT monitoring was not detected: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,7 +40,7 @@ func (s Source) Discover() ([]string, error) {
|
||||||
features = append(features, "RDTMON")
|
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 {
|
if err := cmd.Run(); err != nil {
|
||||||
glog.Errorf("support for RDT L3 allocation was not detected: %v", err)
|
glog.Errorf("support for RDT L3 allocation was not detected: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,7 +48,7 @@ func (s Source) Discover() ([]string, error) {
|
||||||
features = append(features, "RDTL3CA")
|
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 {
|
if err := cmd.Run(); err != nil {
|
||||||
glog.Errorf("support for RDT L2 allocation was not detected: %v", err)
|
glog.Errorf("support for RDT L2 allocation was not detected: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue