Backport: Add optional Redfish session token caching to reduce BMC audit log spam - #1151
Open
stefanhipfel wants to merge 6 commits into
Open
Backport: Add optional Redfish session token caching to reduce BMC audit log spam#1151stefanhipfel wants to merge 6 commits into
stefanhipfel wants to merge 6 commits into
Conversation
Introduce a process-level SessionCache that reuses Redfish X-Auth-Token across reconcile loops, capping the effective TTL against the BMC-advertised SessionTimeout, with automatic invalidation and retry on 401. Enable via --bmc-auth-mode=session-cache and tune with --bmc-session-cache-ttl. Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
…meout and TLS config - NewSessionCache panics on non-positive TTL; cmd/main.go validates with <= 0 - sessionCacheEntry stores insecureTLS so Close() can build a matching TLS config - Close() uses a 10s per-request timeout to avoid blocking manager shutdown Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
…orphan note - NewSessionCache returns (cache, error) instead of panicking - IsSessionExpiredError now also matches HTTP 403 (Forbidden) - bmcBaseOptions includes polling fields so all three reconcilers share one source - --bmc-session-cache-ttl help text notes orphaned sessions on unclean exit Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
The suite_test.go on release-v0.7 had additional BMCOptions with BasicAuth: true for controllers added in v0.7 that were not present on main when the session cache feature was developed. Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
The helper always received the same 10-minute value, triggering the unparam linter. Inline the constant and drop the parameter. Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
Member
|
We should probably wait with the backport until we merge this feature into main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
release-v0.7.--bmc-auth-mode=session-cache) to reduce BMC audit log spam caused by thousands of basic-auth login/logout events per day.Backport notes
Cherry-picked commits from
main:cf50d99b— Add optional Redfish session token cachinge5dcf216— Fix gofmt formatting74b63b92— Fix session cache: reject non-positive TTL, shutdown DELETE timeout/TLS0078ff67— Address review feedback: error return, 403 retry, options asymmetry, orphan noteConflict resolution in
cmd/main.go: removed migration-related code (not present in v0.7). Also adaptedbmcuser_controller.goandsuite_test.gofor v0.7-specific controllers that usedBasicAuth: trueinbmc.Options(replaced withSessionCache == nilcheck / removed the field).Test plan
go build ./...passesmake testpasses (all 193 specs, one known-flakyBMCVersionSettimeout)--bmc-auth-mode=session-cache--bmc-auth-mode=session-cache --bmc-session-cache-ttl=25m