-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
etcd: don't confuse prefixes during migration #4299
Conversation
@awly Can we make a backup of everything under |
The prefix fetching logic has a bug: it treats everything starting with `/teleport` as the legacy prefix data, even if it's `/teleport-foo/bar`. This is an issue if user specifies `/teleport-foo` as their custom prefix. Each restart will copy the data from `/teleport-foo/...` to `/teleport-foo-foo/...`. Set the legacy prefix const to `/teleport/` instead. This avoids excessive copying during startup. Prefixes can still be confused later on, with `Watch` and `GetRange`, but this is harder to migrate with backwards-compatibility.
a623683
to
12de0b0
Compare
@russjones we can probably backup the data we delete, under the custom prefix (not |
In case the migration kicks in by mistake, or ends up deleting more data than expected, a backup will be very handy.
@russjones PTAL |
When custom prefix is `/foo/`, the migration would move `/teleport/a` to `/foo/a`, but the backend later tries to read `/foo//a`. Also added tests to cover these edge cases.
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.
I don't like the idea of having the logic be sensitive to the differences in proceeding/trailing slashes. Seems like an unnecessary footgun. Ideally prefix
, /prefix
, and /prefix/
would all mean the same thing from the user's perspective.
Otherwise, LGTM.
@fspmarshall yeah, I agree. |
When we update the docs, I'll come back and update a setup guide for etcd, this does seem to follow the slightly confusing prefix logic of etcd as Forrest has pointed out https://etcd.io/docs/v3.3.12/op-guide/authentication/ btw, we should update #2883 to make it clear that it needs the trailing slash incase anyone else finds that ticket. ( or is this only an issue during a migration ) |
Huh. That is tricky. Its too bad we don't have a more well-defined format for the keys used by the I suppose that while |
@benarent actually, all our backed keys start with a Still need approval from @webvictim or @russjones for |
f6e68ea
to
a667162
Compare
The prefix fetching logic has a bug: it treats everything starting with
/teleport
as the legacy prefix data, even if it's/teleport-foo/bar
.This is an issue if user specifies
/teleport-foo
as their customprefix. Each restart will copy the data from
/teleport-foo/...
to/teleport-foo-foo/...
.Set the legacy prefix const to
/teleport/
instead. This avoidsexcessive copying during startup.
Fixes #4312