-
Notifications
You must be signed in to change notification settings - Fork 8
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 white list #49
base: main
Are you sure you want to change the base?
Add white list #49
Conversation
WalkthroughThe pull request introduces a new package Changes
Sequence DiagramsequenceDiagram
participant Builder
participant Config
participant YAML Processor
Builder->>Config: UpdatePciDevices(whitelist, labelFields)
Config->>Config: SetPciWhitelistConfig
Config->>YAML Processor: GetYamlString()
YAML Processor-->>Config: Return YAML configuration
Config-->>Builder: Return updated configuration
The sequence diagram illustrates the workflow of updating PCI device configurations, showing how the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ggordaniRed The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@ggordaniRed: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
pkg/nfd/nodefeaturediscoveryconfig.go (2)
45-45
: Update the function comment to accurately describe PCI configuration.
The comment says "CPUConfigLabels set cpu blacklist/whitelist" but the function is for PCI device configuration. Updating the comment clarifies its purpose and avoids confusion.-// CPUConfigLabels set cpu blacklist/whitelist. +// SetPciWhitelistConfig updates the PCI device whitelist and label fields.
57-63
: Helpful method for retrieving the updated config as YAML.
TheGetYamlString()
function simplifies returning the config in its YAML form. Just keep in mind that any concurrency usage might require additional safeguards if multiple goroutines perform writes and reads in parallel.pkg/nfd/nodefeaturediscovery.go (1)
267-276
: Remove ineffectual assignment toerr
.
At line 270, the assignmentvar err error = nil
is flagged by static analysis as unnecessary. Simply declare the variable without initializing it tonil
.func (builder *Builder) UpdatePciDevices(deviceClassWhitelist []string, deviceLabelFields []string) error { cfg := NewConfig(builder.Definition.Spec.WorkerConfig.ConfigData) cfg.SetPciWhitelistConfig(deviceClassWhitelist, deviceLabelFields) - var err error = nil + var err error builder.Definition.Spec.WorkerConfig.ConfigData, err = cfg.GetYamlString() if err != nil { return err } return nil }🧰 Tools
🪛 golangci-lint (1.62.2)
270-270: ineffectual assignment to err
(ineffassign)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pkg/nfd/nodefeaturediscovery.go
(1 hunks)pkg/nfd/nodefeaturediscoveryconfig.go
(1 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
pkg/nfd/nodefeaturediscovery.go
270-270: ineffectual assignment to err
(ineffassign)
🔇 Additional comments (2)
pkg/nfd/nodefeaturediscoveryconfig.go (2)
36-43
: Looks good!
TheNewConfig
function correctly unmarshals the YAML configuration and handles errors gracefully by logging them.
45-55
: Good approach to clearing existing slices before appending new data.
Re-initializing the slice by slicing it to[:0]
ensures that stale references are removed. This is a concise and safe pattern.
append a new function and config struct for setting pci whitelist
Summary by CodeRabbit