-
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
connect: Fix an issue with updating CA config in a secondary datacenter #9009
Conversation
852a9c9
to
b813070
Compare
b813070
to
b546fb4
Compare
Discussed fixing the racey parts of the secondary logic with @rboyer and decided a good solution is to pull some of the intermediate update code out into a separate struct to manage the different states (ready/signing/reconfig) in a safer/more understandable way, so I'm going to update the PR with that next. |
b546fb4
to
3e2e9d1
Compare
I've updated the PR with the refactored CA logic - it still needs some test updates/fixes and a writeup of how the state machine logic avoids race conditions in specific situations. |
3e2e9d1
to
ac6ef28
Compare
40a4616
to
b2f1f1a
Compare
b2f1f1a
to
16e95f1
Compare
92142e7
to
9be7c64
Compare
if op != expected { | ||
t.Fatalf("got unexpected op %q, wanted %q", op, expected) | ||
} | ||
case <-time.After(3 * time.Second): |
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.
You could instead use the current time and the time portion of (*testing.T).Deadline()
instead to compute remaining test time instead of using a made up "not forever" number here and several other places
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.
LGTM assuming CI passes.
Further tests can come in a followup.
🍒 If backport labels were added before merging, cherry-picking will start automatically. To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/290464. |
🍒✅ Cherry pick of commit c4eff42 onto |
connect: Fix an issue with updating CA config in a secondary datacenter
connect: Fix an issue with updating CA config in a secondary datacenter
This PR fixes a case where updating the CA config in a secondary datacenter would cause an error when it should trigger the creation of a new intermediate certificate.
The test passes but I think this still needs some extra logic to prevent races between the RPC endpoint and
secondaryCARootWatch
/intermediateCertRenewalWatch
. CurrentlysecondaryCARootWatch
will set things right on its next iteration if there's a race where it gets overwritten by a call to the RPC endpoint, but since it spends most of its time waiting on a blocking query that could be up to 5-10 minutes with the wrong intermediate/root, which is a pretty long time to wait for things to converge.Fixes #7009.