mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-05 08:17:04 +00:00
* Arrange feature sources alphabetically Just a cosmetic change, but, a small readability improvement. * Implement detection of IOMMU (#136) Add a new feature source, i.e. 'iommu', which detects if an IOMMU is present and enabled in the kernel. The new node label is node.alpha.kubernetes-incubator.io/nfd-iommu-present
This commit is contained in:
parent
420baf3dce
commit
175305b1ad
4 changed files with 90 additions and 37 deletions
66
README.md
66
README.md
|
@ -46,7 +46,7 @@ node-feature-discovery.
|
|||
-h --help Show this screen.
|
||||
--version Output version and exit.
|
||||
--sources=<sources> Comma separated list of feature sources.
|
||||
[Default: cpuid,rdt,pstate,memory,network,storage,selinux]
|
||||
[Default: cpuid,iommu,memory,network,pstate,rdt,selinux,storage]
|
||||
--no-publish Do not publish discovered features to the
|
||||
cluster-local Kubernetes API server.
|
||||
--label-whitelist=<pattern> Regular expression to filter label names to
|
||||
|
@ -64,12 +64,13 @@ node-feature-discovery.
|
|||
The current set of feature sources are the following:
|
||||
|
||||
- [CPUID][cpuid] for x86/Arm64 CPU details
|
||||
- [Intel Resource Director Technology][intel-rdt]
|
||||
- [Intel P-State driver][intel-pstate]
|
||||
- IOMMU
|
||||
- Memory
|
||||
- Network
|
||||
- Storage
|
||||
- Pstate ([Intel P-State driver][intel-pstate])
|
||||
- RDT ([Intel Resource Director Technology][intel-rdt])
|
||||
- Selinux
|
||||
- Storage
|
||||
|
||||
### Feature labels
|
||||
|
||||
|
@ -89,12 +90,13 @@ the only label value published for features is the string `"true"`._
|
|||
{
|
||||
"node.alpha.kubernetes-incubator.io/node-feature-discovery.version": "v0.2.0",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-cpuid-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-rdt-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-pstate-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-iommu-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-memory-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-network-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-storage-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-selinux-<feature-name>": "true"
|
||||
"node.alpha.kubernetes-incubator.io/nfd-pstate-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-rdt-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-selinux-<feature-name>": "true",
|
||||
"node.alpha.kubernetes-incubator.io/nfd-storage-<feature-name>": "true"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -105,17 +107,6 @@ given node. If features are not discovered on a consecutive run, the correspondi
|
|||
label will be removed. This includes any restrictions placed on the consecutive run,
|
||||
such as restricting discovered features with the --label-whitelist option._
|
||||
|
||||
### Intel Resource Director Technology (RDT) Features
|
||||
|
||||
| Feature name | Description |
|
||||
| :------------: | :---------------------------------------------------------------------------------: |
|
||||
| RDTMON | Intel RDT Monitoring Technology
|
||||
| RDTCMT | Intel Cache Monitoring (CMT)
|
||||
| RDTMBM | Intel Memory Bandwidth Monitoring (MBM)
|
||||
| RDTL3CA | Intel L3 Cache Allocation Technology
|
||||
| RDTL2CA | Intel L2 Cache Allocation Technology
|
||||
| RDTMBA | Intel Memory Bandwidth Allocation (MBA) Technology
|
||||
|
||||
### X86 CPUID Features (Partial List)
|
||||
|
||||
| Feature name | Description |
|
||||
|
@ -130,12 +121,6 @@ such as restricting discovered features with the --label-whitelist option._
|
|||
| SSE4.2 | Streaming SIMD Extensions 4.2 (SSE4.2)
|
||||
| SGX | Software Guard Extensions (SGX)
|
||||
|
||||
### Memory Features
|
||||
|
||||
| Feature name | Description |
|
||||
| :------------: | :---------------------------------------------------------------------------------: |
|
||||
| numa | Multiple memory nodes i.e. NUMA architecture detected
|
||||
|
||||
### Arm64 CPUID Features (Partial List)
|
||||
|
||||
| Feature name | Description |
|
||||
|
@ -150,17 +135,34 @@ such as restricting discovered features with the --label-whitelist option._
|
|||
| JSCVT | Perform Conversion to Match Javascript
|
||||
| DCPOP | Persistent Memory Support
|
||||
|
||||
### IOMMU Features
|
||||
|
||||
| Feature name | Description |
|
||||
| :------------: | :---------------------------------------------------------------------------------: |
|
||||
| enabled | IOMMU is present and enabled in the kernel
|
||||
|
||||
### Memory Features
|
||||
|
||||
| Feature name | Description |
|
||||
| :------------: | :---------------------------------------------------------------------------------: |
|
||||
| numa | Multiple memory nodes i.e. NUMA architecture detected
|
||||
|
||||
### Network Features
|
||||
|
||||
| Feature name | Description |
|
||||
| :------------: | :---------------------------------------------------------------------------------: |
|
||||
| [SRIOV][sriov] | Single Root Input/Output Virtualization (SR-IOV) enabled Network Interface Card
|
||||
|
||||
### Storage Features
|
||||
### RDT (Intel Resource Director Technology) Features
|
||||
|
||||
| Feature name | Description |
|
||||
| :--------------: | :---------------------------------------------------------------------------------: |
|
||||
| nonrotationaldisk | Non-rotational disk, like SSD, is present in the node
|
||||
| Feature name | Description |
|
||||
| :------------: | :---------------------------------------------------------------------------------: |
|
||||
| RDTMON | Intel RDT Monitoring Technology
|
||||
| RDTCMT | Intel Cache Monitoring (CMT)
|
||||
| RDTMBM | Intel Memory Bandwidth Monitoring (MBM)
|
||||
| RDTL3CA | Intel L3 Cache Allocation Technology
|
||||
| RDTL2CA | Intel L2 Cache Allocation Technology
|
||||
| RDTMBA | Intel Memory Bandwidth Allocation (MBA) Technology
|
||||
|
||||
### Selinux Features
|
||||
|
||||
|
@ -168,6 +170,12 @@ such as restricting discovered features with the --label-whitelist option._
|
|||
| :--------------: | :---------------------------------------------------------------------------------: |
|
||||
| selinux | selinux is enabled on the node
|
||||
|
||||
### Storage Features
|
||||
|
||||
| Feature name | Description |
|
||||
| :--------------: | :---------------------------------------------------------------------------------: |
|
||||
| nonrotationaldisk | Non-rotational disk, like SSD, is present in the node
|
||||
|
||||
## Getting started
|
||||
### System requirements
|
||||
|
||||
|
|
14
main.go
14
main.go
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/kubernetes-incubator/node-feature-discovery/source"
|
||||
"github.com/kubernetes-incubator/node-feature-discovery/source/cpuid"
|
||||
"github.com/kubernetes-incubator/node-feature-discovery/source/fake"
|
||||
"github.com/kubernetes-incubator/node-feature-discovery/source/iommu"
|
||||
"github.com/kubernetes-incubator/node-feature-discovery/source/memory"
|
||||
"github.com/kubernetes-incubator/node-feature-discovery/source/network"
|
||||
"github.com/kubernetes-incubator/node-feature-discovery/source/panic_fake"
|
||||
|
@ -136,7 +137,7 @@ func argsParse(argv []string) (args Args) {
|
|||
-h --help Show this screen.
|
||||
--version Output version and exit.
|
||||
--sources=<sources> Comma separated list of feature sources.
|
||||
[Default: cpuid,rdt,pstate,memory,network,storage,selinux]
|
||||
[Default: cpuid,iommu,memory,network,pstate,rdt,selinux,storage]
|
||||
--no-publish Do not publish discovered features to the
|
||||
cluster-local Kubernetes API server.
|
||||
--label-whitelist=<pattern> Regular expression to filter label names to
|
||||
|
@ -186,14 +187,15 @@ func configureParameters(sourcesWhiteList []string, labelWhiteListStr string) (e
|
|||
// Configure feature sources.
|
||||
allSources := []source.FeatureSource{
|
||||
cpuid.Source{},
|
||||
rdt.Source{},
|
||||
pstate.Source{},
|
||||
fake.Source{},
|
||||
iommu.Source{},
|
||||
memory.Source{},
|
||||
network.Source{},
|
||||
storage.Source{},
|
||||
selinux.Source{},
|
||||
fake.Source{},
|
||||
panic_fake.Source{},
|
||||
pstate.Source{},
|
||||
rdt.Source{},
|
||||
selinux.Source{},
|
||||
storage.Source{},
|
||||
}
|
||||
|
||||
enabledSources = []source.FeatureSource{}
|
||||
|
|
|
@ -135,7 +135,7 @@ func TestArgsParse(t *testing.T) {
|
|||
So(args.sleepInterval, ShouldEqual, 60*time.Second)
|
||||
So(args.noPublish, ShouldBeTrue)
|
||||
So(args.oneshot, ShouldBeTrue)
|
||||
So(args.sources, ShouldResemble, []string{"cpuid", "rdt", "pstate", "memory", "network", "storage", "selinux"})
|
||||
So(args.sources, ShouldResemble, []string{"cpuid", "iommu", "memory", "network", "pstate", "rdt", "selinux", "storage"})
|
||||
So(len(args.labelWhiteList), ShouldEqual, 0)
|
||||
})
|
||||
})
|
||||
|
@ -157,7 +157,7 @@ func TestArgsParse(t *testing.T) {
|
|||
|
||||
Convey("args.labelWhiteList is set to appropriate value and args.sources is set to default value", func() {
|
||||
So(args.noPublish, ShouldBeFalse)
|
||||
So(args.sources, ShouldResemble, []string{"cpuid", "rdt", "pstate", "memory", "network", "storage", "selinux"})
|
||||
So(args.sources, ShouldResemble, []string{"cpuid", "iommu", "memory", "network", "pstate", "rdt", "selinux", "storage"})
|
||||
So(args.labelWhiteList, ShouldResemble, ".*rdt.*")
|
||||
})
|
||||
})
|
||||
|
|
43
source/iommu/iommu.go
Normal file
43
source/iommu/iommu.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package iommu
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
// Implement FeatureSource interface
|
||||
type Source struct{}
|
||||
|
||||
func (s Source) Name() string { return "iommu" }
|
||||
|
||||
func (s Source) Discover() ([]string, error) {
|
||||
features := []string{}
|
||||
|
||||
// Check if any iommu devices are available
|
||||
devices, err := ioutil.ReadDir("/sys/class/iommu/")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to check for IOMMU support: %v", err)
|
||||
}
|
||||
|
||||
if len(devices) > 0 {
|
||||
features = append(features, "enabled")
|
||||
}
|
||||
|
||||
return features, nil
|
||||
}
|
Loading…
Add table
Reference in a new issue