Support both take over configurations#45222
Conversation
The take over mode configuration changed format, this commit makes both formats accepted with no change on how the feature works.
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
🔍 Preview links for changed docs |
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
AndersonQ
left a comment
There was a problem hiding this comment.
No blocker, but I left a few suggestions
Co-authored-by: Anderson Queiroz <me@andersonq.me>
mauri870
left a comment
There was a problem hiding this comment.
I left a few minor comments, but the functionality looks good to me.
There was a problem hiding this comment.
I believe this is possible directly with go-ucfg and doesn't require you to write a custom function to determine if its enabled or not. You could do something like this below and I think it would work.
func (t *takeOverConfig) Unpack(value interface{}) error {
// handle boolean value
// handle object value
}
Then in the configuration you just use TakeOver takeOverConfig config:"take_over". When reading the configuration is done, it will call Unpack and you can handle both cases.
colleenmcginnis
left a comment
There was a problem hiding this comment.
Some thoughts and suggestions below. Let me know if you have questions about the versioning piece.
Co-authored-by: Colleen McGinnis <colleen.j.mcginnis@gmail.com>
…s into 45221-fix-take-over-config
Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
blakerouse
left a comment
There was a problem hiding this comment.
Looks good. Thank you for switching to using the Unpack interface. Nice idea with the LogWarnings.
The take over mode configuration changed format, this commit makes both formats accepted with no change on how the feature works. --------- Co-authored-by: Anderson Queiroz <me@andersonq.me> Co-authored-by: Colleen McGinnis <colleen.j.mcginnis@gmail.com> Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co> (cherry picked from commit f72b33d)
The take over mode configuration changed format, this commit makes both formats accepted with no change on how the feature works. --------- (cherry picked from commit f72b33d) Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co> Co-authored-by: Anderson Queiroz <me@andersonq.me> Co-authored-by: Colleen McGinnis <colleen.j.mcginnis@gmail.com> Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
Proposed commit message
The take over mode configuration changed format when its functionality was expanded. It changed
from a single boolean
To an object:
This commit makes both formats accepted with no change on how the feature works.
Checklist
I have made corresponding change to the default configuration filesI have added an entry inCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.## Disruptive User Impact## Author's ChecklistHow to test this PR locally
Run the tests
For manual testing, follow the procedures from #42624 and use both configuration formats.
Related issues
take_overconfiguration to keep compatibility with the previous version #45221## Use cases## Screenshots## Logs