Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Core-Config #60

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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"]