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

adding nfd feature rule package and new builder #882

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ggordaniRed
Copy link

@ggordaniRed ggordaniRed commented Jan 21, 2025

Adding new lib,builder,unit tests for nodfeaturerule object

Copy link
Collaborator

@cdvultur cdvultur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor changes

pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Show resolved Hide resolved
}

// GetErrorMessage returns builder's error message.
func (builder *NodeFeatureRuleBuilder) GetErrorMessage() string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the way the builders are designed, the error message should get returned when doing operations like creating, updating, or deleting. Is there a reason why you'd need to get the error message outside of that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please address this?

pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Show resolved Hide resolved
Copy link
Collaborator

@klaskosk klaskosk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments! I have a few more minor comments but overall is looking pretty good

pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved
pkg/nfd/nodefeaturerule.go Outdated Show resolved Hide resolved

return false, fmt.Errorf("%s builder cannot have nil apiClient", resourceCRD)
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a check for errorMsg (example)

pkg/nfd/nodefeaturerule.go Show resolved Hide resolved
// Created Builder object on the cluster.
Object *nfdv1.NodeFeatureRule
// api client to interact with the cluster.
apiClient *clients.Settings
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another thing I missed, but this should be switched to the client from controller-runtime. We accept *clients.Settings in functions but only store apiClient.Client in the builder (example)

}

// GetErrorMessage returns builder's error message.
func (builder *NodeFeatureRuleBuilder) GetErrorMessage() string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please address this?

Comment on lines +212 to +222
func buildTestClientWithNFDRuleScheme() *clients.Settings {
return clients.GetTestClients(clients.TestClientParams{
SchemeAttachers: nfdRuleTestSchemes,
})
}

func buildTestClientWithNFDRuleSchemeOnly() *clients.Settings {
return clients.GetTestClients(clients.TestClientParams{
SchemeAttachers: nfdRuleTestSchemes,
})
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these could be combined

ggordaniRed and others added 5 commits February 9, 2025 11:06
Co-authored-by: Kirsten Laskoski <[email protected]>
Co-authored-by: Kirsten Laskoski <[email protected]>
Co-authored-by: Kirsten Laskoski <[email protected]>
Co-authored-by: Kirsten Laskoski <[email protected]>
Co-authored-by: Kirsten Laskoski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants