mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-05 16:27:05 +00:00
102 lines
No EOL
60 KiB
HTML
102 lines
No EOL
60 KiB
HTML
<!DOCTYPE html> <html lang="en" dir="auto"> <head><meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="description" content="Feature discovery Table of contents Feature labels Feature sources CPU Custom IOMMU Kernel Memory Network PCI USB Storage System Local – user-speci..."> <meta name="revised" content=""> <meta name="author" content="Kubernetes SIGs"> <meta name="generator" content="jekyll-rtd-theme v2.0.9"> <meta property="og:title" content="Feature discovery · Node Feature Discovery"> <meta property="og:description" content="Feature discovery Table of contents Feature labels Feature sources CPU Custom IOMMU Kernel Memory Network PCI USB Storage System Local – user-speci..."> <meta property="og:locale" content="en"> <meta property="og:url" content="https://kubernetes-sigs.github.com/node-feature-discovery/v0.8/get-started/features.html"> <meta property="og:type" content="article"> <meta property="article:author" content="Kubernetes SIGs"> <meta property="article:published_time" content="2016-07-23T00:07:52-05:00"> <meta property="article:modified_time" content="2023-04-17T08:42:39-05:00"> <meta name="twitter:title" content="Feature discovery · Node Feature Discovery"> <meta name="twitter:description" content="Feature discovery Table of contents Feature labels Feature sources CPU Custom IOMMU Kernel Memory Network PCI USB Storage System Local – user-speci..."> <meta name="twitter:card" content="summary"> <meta name="twitter:site" content="@Kubernetes SIGs"> <meta name="twitter:url" content="https://kubernetes-sigs.github.com/node-feature-discovery/v0.8/get-started/features.html"> <meta name="twitter:creator" content="@jekyll-rtd-theme v2.0.9"> <title>Feature discovery · Node Feature Discovery</title> <link rel="dns-prefetch" href="https://rundocs-analytics.glitch.me"> <link rel="dns-prefetch" href="https://cdn.jsdelivr.net"> <link rel="canonical" href="https://kubernetes-sigs.github.com/node-feature-discovery/v0.8/get-started/features.html"><link rel="prev" href="https://kubernetes-sigs.github.com/node-feature-discovery/v0.8/get-started/deployment-and-usage.html"><link rel="next" href="https://kubernetes-sigs.github.com/node-feature-discovery/v0.8/get-started/examples-and-demos.html"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.9/assets/css/theme.min.css"> <link rel="icon" type="image/svg+xml" href="/node-feature-discovery/v0.8/assets/images/favicon.svg"> <link rel="icon" type="image/png" href="/node-feature-discovery/v0.8/assets/images/favicon-16x16.png" sizes="16x16"> <link rel="icon" type="image/png" href="/node-feature-discovery/v0.8/assets/images/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="/node-feature-discovery/v0.8/assets/images/favicon-96x96.png" sizes="96x96"> <link rel="mask-icon" href="/node-feature-discovery/v0.8/assets/images/favicon.svg" color="#2980b9"> <link rel="apple-touch-icon" href="/node-feature-discovery/v0.8/assets/images/apple-touch-icon-300x300.jpg"> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://kubernetes-sigs.github.com/node-feature-discovery/v0.8/get-started/features.html" }, "headline": "Feature discovery · Node Feature Discovery", "image": [], "author": { "@type": "Person", "name": "Kubernetes SIGs" }, "datePublished": "2016-07-23T00:07:52-05:00", "dateModified": "2023-04-17T08:42:39-05:00", "publisher": { "@type": "Organization", "name": "Kubernetes SIGs", "logo": { "@type": "ImageObject", "url": "https://avatars.githubusercontent.com/u/36015203?v=4" } }, "description": "Feature discovery Table of contents Feature labels Feature sources CPU Custom IOMMU Kernel Memory Network PCI USB Storage System Local – user-speci..." } </script> </head> <body class="container"><div class="sidebar-wrap overflow-hidden"> <div class="sidebar height-full overflow-y-scroll overflow-x-hidden"> <div class="header d-flex flex-column p-3 text-center"> <div class="title pb-1"> <a class="h4 no-underline py-1 px-2 rounded-1" href="/node-feature-discovery/v0.8/" title="Documentation of Node Feature Discovery - a Kubernetes add-on for discovering and advertising hardware features and system configuration in the cluster."> <i class="fa fa-home"></i> Node Feature Discovery </a> </div> <span class="version">v0.8.2</span> <form class="search pt-2" action="/node-feature-discovery/v0.8/search.html" method="get" autocomplete="off"> <input class="form-control input-block input-sm" type="text" name="q" placeholder="Search docs..."> </form> </div> <div class="toctree py-2" data-spy="affix" role="navigation" aria-label="main navigation"> <ul> </ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/v0.8/get-started/"> Get started </a><ul> <li class="toc level-1 " data-sort="1" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/get-started/introduction.html">1. Introduction</a> </li> <li class="toc level-1 " data-sort="2" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/get-started/quick-start.html">2. Quick start</a> </li> <li class="toc level-1 " data-sort="3" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/get-started/deployment-and-usage.html">3. Deployment and usage</a> </li> <li class="toc level-1 current" data-sort="4" data-level="1"> <a class="d-flex flex-items-baseline current" href="/node-feature-discovery/v0.8/get-started/features.html">4. Feature discovery</a> </li> <li class="toc level-1 " data-sort="5" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/get-started/examples-and-demos.html">5. Examples and demos</a> </li></ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/v0.8/advanced/"> Advanced </a><ul> <li class="toc level-1 " data-sort="1" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/advanced/developer-guide.html">1. Developer guide</a> </li> <li class="toc level-1 " data-sort="2" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/advanced/master-commandline-reference.html">2. Master cmdline reference</a> </li> <li class="toc level-1 " data-sort="3" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/advanced/worker-commandline-reference.html">3. Worker cmdline reference</a> </li> <li class="toc level-1 " data-sort="4" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/v0.8/advanced/worker-configuration-reference.html">4. Worker config reference</a> </li></ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/v0.8/contributing/"> Contributing </a><ul> </ul> </div> </div> </div> <div class="content-wrap"> <div class="header d-flex flex-justify-between p-2 hide-lg hide-xl" aria-label="top navigation"> <button id="toggle" class="btn-octicon p-2 m-0 text-white" type="button"> <i class="fa fa-bars"></i> </button> <div class="title flex-1 d-flex flex-justify-center"> <a class="h4 no-underline py-1 px-2 rounded-1" href="/node-feature-discovery/v0.8/">Node Feature Discovery</a> </div> </div> <div class="bg-red-2"> <div class="content p-3 px-sm-5"> This documentation is for Node Feature Discovery version that is no longer supported. Please upgrade and visit the <a class="no-underline" href="/node-feature-discovery/stable">documentation of the latest stable release</a>. </div> </div> <div class="content p-3 p-sm-5"> <div class="navigation-top d-flex flex-justify-between"> <ul class="breadcrumb" role="navigation" aria-label="breadcrumbs navigation"> <li class="breadcrumb-item"> <a class="no-underline" href="/node-feature-discovery/v0.8/" title="/"> <i class="fa fa-home"></i> </a> </li><li class="breadcrumb-item" ><a href="/node-feature-discovery/v0.8/get-started/">get-started</a></li><li class="breadcrumb-item" aria-current="page">features.md</li></ul> <a class="edit" href="https://github.com/kubernetes-sigs/node-feature-discovery/edit/gh-pages/get-started/features.md" title="Edit on GitHub" rel="noreferrer" target="_blank"> <i class="fa fa-edit"></i> </a> </div> <hr> <div role="main" itemscope="itemscope" itemtype="http://schema.org/Article"> <div class="markdown-body" itemprop="articleBody"> <h1 class="no_toc" id="feature-discovery">Feature discovery</h1> <h2 class="no_toc text-delta" id="table-of-contents">Table of contents</h2> <ol id="markdown-toc"> <li><a href="#feature-labels" id="markdown-toc-feature-labels">Feature labels</a></li> <li><a href="#feature-sources" id="markdown-toc-feature-sources">Feature sources</a> <ol> <li><a href="#cpu" id="markdown-toc-cpu">CPU</a></li> <li><a href="#custom" id="markdown-toc-custom">Custom</a></li> <li><a href="#iommu" id="markdown-toc-iommu">IOMMU</a></li> <li><a href="#kernel" id="markdown-toc-kernel">Kernel</a></li> <li><a href="#memory" id="markdown-toc-memory">Memory</a></li> <li><a href="#network" id="markdown-toc-network">Network</a></li> <li><a href="#pci" id="markdown-toc-pci">PCI</a></li> <li><a href="#usb" id="markdown-toc-usb">USB</a></li> <li><a href="#storage" id="markdown-toc-storage">Storage</a></li> <li><a href="#system" id="markdown-toc-system">System</a></li> <li><a href="#local--user-specific-features" id="markdown-toc-local--user-specific-features">Local – user-specific features</a></li> </ol> </li> <li><a href="#extended-resources" id="markdown-toc-extended-resources">Extended resources</a></li> </ol> <hr /> <p>Feature discovery in nfd-worker is performed by a set of separate modules called feature sources. Most of them are specifically responsible for certain domain of features (e.g. cpu). In addition there are two highly customizable feature sources that work accross the system.</p> <h2 id="feature-labels">Feature labels</h2> <p>Each discovered feature is advertised a label in the Kubernetes Node object. The published node labels encode a few pieces of information:</p> <ul> <li>Namespace, (all built-in labels use <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io</code>)</li> <li>The source for each label (e.g. <code class="language-plaintext highlighter-rouge notranslate">cpu</code>).</li> <li>The name of the discovered feature as it appears in the underlying source, (e.g. <code class="language-plaintext highlighter-rouge notranslate">cpuid.AESNI</code> from cpu).</li> <li>The value of the discovered feature.</li> </ul> <p>Feature label names adhere to the following pattern:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><namespace>/<source name>-<feature name>[.<attribute name>]
|
||
</code></pre> </div></div> <p>The last component (i.e. <code class="language-plaintext highlighter-rouge notranslate">attribute-name</code>) is optional, and only used if a feature logically has sub-hierarchy, e.g. <code class="language-plaintext highlighter-rouge notranslate">sriov.capable</code> and <code class="language-plaintext highlighter-rouge notranslate">sriov.configure</code> from the <code class="language-plaintext highlighter-rouge notranslate">network</code> source.</p> <p>The <code class="language-plaintext highlighter-rouge notranslate">-sources</code> flag controls which sources to use for discovery.</p> <p><em>Note: Consecutive runs of nfd-worker will update the labels on a given node. If features are not discovered on a consecutive run, the corresponding label will be removed. This includes any restrictions placed on the consecutive run, such as restricting discovered features with the -label-whitelist option.</em></p> <h2 id="feature-sources">Feature sources</h2> <h3 id="cpu">CPU</h3> <p>The <strong>cpu</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature name</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>cpuid</td> <td><cpuid flag></td> <td>CPU capability is supported</td> </tr> <tr> <td>hardware_multithreading</td> <td> </td> <td>Hardware multithreading, such as Intel HTT, enabled (number of logical CPUs is greater than physical CPUs)</td> </tr> <tr> <td>power</td> <td>sst_bf.enabled</td> <td>Intel SST-BF (<a href="https://www.intel.com/content/www/us/en/architecture-and-technology/speed-select-technology-article.html">Intel Speed Select Technology</a> - Base frequency) enabled</td> </tr> <tr> <td><a href="https://www.kernel.org/doc/Documentation/cpu-freq/intel-pstate.txt">pstate</a></td> <td>status</td> <td>The status of the Intel pstate driver when in use and enabled, either ‘active' or ‘passive'.</td> </tr> <tr> <td> </td> <td>turbo</td> <td>Set to ‘true' if turbo frequencies are enabled in Intel pstate driver, set to ‘false' if they have been disabled.</td> </tr> <tr> <td> </td> <td>scaling_governor</td> <td>The value of the Intel pstate scaling_governor when in use, either ‘powersave' or ‘performance'.</td> </tr> <tr> <td>cstate</td> <td>enabled</td> <td>Set to ‘true' if cstates are set in the intel_idle driver, otherwise set to ‘false'.</td> </tr> <tr> <td><a href="http://www.intel.com/content/www/us/en/architecture-and-technology/resource-director-technology.html">rdt</a></td> <td>RDTMON</td> <td>Intel RDT Monitoring Technology</td> </tr> <tr> <td> </td> <td>RDTCMT</td> <td>Intel Cache Monitoring (CMT)</td> </tr> <tr> <td> </td> <td>RDTMBM</td> <td>Intel Memory Bandwidth Monitoring (MBM)</td> </tr> <tr> <td> </td> <td>RDTL3CA</td> <td>Intel L3 Cache Allocation Technology</td> </tr> <tr> <td> </td> <td>RDTL2CA</td> <td>Intel L2 Cache Allocation Technology</td> </tr> <tr> <td> </td> <td>RDTMBA</td> <td>Intel Memory Bandwidth Allocation (MBA) Technology</td> </tr> </tbody> </table> <p>The (sub-)set of CPUID attributes to publish is configurable via the <code class="language-plaintext highlighter-rouge notranslate">attributeBlacklist</code> and <code class="language-plaintext highlighter-rouge notranslate">attributeWhitelist</code> cpuid options of the cpu source. If whitelist is specified, only whitelisted attributes will be published. With blacklist, only blacklisted attributes are filtered out. <code class="language-plaintext highlighter-rouge notranslate">attributeWhitelist</code> has priority over <code class="language-plaintext highlighter-rouge notranslate">attributeBlacklist</code>. For examples and more information about configurability, see <a href="deployment-and-usage#worker-configuration">configuration</a>. By default, the following CPUID flags have been blacklisted: BMI1, BMI2, CLMUL, CMOV, CX16, ERMS, F16C, HTT, LZCNT, MMX, MMXEXT, NX, POPCNT, RDRAND, RDSEED, RDTSCP, SGX, SSE, SSE2, SSE3, SSE4.1, SSE4.2 and SSSE3.</p> <p><strong>NOTE</strong> The cpuid features advertise <em>supported</em> CPU capabilities, that is, a capability might be supported but not enabled.</p> <h4 id="x86-cpuid-attributes-partial-list">X86 CPUID attributes (partial list)</h4> <table> <thead> <tr> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>ADX</td> <td>Multi-Precision Add-Carry Instruction Extensions (ADX)</td> </tr> <tr> <td>AESNI</td> <td>Advanced Encryption Standard (AES) New Instructions (AES-NI)</td> </tr> <tr> <td>AVX</td> <td>Advanced Vector Extensions (AVX)</td> </tr> <tr> <td>AVX2</td> <td>Advanced Vector Extensions 2 (AVX2)</td> </tr> </tbody> </table> <p>See the full list in <a href="https://github.com/klauspost/cpuid#x86-cpu-instructions">github.com/klauspost/cpuid</a>.</p> <h4 id="arm-cpuid-attribute-partial-list">Arm CPUID attribute (partial list)</h4> <table> <thead> <tr> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>IDIVA</td> <td>Integer divide instructions available in ARM mode</td> </tr> <tr> <td>IDIVT</td> <td>Integer divide instructions available in Thumb mode</td> </tr> <tr> <td>THUMB</td> <td>Thumb instructions</td> </tr> <tr> <td>FASTMUL</td> <td>Fast multiplication</td> </tr> <tr> <td>VFP</td> <td>Vector floating point instruction extension (VFP)</td> </tr> <tr> <td>VFPv3</td> <td>Vector floating point extension v3</td> </tr> <tr> <td>VFPv4</td> <td>Vector floating point extension v4</td> </tr> <tr> <td>VFPD32</td> <td>VFP with 32 D-registers</td> </tr> <tr> <td>HALF</td> <td>Half-word loads and stores</td> </tr> <tr> <td>EDSP</td> <td>DSP extensions</td> </tr> <tr> <td>NEON</td> <td>NEON SIMD instructions</td> </tr> <tr> <td>LPAE</td> <td>Large Physical Address Extensions</td> </tr> </tbody> </table> <h4 id="arm64-cpuid-attribute-partial-list">Arm64 CPUID attribute (partial list)</h4> <table> <thead> <tr> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>AES</td> <td>Announcing the Advanced Encryption Standard</td> </tr> <tr> <td>EVSTRM</td> <td>Event Stream Frequency Features</td> </tr> <tr> <td>FPHP</td> <td>Half Precision(16bit) Floating Point Data Processing Instructions</td> </tr> <tr> <td>ASIMDHP</td> <td>Half Precision(16bit) Asimd Data Processing Instructions</td> </tr> <tr> <td>ATOMICS</td> <td>Atomic Instructions to the A64</td> </tr> <tr> <td>ASIMRDM</td> <td>Support for Rounding Double Multiply Add/Subtract</td> </tr> <tr> <td>PMULL</td> <td>Optional Cryptographic and CRC32 Instructions</td> </tr> <tr> <td>JSCVT</td> <td>Perform Conversion to Match Javascript</td> </tr> <tr> <td>DCPOP</td> <td>Persistent Memory Support</td> </tr> </tbody> </table> <h3 id="custom">Custom</h3> <p>The Custom feature source allows the user to define features based on a mix of predefined rules. A rule is provided input witch affects its process of matching for a defined feature. The rules are specified in the nfd-worker configuration file. See <a href="/node-feature-discovery/v0.8/get-started/deployment-and-usage.html#worker-configuration">configuration</a> for instructions and examples how to set-up and manage the worker configuration.</p> <p>To aid in making Custom Features clearer, we define a general and a per rule nomenclature, keeping things as consistent as possible.</p> <h4 id="additional-configuration-directory">Additional configuration directory</h4> <p>Additionally to the rules defined in the nfd-worker configuration file, the Custom feature can read more configuration files located in the <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/custom.d/</code> directory. This makes more dynamic and flexible configuration easier. This directory must be available inside the NFD worker container, so Volumes and VolumeMounts must be used for mounting e.g. ConfigMap(s). The example deployment manifests provide an example (commented out) for providing Custom configuration with an additional ConfigMap, mounted into the <code class="language-plaintext highlighter-rouge notranslate">custom.d</code> directory.</p> <h4 id="general-nomenclature--definitions">General nomenclature & definitions</h4> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>Rule :Represents a matching logic that is used to match on a feature.
|
||
Rule Input :The input a Rule is provided. This determines how a Rule performs the match operation.
|
||
Matcher :A composition of Rules, each Matcher may be composed of at most one instance of each Rule.
|
||
</code></pre> </div></div> <h4 id="custom-features-format-using-the-nomenclature-defined-above">Custom features format (using the nomenclature defined above)</h4> <p>Rules are specified under <code class="language-plaintext highlighter-rouge notranslate">sources.custom</code> in the nfd-worker configuration file.</p> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">sources</span><span class="pi">:</span>
|
||
<span class="na">custom</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s"><feature name></span>
|
||
<span class="na">value</span><span class="pi">:</span> <span class="s"><optional feature value, defaults to "true"></span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="s"><Rule-1></span><span class="pi">:</span> <span class="s"><Rule-1 Input></span>
|
||
<span class="pi">[</span><span class="nv"><Rule-2></span><span class="pi">:</span> <span class="nv"><Rule-2 Input></span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="s"><Matcher-2></span>
|
||
<span class="pi">-</span> <span class="s">...</span>
|
||
<span class="pi">-</span> <span class="s">...</span>
|
||
<span class="pi">-</span> <span class="s"><Matcher-N></span>
|
||
<span class="pi">-</span> <span class="s"><custom feature 2></span>
|
||
<span class="pi">-</span> <span class="s">...</span>
|
||
<span class="pi">-</span> <span class="s">...</span>
|
||
<span class="pi">-</span> <span class="s"><custom feature M></span>
|
||
</code></pre> </div></div> <h4 id="matching-process">Matching process</h4> <p>Specifying Rules to match on a feature is done by providing a list of Matchers. Each Matcher contains one or more Rules.</p> <p>Logical <em>OR</em> is performed between Matchers and logical <em>AND</em> is performed between Rules of a given Matcher.</p> <h4 id="rules">Rules</h4> <h5 id="pciid-rule">pciid rule</h5> <h6 id="nomenclature">Nomenclature</h6> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>Attribute :A PCI attribute.
|
||
Element :An identifier of the PCI attribute.
|
||
</code></pre> </div></div> <p>The PciId Rule allows matching the PCI devices in the system on the following Attributes: <code class="language-plaintext highlighter-rouge notranslate">class</code>,<code class="language-plaintext highlighter-rouge notranslate">vendor</code> and <code class="language-plaintext highlighter-rouge notranslate">device</code>. A list of Elements is provided for each Attribute.</p> <h6 id="format">Format</h6> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">pciId </span><span class="pi">:</span>
|
||
<span class="na">class</span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><class id></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
<span class="na">vendor</span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><vendor id></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
<span class="na">device</span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><device id></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
</code></pre> </div></div> <p>Matching is done by performing a logical <em>OR</em> between Elements of an Attribute and logical <em>AND</em> between the specified Attributes for each PCI device in the system. At least one Attribute must be specified. Missing attributes will not partake in the matching process.</p> <h5 id="usbid-rule">UsbId rule</h5> <h6 id="nomenclature-1">Nomenclature</h6> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>Attribute :A USB attribute.
|
||
Element :An identifier of the USB attribute.
|
||
</code></pre> </div></div> <p>The UsbId Rule allows matching the USB devices in the system on the following Attributes: <code class="language-plaintext highlighter-rouge notranslate">class</code>,<code class="language-plaintext highlighter-rouge notranslate">vendor</code> and <code class="language-plaintext highlighter-rouge notranslate">device</code>. A list of Elements is provided for each Attribute.</p> <h6 id="format-1">Format</h6> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">usbId </span><span class="pi">:</span>
|
||
<span class="na">class</span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><class id></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
<span class="na">vendor</span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><vendor id></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
<span class="na">device</span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><device id></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
</code></pre> </div></div> <p>Matching is done by performing a logical <em>OR</em> between Elements of an Attribute and logical <em>AND</em> between the specified Attributes for each USB device in the system. At least one Attribute must be specified. Missing attributes will not partake in the matching process.</p> <h5 id="loadedkmod-rule">LoadedKMod rule</h5> <h6 id="nomenclature-2">Nomenclature</h6> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>Element :A kernel module
|
||
</code></pre> </div></div> <p>The LoadedKMod Rule allows matching the loaded kernel modules in the system against a provided list of Elements.</p> <h6 id="format-2">Format</h6> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">loadedKMod </span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><kernel module></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
</code></pre> </div></div> <p>Matching is done by performing logical <em>AND</em> for each provided Element, i.e the Rule will match if all provided Elements (kernel modules) are loaded in the system.</p> <h5 id="cpuid-rule">CpuId rule</h5> <h6 id="nomenclature-3">Nomenclature</h6> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>Element :A CPUID flag
|
||
</code></pre> </div></div> <p>The Rule allows matching the available CPUID flags in the system against a provided list of Elements.</p> <h6 id="format-3">Format</h6> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">cpuId </span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><CPUID flag string></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
</code></pre> </div></div> <p>Matching is done by performing logical <em>AND</em> for each provided Element, i.e the Rule will match if all provided Elements (CPUID flag strings) are available in the system.</p> <h5 id="kconfig-rule">Kconfig rule</h5> <h6 id="nomenclature-4">Nomenclature</h6> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>Element :A Kconfig option
|
||
</code></pre> </div></div> <p>The Rule allows matching the kconfig options in the system against a provided list of Elements.</p> <h6 id="format-4">Format</h6> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">kConfig</span><span class="pi">:</span> <span class="pi">[</span><span class="nv"><kernel config option ('y' or 'm') or '=<value>'></span><span class="pi">,</span> <span class="nv">...</span><span class="pi">]</span>
|
||
</code></pre> </div></div> <p>Matching is done by performing logical <em>AND</em> for each provided Element, i.e the Rule will match if all provided Elements (kernel config options) are enabled (<code class="language-plaintext highlighter-rouge notranslate">y</code> or <code class="language-plaintext highlighter-rouge notranslate">m</code>) or matching <code class="language-plaintext highlighter-rouge notranslate">=<value></code> in the kernel.</p> <h5 id="nodename-rule">Nodename rule</h5> <h6 id="nomenclature-5">Nomenclature</h6> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>Element :A nodename regexp pattern
|
||
</code></pre> </div></div> <p>The Rule allows matching the node's name against a provided list of Elements.</p> <h6 id="format-5">Format</h6> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">nodename</span><span class="pi">:</span> <span class="pi">[</span> <span class="nv"><nodename regexp pattern></span><span class="pi">,</span> <span class="nv">...</span> <span class="pi">]</span>
|
||
</code></pre> </div></div> <p>Matching is done by performing logical <em>OR</em> for each provided Element, i.e the Rule will match if one of the provided Elements (nodename regexp pattern) matches the node's name.</p> <h4 id="example">Example</h4> <div class="language-yaml highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="na">custom</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.kernel.feature"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">loadedKMod</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">kmod1"</span><span class="pi">,</span> <span class="s2">"</span><span class="s">kmod2"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.pci.feature"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">pciId</span><span class="pi">:</span>
|
||
<span class="na">vendor</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">15b3"</span><span class="pi">]</span>
|
||
<span class="na">device</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">1014"</span><span class="pi">,</span> <span class="s2">"</span><span class="s">1017"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.usb.feature"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">usbId</span><span class="pi">:</span>
|
||
<span class="na">vendor</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">1d6b"</span><span class="pi">]</span>
|
||
<span class="na">device</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">0003"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.combined.feature"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">loadedKMod </span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">vendor_kmod1"</span><span class="pi">,</span> <span class="s2">"</span><span class="s">vendor_kmod2"</span><span class="pi">]</span>
|
||
<span class="na">pciId</span><span class="pi">:</span>
|
||
<span class="na">vendor</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">15b3"</span><span class="pi">]</span>
|
||
<span class="na">device</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">1014"</span><span class="pi">,</span> <span class="s2">"</span><span class="s">1017"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.accumulated.feature"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">loadedKMod </span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">some_kmod1"</span><span class="pi">,</span> <span class="s2">"</span><span class="s">some_kmod2"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">pciId</span><span class="pi">:</span>
|
||
<span class="na">vendor</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">15b3"</span><span class="pi">]</span>
|
||
<span class="na">device</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">1014"</span><span class="pi">,</span> <span class="s2">"</span><span class="s">1017"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.kernel.featureneedscpu"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">kConfig</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">KVM_INTEL"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">cpuId</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">VMX"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.kernel.modulecompiler"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">kConfig</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">GCC_VERSION=100101"</span><span class="pi">]</span>
|
||
<span class="na">loadedKMod</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">kmod1"</span><span class="pi">]</span>
|
||
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">my.datacenter"</span>
|
||
<span class="na">value</span><span class="pi">:</span> <span class="s2">"</span><span class="s">datacenter-1"</span>
|
||
<span class="na">matchOn</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">nodename</span><span class="pi">:</span> <span class="pi">[</span> <span class="s2">"</span><span class="s">node-datacenter1-rack.*-server.*"</span> <span class="pi">]</span>
|
||
</code></pre> </div></div> <p><strong>In the example above:</strong></p> <ul> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/custom-my.kernel.feature=true</code> if the node has <code class="language-plaintext highlighter-rouge notranslate">kmod1</code> <em>AND</em> <code class="language-plaintext highlighter-rouge notranslate">kmod2</code> kernel modules loaded.</li> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/custom-my.pci.feature=true</code> if the node contains a PCI device with a PCI vendor ID of <code class="language-plaintext highlighter-rouge notranslate">15b3</code> <em>AND</em> PCI device ID of <code class="language-plaintext highlighter-rouge notranslate">1014</code> <em>OR</em> <code class="language-plaintext highlighter-rouge notranslate">1017</code>.</li> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/custom-my.usb.feature=true</code> if the node contains a USB device with a USB vendor ID of <code class="language-plaintext highlighter-rouge notranslate">1d6b</code> <em>AND</em> USB device ID of <code class="language-plaintext highlighter-rouge notranslate">0003</code>.</li> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/custom-my.combined.feature=true</code> if <code class="language-plaintext highlighter-rouge notranslate">vendor_kmod1</code> <em>AND</em> <code class="language-plaintext highlighter-rouge notranslate">vendor_kmod2</code> kernel modules are loaded <strong>AND</strong> the node contains a PCI device with a PCI vendor ID of <code class="language-plaintext highlighter-rouge notranslate">15b3</code> <em>AND</em> PCI device ID of <code class="language-plaintext highlighter-rouge notranslate">1014</code> <em>or</em> <code class="language-plaintext highlighter-rouge notranslate">1017</code>.</li> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/custom-my.accumulated.feature=true</code> if <code class="language-plaintext highlighter-rouge notranslate">some_kmod1</code> <em>AND</em> <code class="language-plaintext highlighter-rouge notranslate">some_kmod2</code> kernel modules are loaded <strong>OR</strong> the node contains a PCI device with a PCI vendor ID of <code class="language-plaintext highlighter-rouge notranslate">15b3</code> <em>AND</em> PCI device ID of <code class="language-plaintext highlighter-rouge notranslate">1014</code> <em>OR</em> <code class="language-plaintext highlighter-rouge notranslate">1017</code>.</li> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/custom-my.kernel.featureneedscpu=true</code> if <code class="language-plaintext highlighter-rouge notranslate">KVM_INTEL</code> kernel config is enabled <strong>AND</strong> the node CPU supports <code class="language-plaintext highlighter-rouge notranslate">VMX</code> virtual machine extensions</li> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/custom-my.kernel.modulecompiler=true</code> if the in-tree <code class="language-plaintext highlighter-rouge notranslate">kmod1</code> kernel module is loaded <strong>AND</strong> it's built with <code class="language-plaintext highlighter-rouge notranslate">GCC_VERSION=100101</code>.</li> <li>A node would contain the label: <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io/my.datacenter=datacenter-1</code> if the node's name matches the <code class="language-plaintext highlighter-rouge notranslate">node-datacenter1-rack.*-server.*</code> pattern, e.g. <code class="language-plaintext highlighter-rouge notranslate">node-datacenter1-rack2-server42</code></li> </ul> <h4 id="statically-defined-features">Statically defined features</h4> <p>Some feature labels which are common and generic are defined statically in the <code class="language-plaintext highlighter-rouge notranslate">custom</code> feature source. A user may add additional Matchers to these feature labels by defining them in the <code class="language-plaintext highlighter-rouge notranslate">nfd-worker</code> configuration file.</p> <table> <thead> <tr> <th>Feature</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>rdma</td> <td>capable</td> <td>The node has an RDMA capable Network adapter</td> </tr> <tr> <td>rdma</td> <td>enabled</td> <td>The node has the needed RDMA modules loaded to run RDMA traffic</td> </tr> </tbody> </table> <h3 id="iommu">IOMMU</h3> <p>The <strong>iommu</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th style="text-align: center">Feature name</th> <th style="text-align: center">Description</th> </tr> </thead> <tbody> <tr> <td style="text-align: center">enabled</td> <td style="text-align: center">IOMMU is present and enabled in the kernel</td> </tr> </tbody> </table> <h3 id="kernel">Kernel</h3> <p>The <strong>kernel</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>config</td> <td><option name></td> <td>Kernel config option is enabled (set ‘y' or ‘m'). Default options are <code class="language-plaintext highlighter-rouge notranslate">NO_HZ</code>, <code class="language-plaintext highlighter-rouge notranslate">NO_HZ_IDLE</code>, <code class="language-plaintext highlighter-rouge notranslate">NO_HZ_FULL</code> and <code class="language-plaintext highlighter-rouge notranslate">PREEMPT</code></td> </tr> <tr> <td>selinux</td> <td>enabled</td> <td>Selinux is enabled on the node</td> </tr> <tr> <td>version</td> <td>full</td> <td>Full kernel version as reported by <code class="language-plaintext highlighter-rouge notranslate">/proc/sys/kernel/osrelease</code> (e.g. ‘4.5.6-7-g123abcde')</td> </tr> <tr> <td> </td> <td>major</td> <td>First component of the kernel version (e.g. ‘4')</td> </tr> <tr> <td> </td> <td>minor</td> <td>Second component of the kernel version (e.g. ‘5')</td> </tr> <tr> <td> </td> <td>revision</td> <td>Third component of the kernel version (e.g. ‘6')</td> </tr> </tbody> </table> <p>Kernel config file to use, and, the set of config options to be detected are configurable. See <a href="deployment-and-usage#worker-configuration">configuration</a> for more information.</p> <h3 id="memory">Memory</h3> <p>The <strong>memory</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>numa</td> <td> </td> <td>Multiple memory nodes i.e. NUMA architecture detected</td> </tr> <tr> <td>nv</td> <td>present</td> <td>NVDIMM device(s) are present</td> </tr> <tr> <td>nv</td> <td>dax</td> <td>NVDIMM region(s) configured in DAX mode are present</td> </tr> </tbody> </table> <h3 id="network">Network</h3> <p>The <strong>network</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>sriov</td> <td>capable</td> <td><a href="http://www.intel.com/content/www/us/en/pci-express/pci-sig-sr-iov-primer-sr-iov-technology-paper.html">Single Root Input/Output Virtualization</a> (SR-IOV) enabled Network Interface Card(s) present</td> </tr> <tr> <td> </td> <td>configured</td> <td>SR-IOV virtual functions have been configured</td> </tr> </tbody> </table> <h3 id="pci">PCI</h3> <p>The <strong>pci</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><device label></td> <td>present</td> <td>PCI device is detected</td> </tr> <tr> <td><device label></td> <td>sriov.capable</td> <td><a href="http://www.intel.com/content/www/us/en/pci-express/pci-sig-sr-iov-primer-sr-iov-technology-paper.html">Single Root Input/Output Virtualization</a> (SR-IOV) enabled PCI device present</td> </tr> </tbody> </table> <p><code class="language-plaintext highlighter-rouge notranslate"><device label></code> is composed of raw PCI IDs, separated by underscores. The set of fields used in <code class="language-plaintext highlighter-rouge notranslate"><device label></code> is configurable, valid fields being <code class="language-plaintext highlighter-rouge notranslate">class</code>, <code class="language-plaintext highlighter-rouge notranslate">vendor</code>, <code class="language-plaintext highlighter-rouge notranslate">device</code>, <code class="language-plaintext highlighter-rouge notranslate">subsystem_vendor</code> and <code class="language-plaintext highlighter-rouge notranslate">subsystem_device</code>. Defaults are <code class="language-plaintext highlighter-rouge notranslate">class</code> and <code class="language-plaintext highlighter-rouge notranslate">vendor</code>. An example label using the default label fields:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>feature.node.kubernetes.io/pci-1200_8086.present=true
|
||
</code></pre> </div></div> <p>Also the set of PCI device classes that the feature source detects is configurable. By default, device classes (0x)03, (0x)0b40 and (0x)12, i.e. GPUs, co-processors and accelerator cards are detected.</p> <h3 id="usb">USB</h3> <p>The <strong>usb</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><device label></td> <td>present</td> <td>USB device is detected</td> </tr> </tbody> </table> <p><code class="language-plaintext highlighter-rouge notranslate"><device label></code> is composed of raw USB IDs, separated by underscores. The set of fields used in <code class="language-plaintext highlighter-rouge notranslate"><device label></code> is configurable, valid fields being <code class="language-plaintext highlighter-rouge notranslate">class</code>, <code class="language-plaintext highlighter-rouge notranslate">vendor</code>, and <code class="language-plaintext highlighter-rouge notranslate">device</code>. Defaults are <code class="language-plaintext highlighter-rouge notranslate">class</code>, <code class="language-plaintext highlighter-rouge notranslate">vendor</code> and <code class="language-plaintext highlighter-rouge notranslate">device</code>. An example label using the default label fields:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>feature.node.kubernetes.io/usb-fe_1a6e_089a.present=true
|
||
</code></pre> </div></div> <p>See <a href="deployment-and-usage#worker-configuration">configuration</a> for more information on NFD config.</p> <h3 id="storage">Storage</h3> <p>The <strong>storage</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>nonrotationaldisk</td> <td>Non-rotational disk, like SSD, is present in the node</td> </tr> </tbody> </table> <h3 id="system">System</h3> <p>The <strong>system</strong> feature source supports the following labels:</p> <table> <thead> <tr> <th>Feature</th> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>os_release</td> <td>ID</td> <td>Operating system identifier</td> </tr> <tr> <td> </td> <td>VERSION_ID</td> <td>Operating system version identifier (e.g. ‘6.7')</td> </tr> <tr> <td> </td> <td>VERSION_ID.major</td> <td>First component of the OS version id (e.g. ‘6')</td> </tr> <tr> <td> </td> <td>VERSION_ID.minor</td> <td>Second component of the OS version id (e.g. ‘7')</td> </tr> </tbody> </table> <h3 id="local--user-specific-features">Local – user-specific features</h3> <p>NFD has a special feature source named <em>local</em> which is designed for getting the labels from user-specific feature detector. It provides a mechanism for users to implement custom feature sources in a pluggable way, without modifying nfd source code or Docker images. The local feature source can be used to advertise new user-specific features, and, for overriding labels created by the other feature sources.</p> <p>The <em>local</em> feature source gets its labels by two different ways:</p> <ul> <li>It tries to execute files found under <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/source.d/</code> directory. The hook files must be executable and they are supposed to print all discovered features in <code class="language-plaintext highlighter-rouge notranslate">stdout</code>, one per line. With ELF binaries static linking is recommended as the selection of system libraries available in the NFD release image is very limited. Other runtimes currently supported by the NFD stock image are bash and perl.</li> <li>It reads files found under <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/features.d/</code> directory. The file content is expected to be similar to the hook output (described above).</li> </ul> <p><strong>NOTE:</strong> The <a href="deployment-and-usage#minimal">minimal</a> image variant only supports running statically linked binaries.</p> <p>These directories must be available inside the Docker image so Volumes and VolumeMounts must be used if standard NFD images are used. The given template files mount by default the <code class="language-plaintext highlighter-rouge notranslate">source.d</code> and the <code class="language-plaintext highlighter-rouge notranslate">features.d</code> directories respectively from <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/source.d/</code> and <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/features.d/</code> from the host. You should update them to match your needs.</p> <p>In both cases, the labels can be binary or non binary, using either <code class="language-plaintext highlighter-rouge notranslate"><name></code> or <code class="language-plaintext highlighter-rouge notranslate"><name>=<value></code> format.</p> <p>Unlike the other feature sources, the name of the file, instead of the name of the feature source (that would be <code class="language-plaintext highlighter-rouge notranslate">local</code> in this case), is used as a prefix in the label name, normally. However, if the <code class="language-plaintext highlighter-rouge notranslate"><name></code> of the label starts with a slash (<code class="language-plaintext highlighter-rouge notranslate">/</code>) it is used as the label name as is, without any additional prefix. This makes it possible for the user to fully control the feature label names, e.g. for overriding labels created by other feature sources.</p> <p>You can also override the default namespace of your labels using this format: <code class="language-plaintext highlighter-rouge notranslate"><namespace>/<name>[=<value>]</code>. You must whitelist your namespace using the <code class="language-plaintext highlighter-rouge notranslate">-extra-label-ns</code> option on the master. In this case, the name of the file will not be added to the label name. For example, if you want to add the label <code class="language-plaintext highlighter-rouge notranslate">my.namespace.org/my-label=value</code>, your hook output or file must contains <code class="language-plaintext highlighter-rouge notranslate">my.namespace.org/my-label=value</code> and you must add <code class="language-plaintext highlighter-rouge notranslate">-extra-label-ns=my.namespace.org</code> on the master command line.</p> <p><code class="language-plaintext highlighter-rouge notranslate">stderr</code> output of the hooks is propagated to NFD log so it can be used for debugging and logging.</p> <h4 id="injecting-labels-from-other-pods">Injecting labels from other pods</h4> <p>One use case for the hooks and/or feature files is detecting features in other Pods outside NFD, e.g. in Kubernetes device plugins. It is possible to mount the <code class="language-plaintext highlighter-rouge notranslate">source.d</code> and/or <code class="language-plaintext highlighter-rouge notranslate">features.d</code> directories common with the NFD Pod and deploy the custom hooks/features there. NFD will periodically scan the directories and run any hooks and read any feature files it finds. The <a href="https://github.com/kubernetes-sigs/node-feature-discovery/blob/v0.8.2/nfd-worker-daemonset.yaml.template#L69">example nfd-worker deployment template</a> contains <code class="language-plaintext highlighter-rouge notranslate">hostPath</code> mounts for <code class="language-plaintext highlighter-rouge notranslate">sources.d</code> and <code class="language-plaintext highlighter-rouge notranslate">features.d</code> directories. By using the same mounts in the secondary Pod (e.g. device plugin) you have created a shared area for delivering hooks and feature files to NFD.</p> <h4 id="a-hook-example">A hook example</h4> <p>User has a shell script <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/source.d/my-source</code> which has the following <code class="language-plaintext highlighter-rouge notranslate">stdout</code> output:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>MY_FEATURE_1
|
||
MY_FEATURE_2=myvalue
|
||
/override_source-OVERRIDE_BOOL
|
||
/override_source-OVERRIDE_VALUE=123
|
||
override.namespace/value=456
|
||
</code></pre> </div></div> <p>which, in turn, will translate into the following node labels:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>feature.node.kubernetes.io/my-source-MY_FEATURE_1=true
|
||
feature.node.kubernetes.io/my-source-MY_FEATURE_2=myvalue
|
||
feature.node.kubernetes.io/override_source-OVERRIDE_BOOL=true
|
||
feature.node.kubernetes.io/override_source-OVERRIDE_VALUE=123
|
||
override.namespace/value=456
|
||
</code></pre> </div></div> <h4 id="a-file-example">A file example</h4> <p>User has a file <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/features.d/my-source</code> which contains the following lines:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>MY_FEATURE_1
|
||
MY_FEATURE_2=myvalue
|
||
/override_source-OVERRIDE_BOOL
|
||
/override_source-OVERRIDE_VALUE=123
|
||
override.namespace/value=456
|
||
</code></pre> </div></div> <p>which, in turn, will translate into the following node labels:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>feature.node.kubernetes.io/my-source-MY_FEATURE_1=true
|
||
feature.node.kubernetes.io/my-source-MY_FEATURE_2=myvalue
|
||
feature.node.kubernetes.io/override_source-OVERRIDE_BOOL=true
|
||
feature.node.kubernetes.io/override_source-OVERRIDE_VALUE=123
|
||
override.namespace/value=456
|
||
</code></pre> </div></div> <p>NFD tries to run any regular files found from the hooks directory. Any additional data files your hook might need (e.g. a configuration file) should be placed in a separate directory in order to avoid NFD unnecessarily trying to execute these. You can use a subdirectory under the hooks directory, for example <code class="language-plaintext highlighter-rouge notranslate">/etc/kubernetes/node-feature-discovery/source.d/conf/</code>.</p> <p><strong>NOTE!</strong> NFD will blindly run any executables placed/mounted in the hooks directory. It is the user's responsibility to review the hooks for e.g. possible security implications.</p> <p><strong>NOTE!</strong> Be careful when creating and/or updating hook or feature files while NFD is running. In order to avoid race conditions you should write into a temporary file (outside the <code class="language-plaintext highlighter-rouge notranslate">source.d</code> and <code class="language-plaintext highlighter-rouge notranslate">features.d</code> directories), and, atomically create/update the original file by doing a filesystem move operation.</p> <h2 id="extended-resources">Extended resources</h2> <p>This feature is experimental and by no means a replacement for the usage of device plugins.</p> <p>Labels which have integer values, can be promoted to Kubernetes extended resources by listing them to the master <code class="language-plaintext highlighter-rouge notranslate">-resource-labels</code> command line flag. These labels won't then show in the node label section, they will appear only as extended resources.</p> <p>An example use-case for the extended resources could be based on a hook which creates a label for the node SGX EPC memory section size. By giving the name of that label in the <code class="language-plaintext highlighter-rouge notranslate">-resource-labels</code> flag, that value will then turn into an extended resource of the node, allowing PODs to request that resource and the Kubernetes scheduler to schedule such PODs to only those nodes which have a sufficient capacity of said resource left.</p> <p>Similar to labels, the default namespace <code class="language-plaintext highlighter-rouge notranslate">feature.node.kubernetes.io</code> is automatically prefixed to the extended resource, if the promoted label doesn't have a namespace.</p> <p>Example usage of the command line arguments, using a new namespace: <code class="language-plaintext highlighter-rouge notranslate">nfd-master -resource-labels=my_source-my.feature,sgx.some.ns/epc -extra-label-ns=sgx.some.ns</code></p> <p>The above would result in following extended resources provided that related labels exist:</p> <div class="language-plaintext highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code> sgx.some.ns/epc: <label value>
|
||
feature.node.kubernetes.io/my_source-my.feature: <label value>
|
||
</code></pre> </div></div> <!-- Links --> </div> </div> <div class="navigation-bottom d-flex flex-justify-between py-3" role="navigation" aria-label="footer navigation"> <div class="prev"><a href="/node-feature-discovery/v0.8/get-started/deployment-and-usage.html" class="btn" title="Deployment and usage" accesskey="p" rel="prev"> <i class="fa fa-arrow-circle-left"></i> Previous </a></div> <div class="next"><a href="/node-feature-discovery/v0.8/get-started/examples-and-demos.html" class="btn" title="Examples and demos" accesskey="n" rel="next"> Next <i class="fa fa-arrow-circle-right"></i> </a></div> </div><hr> <div class="copyright text-center text-gray" role="contentinfo"> <i class="fa fa-copyright"></i> <span class="time">2016-2023,</span> <a class="text-gray" href="https://github.com/kubernetes-sigs" rel="noreferrer" target="_blank">Kubernetes SIGs</a> Revision <a class="text-gray" href="https://github.com/kubernetes-sigs/node-feature-discovery/commit/" title="" rel="noreferrer" target="_blank"></a> <br> <div class="generator"> Built with <a href="https://jekyllrb.com" rel="noreferrer" target="_blank">Jekyll</a> using a <a href="https://github.com/rundocs/jekyll-rtd-theme" rel="noreferrer" target="_blank" title="remote theme: jekyll-rtd-theme v2.0.9">theme</a> provided by <a href="https://rundocs.io" rel="noreferrer" target="_blank">RunDocs</a>. </div> </div> </div> </div> <div class="addons-wrap d-flex flex-column overflow-y-auto"> <div class="status d-flex flex-justify-between p-2"> <div class="title p-1"> <i class="fa fa-book"></i> Node Feature Discovery </div> <div class="branch p-1"> <span class="name"> v0.8 </span> <i class="fa fa-caret-down"></i> </div> </div> <div class="addons d-flex flex-column height-full p-2 d-none"> <dl id="versions"> <dt>Versions</dt> <script src="/node-feature-discovery/versions.js"></script> <script> var dt = document.getElementById('versions'); var items = getVersionListItems(); for (var i=0; i < items.length; i++) { var dd = document.createElement('dd'); var a = dd.appendChild(document.createElement('a')); a.appendChild(document.createTextNode(items[i].name)); a.href = items[i].url; dt.appendChild(dd); } </script> </dl> <dl> <dt>GitHub</dt> <dd> <a href="https://github.com/kubernetes-sigs/node-feature-discovery" title="Stars: 548"> <i class="fa fa-github"></i> Homepage </a> </dd> <dd> <a href="https://github.com/kubernetes-sigs/node-feature-discovery/issues" title="Open issues: 31"> <i class="fa fa-question-circle-o"></i> Issues </a> </dd> <dd> <a href="https://github.com/kubernetes-sigs/node-feature-discovery/zipball/gh-pages" title="Size: 88715 Kb"> <i class="fa fa-download"></i> Download </a> </dd> </dl> <hr> <div class="license f6 pb-2"> The <a href="/node-feature-discovery/v0.8/">software</a> is under the terms of <a href="https://github.com/kubernetes-sigs/node-feature-discovery">Apache License 2.0</a>. </div> </div> </div> <script> window.ui = { title: "Node Feature Discovery", baseurl: "/node-feature-discovery/v0.8", i18n: { search_results: "Search Results", search_results_found: "Search finished, found # page(s) matching the search query.", search_results_not_found: "Your search did not match any documents, please make sure that all characters are spelled correctly!" } }; </script> <script src="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.9/assets/js/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.9/assets/js/theme.min.js"></script> </body> </html> |