Skip to content

Commit

Permalink
Add support for Core-Config
Browse files Browse the repository at this point in the history
Operand NFD Patch kubernetes-sigs/node-feature-discovery#433 changed the
way nfd-worker get's arguments, this patch looks to update the operator
to the new way of running the nfd-worker

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
  • Loading branch information
ArangoGutierrez committed Apr 13, 2021
1 parent 1027b80 commit 0ba1897
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 18 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ GO_FMT ?= gofmt
CONTAINER_RUN_CMD ?= docker run -u "`id -u`:`id -g`"

MDL ?= mdl

# Docker base command for working with html documentation.
# Use host networking because 'jekyll serve' is stupid enough to use the
# same site url than the "host" it binds to. Thus, all the links will be
Expand Down
8 changes: 4 additions & 4 deletions api/v1/nodefeaturediscovery_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// +k8s:openapi-gen=true
type NodeFeatureDiscoverySpec struct {
Operand OperandSpec `json:"operand"`
WorkerConfig ConfigSpec `json:"workerConfig"`
WorkerConfig ConfigMap `json:"workerConfig"`
}

// OperandSpec describes configuration options for the operand
Expand All @@ -42,8 +42,8 @@ type OperandSpec struct {
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
}

// ConfigSpec describes configuration options for the NFD worker
type ConfigSpec struct {
// ConfigMap describes configuration options for the NFD worker
type ConfigMap struct {
// BinaryData holds the NFD configuration file
ConfigData string `json:"configData"`
}
Expand Down Expand Up @@ -100,6 +100,6 @@ func (o *OperandSpec) ImagePolicy(pullPolicy string) corev1.PullPolicy {
}

// Data returns a valid ConfigMap name
func (c *ConfigSpec) Data() string {
func (c *ConfigMap) Data() string {
return c.ConfigData
}
8 changes: 4 additions & 4 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 105 additions & 1 deletion build/assets/worker/04_worker_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,61 @@ metadata:
data:
nfd-worker-conf: |
#uncomment to configure
#core:
# labelWhiteList:
# noPublish: false
# sleepInterval: 60s
# sources: [all]
# klog:
# addDirHeader: false
# alsologtostderr: false
# logBacktraceAt:
# logtostderr: true
# skipHeaders: false
# stderrthreshold: 2
# v: 0
# vmodule:
## NOTE: the following options are not dynamically run-time configurable
## and require a nfd-worker restart to take effect after being changed
# logDir:
# logFile:
# logFileMaxSize: 1800
# skipLogHeaders: false
#sources:
# cpu:
# cpuid:
## NOTE: whitelist has priority over blacklist
# attributeBlacklist:
# - "BMI1"
# - "BMI2"
# - "CLMUL"
# - "CMOV"
# - "CX16"
# - "ERMS"
# - "F16C"
# - "HTT"
# - "LZCNT"
# - "MMX"
# - "MMXEXT"
# - "NX"
# - "POPCNT"
# - "RDRAND"
# - "RDSEED"
# - "RDTSCP"
# - "SGX"
# - "SSE"
# - "SSE2"
# - "SSE3"
# - "SSE4.1"
# - "SSE4.2"
# - "SSSE3"
# attributeWhitelist:
# kernel:
# kconfigFile: "/path/to/kconfig"
# configOpts:
# - "NO_HZ"
# - "X86"
# - "DMI"
# pci:
# deviceClassWhitelist:
# - "0200"
Expand All @@ -17,4 +71,54 @@ data:
# - "device"
# - "subsystem_vendor"
# - "subsystem_device"
# usb:
# deviceClassWhitelist:
# - "0e"
# - "ef"
# - "fe"
# - "ff"
# deviceLabelFields:
# - "class"
# - "vendor"
# - "device"
# custom:
# - name: "my.kernel.feature"
# matchOn:
# - loadedKMod: ["example_kmod1", "example_kmod2"]
# - name: "my.pci.feature"
# matchOn:
# - pciId:
# class: ["0200"]
# vendor: ["15b3"]
# device: ["1014", "1017"]
# - pciId :
# vendor: ["8086"]
# device: ["1000", "1100"]
# - name: "my.usb.feature"
# matchOn:
# - usbId:
# class: ["ff"]
# vendor: ["03e7"]
# device: ["2485"]
# - usbId:
# class: ["fe"]
# vendor: ["1a6e"]
# device: ["089a"]
# - name: "my.combined.feature"
# matchOn:
# - pciId:
# vendor: ["15b3"]
# device: ["1014", "1017"]
# loadedKMod : ["vendor_kmod1", "vendor_kmod2"]
# - name: "feature.by.nodename"
# value: customValue
# matchOn:
# - nodename: ["worker-0", "my-.*-node"]
custom-conf: |
# - name: "more.kernel.features"
# matchOn:
# - loadedKMod: ["example_kmod3"]
# - name: "more.features.by.nodename"
# value: customValue
# matchOn:
# - nodename: ["special-.*-node-.*"]
6 changes: 2 additions & 4 deletions build/assets/worker/05_worker_ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ spec:
command:
- "nfd-worker"
args:
- "--sleep-interval=60s"
- "--server=nfd-master:$(NFD_MASTER_SERVICE_PORT)"
volumeMounts:
- name: host-boot
Expand All @@ -51,7 +50,7 @@ spec:
readOnly: true
- name: host-sys
mountPath: "/host-sys"
- name: config
- name: nfd-worker-config
mountPath: "/etc/kubernetes/node-feature-discovery"
- name: nfd-hooks
mountPath: "/etc/kubernetes/node-feature-discovery/source.d"
Expand All @@ -78,10 +77,9 @@ spec:
- name: nfd-features
hostPath:
path: "/etc/kubernetes/node-feature-discovery/features.d"
- name: config
- name: nfd-worker-config
configMap:
name: nfd-worker
items:
- key: nfd-worker-conf
path: nfd-worker.conf

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
type: string
type: object
workerConfig:
description: ConfigSpec describes configuration options for the NFD
description: ConfigMap describes configuration options for the NFD
worker
properties:
configData:
Expand Down
3 changes: 1 addition & 2 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,5 +315,4 @@ rules:
- patch
- update
- use
- watch

- watch
21 changes: 20 additions & 1 deletion config/samples/nfd.kubernetes.io_v1_nodefeaturediscovery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ spec:
imagePullPolicy: Always
workerConfig:
configData: |
#core:
# labelWhiteList:
# noPublish: false
# sleepInterval: 60s
# sources: [all]
# klog:
# addDirHeader: false
# alsologtostderr: false
# logBacktraceAt:
# logtostderr: true
# skipHeaders: false
# stderrthreshold: 2
# v: 0
# vmodule:
## NOTE: the following options are not dynamically run-time configurable
## and require a nfd-worker restart to take effect after being changed
# logDir:
# logFile:
# logFileMaxSize: 1800
# skipLogHeaders: false
#sources:
# cpu:
# cpuid:
Expand Down Expand Up @@ -95,4 +115,3 @@ spec:
# vendor: ["15b3"]
# device: ["1014", "1017"]
# loadedKMod : ["vendor_kmod1", "vendor_kmod2"]

0 comments on commit 0ba1897

Please sign in to comment.