-
Notifications
You must be signed in to change notification settings - Fork 9.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
*: fix server-side lease expire when auth is enabled #9018
Conversation
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 other than minor error reporting styles.
auth/store_test.go
Outdated
|
||
ai, aerr := as.AuthInfoFromCtx(ctx) | ||
if aerr != nil { | ||
t.Fatal(err) |
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.
Probably we should use t.Error
instead of t.Fatal
? It is same to the below error cases.
integration/v3_auth_test.go
Outdated
}, | ||
) | ||
if terr != nil { | ||
t.Fatal(terr) |
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 be t.Error
? Same to the below error cases.
@gyuho thanks for the fix. It seems to be interesting and terrible gRPC update. Does this mean we have no way to detect misusage of |
@mitake Yeah, it was pretty confusing gRPC update. Only way to prevent the misuse was having metadata tests on user-side. |
"WithRoot" is only used within local node, and "AuthInfoFromCtx" expects token from incoming context. Embed token with "NewIncomingContext" so that token can be found in "AuthInfoFromCtx". Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
@gyuho oh I see... we need to be careful in the future. |
@mitake Yeah, btw, just addressed your feedback. Let me merge when CIs turn green. Thanks! |
@gyuho lgtm after the CIs turn green, thanks! |
Codecov Report
@@ Coverage Diff @@
## master #9018 +/- ##
=========================================
Coverage ? 76.04%
=========================================
Files ? 359
Lines ? 29837
Branches ? 0
=========================================
Hits ? 22691
Misses ? 5569
Partials ? 1577
Continue to review full report at Codecov.
|
return metadata.NewOutgoingContext(ctx, tokenMD) | ||
|
||
// use "mdIncomingKey{}" since it's called from local etcdserver | ||
return metadata.NewIncomingContext(ctx, tokenMD) |
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.
Funny, I was just reading about these new grpc metadata context functions for the first time today.
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.
Yeah, it was from gRPC v1.3.0 with grpc/grpc-go#1157.
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
UPDATE: just found out we didn't backport #8031, so no need to backport this. |
When auth is enabled, lease revoke loop was broken because we were embedding the token in the wrong way.
Address #9006.