-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Enable tag drift 03 #1187
Merged
Merged
Enable tag drift 03 #1187
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6a83593
EnableTagDrift in NodeService struct
152eca3
Remove from testutil/server.go
a0f8c0a
Remove from command/agent/config_test.go
96785ed
Add EnableTagDrift logic to command/agent/local.go
ab91590
Update tests - NodeService init needs bool
c8b4e32
Merge remote-tracking branch 'hashicorp/master' into enable_tag_drift_03
35f276f
Add test cases TestAgentAntiEntropy_EnableTagDrift
0b3faf6
Merge remote-tracking branch 'hashicorp/master' into enable_tag_drift_03
d7ce0b3
Remove debug lines
66fd8fb
Rename EnableTagOverride and update formatting
4caf049
Update documentation for service definition
598526e
Docs - add verbage to anti-entropy page.
1f330ad
Doc changes in response to review.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
At first I was a little weirded out that the local service is changing right here, but you have the lock and I'm not sure doing it elsewhere would be any cleaner. This looks ok.
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.
This does seem a bit odd though. I think it might be better to have an equality checker function rather than leaning on
reflect.DeepEqual
here. The current logic will also become problematic when switching to an in-memory state store (which is on our short-term roadmap), since the service is a pointer and you are actually swapping out part of the data here. Having an equality check function would also make this easier to test.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.
@ryanuber That makes sense, but I believe it's a little out of scope for this particular pull request. I would be happy to contribute independent of this change.
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.
@ryanuber don't we require that the local data changes to match the server if drift is enabled so that we don't sync back to the old tags if the service definition changes for some other reason? Also, this is the
localState
which just has maps vs. memdb. Want to make sure I understand your concern before we pull the trigger on this one.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.
@slackpad if we are doing a
DeepEqual
, then you are right, the definitions have to be perfectly equivalent. What I was suggesting was having like aServiceEquals(s1, s2 *structs.NodeService, drift bool) bool
kind of function, which would just skip the tag check if drift is enabled.You're right about the local state, my bad.
One other thing though - If we are modifying the local agent state then we aren't enabling drift, we are instead flipping it so that the remote state always wins, unless I'm missing something else 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.
@ryanuber I don't think I explained myself very well re-reading what I wrote :-)
I was thinking that it's important we do the copy here because if
DeepEqual
detects a change after that (a real change we want to sync), we want the tags from the server going back up to the catalog, not the local ones as if we had the compare function. I think if we didn't copy then we'd revert the drifted tags once the service changes for any other reason.