diff --git a/Dockerfile b/Dockerfile index 41bb2927b..5df897287 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. #======================================================================== -FROM golang +FROM golang:1.6 ADD ./main.go /go/src/github.com/intelsdi-x/dbi-iafeature-discovery/ ADD ./glide.yaml /go/src/github.com/intelsdi-x/dbi-iafeature-discovery/ diff --git a/README.md b/README.md index 907527ec3..6d3b1f351 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ will not add a label with the value `"false"` for features that are not present._ ``` -"node.alpha.intel.com/v0.1.0/cpu/": "true" +"node.alpha.intel.com/v0.1.0-cpu-": "true" ``` ### System Requirements @@ -142,7 +142,7 @@ how to target the Intel RDT L3 cache allocation (RDTL3CA) feature. } ], "nodeSelector": { - ""node.alpha.intel.com/v0.1.0-cpu-RDTL3CA": "true" + "node.alpha.intel.com/v0.1.0-cpu-RDTL3CA": "true" } } } diff --git a/main.go b/main.go index 2e55745d8..615cf3528 100644 --- a/main.go +++ b/main.go @@ -77,8 +77,8 @@ func main() { outString := string(out[:]) if outString == "DETECTED" { node.Labels["node.alpha.intel.com/v"+version+"-cpu-RDTMON"] = "true" + log.Printf("RDT Monitoring Detected\n") } - log.Printf("RDT Monitoring Detected\n") cmd = "/go/src/github.com/intelsdi-x/dbi-iafeature-discovery/rdt-discovery/l3-alloc-discovery" out, err = exec.Command("bash", "-c", cmd).Output() @@ -89,9 +89,9 @@ func main() { outString = string(out[:]) if outString == "DETECTED" { node.Labels["node.alpha.intel.com/v"+version+"-cpu-RDTL3CA"] = "true" + log.Printf("RDT L3 Cache Allocation Detected\n") } - log.Printf("RDT L3 Cache Allocation Detected\n") - + cmd = "/go/src/github.com/intelsdi-x/dbi-iafeature-discovery/rdt-discovery/l2-alloc-discovery" out, err = exec.Command("bash", "-c", cmd).Output() if err != nil { @@ -101,8 +101,21 @@ func main() { outString = string(out[:]) if outString == "DETECTED" { node.Labels["node.alpha.intel.com/v"+version+"-cpu-RDTL2CA"] = "true" + log.Printf("RDT L2 Cache Allocation Detected\n") + } + + // If turbo boost is enabled, add it as a node label + cmd = "cat /sys/devices/system/cpu/intel_pstate/no_turbo" + out, err = exec.Command("bash", "-c", cmd).Output() + if err != nil { + log.Fatalf("Can't Dectect if Turbo Boost is Enabled: %v", err) + } + + outString = string(out[:]) + if outString == "0\n" { + node.Labels["node.alpha.intel.com/v"+version+"-cpu-turbo"] = "true" + log.Printf("Turbo Boost is Enabled\n") } - log.Printf("RDT L2 Cache Allocation Detected\n") // Update the node with the node labels _, err = cli.Nodes().Update(node)