-
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
Enable tag drift 03 #1187
Changes from 6 commits
6a83593
152eca3
a0f8c0a
96785ed
ab91590
c8b4e32
35f276f
0b3faf6
d7ce0b3
66fd8fb
4caf049
598526e
1f330ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,6 +379,12 @@ func (l *localState) setSyncState() error { | |
} | ||
|
||
// If our definition is different, we need to update it | ||
if existing.EnableTagDrift { | ||
l.logger.Printf("[DEBUG] Tag drift enabled.") | ||
existing.Tags = service.Tags | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @slackpad if we are doing a 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 commentThe 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 |
||
} else { | ||
l.logger.Printf("[DEBUG] Tag drift disabled.") | ||
} | ||
equal := reflect.DeepEqual(existing, service) | ||
l.serviceStatus[id] = syncStatus{inSync: equal} | ||
} | ||
|
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.
Should blow away these debug prints.