-
Notifications
You must be signed in to change notification settings - Fork 36
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 per provider config: #326
Add per provider config: #326
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #326 +/- ##
==========================================
- Coverage 44.55% 44.14% -0.41%
==========================================
Files 36 37 +1
Lines 2790 2904 +114
==========================================
+ Hits 1243 1282 +39
- Misses 1422 1494 +72
- Partials 125 128 +3
☔ View full report in Codecov by Sentry. |
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.
Thanks for the efforts here, left a question/comment inline..
redfishVersionsNotCompatible: []string{}, | ||
Logger: logr.Discard(), | ||
Registry: registrar.NewRegistry(), | ||
providerConfig: providerConfig{ |
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.
Is it possible to have the providerConfig
(or have Options) type be exported as a struct/interface by each provider - so the provider specific configuration and http client checks can stay within the respective packages under providers/{asrockrack,redfish..}/
?
This would keep the client package free from provider specifics.
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.
Hey @joelrebel , thanks for looking at this. I've updated to have all providers define their own config struct and then client.go just collects them into a single struct. Is this more of what you had in mind? Also, this PR is still very much a WIP.
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.
Will take a look thanks!, apologies I missed the WIP/draft label on the PR.
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.
Hey @joelrebel, this PR should be ready for a proper review whenever you have cycles. Thanks!
0fa5f77
to
60a606a
Compare
1143a51
to
b8708bd
Compare
bb15d15
to
4a7719f
Compare
There exists some config that cannot be shared across all providers. For example, the port for ipmitool is generally 623, but is generally 16992 for intelAMT. Allowing per provider config enables customizing this type of data. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This allows the provider to specify all config it needs. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This makes New functions cleaner. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Add functional arguments for optional Ipmi struct values. Add additional struct values. Make cipher suite 3 the first suite tried. 3 is more commonly used then 17 so most machines will not try with 17 first. Add debug logging of ipmitool command line options. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
The new function signature does not return an error. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This uniforms providers to using func args. Updates the client to work with this. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Fix basic auth test and example. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
The registering of ipmitool provider doesnt ignore the error when its constructor is called. This means that systems without ipmitool will see that the ipmitool provider does not get registered. Previously it would always be registered. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Allow for a 10 millisecond error of margin. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Previously it was not. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This makes it more flexible and follows the pattern the other providers are using. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
98b0635
to
d91f2e7
Compare
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.
Thanks for all the fixes and changes here 👍 This does make passing parameters to individual providers easier and succinct.
The README requires some updating based on these changes, apart from that I've left a few comments, nothing major.
gofish is an implementation detail that shouldnt be exposed like this. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Clean up. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Extra precaution for race conditions. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Thanks, @joelrebel. Could you point me to the needed changes in the README.md, please? I'm not finding anything specific. |
sure, in the README we have examples with |
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Ahh, yes. thank you. I have updated the readme. |
cfd8410
to
60a0cde
Compare
`-race` flag was added to `make test` and requires CGO. go: -race requires cgo; enable cgo by setting CGO_ENABLED=1 Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
60a0cde
to
46acd6e
Compare
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.
Thanks for the work here @jacobweinstock
What does this PR implement/change/remove?
There exists some config that cannot be shared across all providers. For example, the port for ipmitool is generally 623 but is generally 16992 for intelAMT, cipher suites for ipmitool, or TLS certificates. Allowing per-provider config enables customizing this type of data.
This introduces a * breaking change * to
bmclib.NewClient
. It no longer takes in a port. The ports for each provider have a default defined and each one can be overridden with a functional option.WithIpmitoolPort
, for example.I think fundamentally the behavior from the consumer side doesn't change. Consumers will still use
With
functions to specify per provider config. This change just organizes it differently under the hood.Checklist
The HW vendor this change applies to (if applicable)
The HW model number, product name this change applies to (if applicable)
The BMC firmware and/or BIOS versions that this change applies to (if applicable)
What version of tooling - vendor specific or opensource does this change depend on (if applicable)
Description for changelog/release notes