feat: credential injector impl#30850
Conversation
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
1350725 to
78d5e62
Compare
This comment was marked as outdated.
This comment was marked as outdated.
adisuissa
left a comment
There was a problem hiding this comment.
Small API comment.
RE doc errors, I assume it is due to linking to "not-implemented-hide" protos.
api/envoy/extensions/filters/http/credential_injector/v3/credential_injector.proto
Outdated
Show resolved
Hide resolved
b829c04 to
b93e805
Compare
|
Assigning Kuat as code-owner. |
fff14f0 to
17e9c6a
Compare
adisuissa
left a comment
There was a problem hiding this comment.
Thanks!
Left a small suggestion on the API, but otherwise the API LGTM.
api/envoy/extensions/filters/http/credential_injector/v3/credential_injector.proto
Outdated
Show resolved
Hide resolved
887b67b to
21934d7
Compare
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
|
will look at this PR tomorrow. It's huge. orz |
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
wbpcode
left a comment
There was a problem hiding this comment.
Thanks for your great contribution. This is a super huge PR. Thanks again for all your time and paying for it.
Some initial important comments are added to this PR.
source/extensions/filters/http/credential_injector/credential_injector_filter.h
Outdated
Show resolved
Hide resolved
source/extensions/filters/http/credential_injector/credential_injector_filter.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
|
/retest |
|
After discussing with @wbpcode, we think the initialization process can be handled in individual credential extensions. This means the filter only needs to call the
@kyessenov I believe you suggested a similar approach before? If we're all in agreement with this approach, I'll proceed with updating the current implementation as outlined above. |
|
Sounds reasonable. The details are easier to work out once you have an implementation for oauth2. All we really need is to be able to pause a request, and let the extension handle the job itself (e.g. no explicit thread management in this filter). |
I'm thinking just failing the request and letting the client decide the next step(fail, retry, etc.) if the extension fails to initialize the credentials, like what we have done with the generic extension(SDS). By this way, we can decouple the filter and the extension's credential initialization/retry logic. |
wbpcode
left a comment
There was a problem hiding this comment.
Thanks for your update. It's much simpler (and better) now. Fix the tests and CI, then it is ready for final review.
source/extensions/filters/http/credential_injector/credential_injector_filter.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
|
/retest |
|
no point retesting atm - test certs are currently broken (#33389) |
wbpcode
left a comment
There was a problem hiding this comment.
Thanks for your update. It's near to there. Only some minor comments are added to the implementation details.
source/extensions/filters/http/credential_injector/credential_injector_filter.h
Outdated
Show resolved
Hide resolved
source/extensions/http/injected_credentials/generic/generic_impl.h
Outdated
Show resolved
Hide resolved
| class MockSecretReader : public Http::InjectedCredentials::Common::SecretReader { | ||
| public: | ||
| MockSecretReader(const std::string& secret) : secret_(secret){}; | ||
| const std::string& credential() const override { return secret_; } | ||
|
|
||
| private: | ||
| const std::string secret_; | ||
| }; |
There was a problem hiding this comment.
nit: I think it would be better to mock the CredentialInjector rather than to mock the SecretReader. Because the filter actually only use the CredentialInjector and the SecretReader is only part of implementation of GenericCredentialInjector.
|
/wait |
Signed-off-by: huabing zhao <zhaohuabing@gmail.com> wrap tests in anonymous namespace Signed-off-by: huabing zhao <zhaohuabing@gmail.com> address comments Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
wbpcode
left a comment
There was a problem hiding this comment.
LGTM. Thanks so much for your great works and paying of so long time.
|
Thank you @kyessenov @lizan @adisuissa @wbpcode for helping on reviews and all the great feedback. I really appreciate it. |
Implementation for the credential injector HTTP filter.
This PR includes the implementation of the Credential Injector filter and the Generic extension type. The oauth2 extension type will be in a follow-up pR.
Related: #27769
Sponsor: @kyessenov kindly offered to be the sponsor of this new filter.
Risk Level: low
Testing: yes
Docs Changes: yes
Release Notes: yes
Platform Specific Features: No
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]