Skip to content

High level design PR: Add SDS dynamic secret#3748

Closed
qiwzhang wants to merge 1 commit intoenvoyproxy:masterfrom
qiwzhang:sds_b3_1
Closed

High level design PR: Add SDS dynamic secret#3748
qiwzhang wants to merge 1 commit intoenvoyproxy:masterfrom
qiwzhang:sds_b3_1

Conversation

@qiwzhang
Copy link
Contributor

Signed-off-by: Wayne Zhang qiwzhang@google.com

This PR is not a real PR, it is a high level design proposal to support fetching dynamic secrets.

Main changes:

  1. added SecretCallback interface to notify secret has been changed
  2. added DynamicSecretProvider interface to fetch dynamic secret.
  3. secretManager to hold static and dynamic secret separately.
  4. use shared_ptr for Context objects so an new object can be created while old one is in-use.

Code Status:
Passed compiling for files under /source/....

Signed-off-by: Wayne Zhang <qiwzhang@google.com>
@qiwzhang
Copy link
Contributor Author

@lizan @PiotrSikora Could you help to review it?

/**
* An interface to fetch dynamic secret.
*/
class DynamicSecretProvider {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why we need this and createDynamicSecretProvider, but not make SecretManager to manage callbacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Managing update callbacks by DynamicSecretProvider is more efficient since it only holds the callbacks that using that secret. If done in the secretManager, you need a map of hash + name to the vector of callbacks, you need map lookup. Beside, DynamicSecretProvider is implemented by SdsAPI. It has the onConfigUpate() call, so it is more nature to call its callbacks when onConfigUpdate() is called. It doesn't need to hold secretManager object either.


class SecretManagerUtil {
public:
virtual ~SecretManagerUtil() {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove

* @return a hash string of normalized config source.
*/
virtual DynamicSecretProviderSharedPtr
createDynamicSecretProvider(const envoy::api::v2::core::ConfigSource& config_source,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from impl, this is not a pure create, but find one if there is existing, need a better name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about "findOrCreateDynamicSecretProvider"?


class ClientContext : public virtual Context {};
typedef std::unique_ptr<ClientContext> ClientContextPtr;
typedef std::shared_ptr<ClientContext> ClientContextSharedPtr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we intended to make all *Context to SharedPtr? What is the usecase of unique_ptrs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unique_ptr can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I am working on a separate PR of making ssl_socket not to hold context as its member, only use ctx at constructor. If this works, we will continue to use unique_ptr for ctx.

std::vector<std::string> getDnsSansFromCertificate(X509* cert);

Network::TransportSocketCallbacks* callbacks_{};
ContextSharedPtr ctx_owner_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should be able to have this as std::shared_ptr<ContextImpl> and cast it with std::dynamic_pointer_cast

Copy link
Contributor Author

@qiwzhang qiwzhang Jun 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned above, I try to remove this member variable ctx_ in a separate PR

@lizan
Copy link
Member

lizan commented Jun 28, 2018

This includes all changes in #3700 right?

While we can review this on high level, but please address review/test on that first.

@JimmyCYJ
Copy link
Member

@lizan Yes, I am modifying #3700 to make it consistent with this high level design. That PR currently needs more tests to meet test coverage requirements. Once the PR is ready, I will ping you.

@stale
Copy link

stale bot commented Jul 6, 2018

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 6, 2018
@JimmyCYJ
Copy link
Member

JimmyCYJ commented Jul 6, 2018

#3700 is under review, and we are updating this PR accordingly. Please keep this PR open.

@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Jul 6, 2018
@stale
Copy link

stale bot commented Jul 13, 2018

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 13, 2018
@lizan lizan added no stalebot Disables stalebot from closing an issue and removed stale stalebot believes this issue/PR has not been touched recently labels Jul 13, 2018
@stale
Copy link

stale bot commented Jul 20, 2018

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 20, 2018
@stale
Copy link

stale bot commented Jul 27, 2018

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no stalebot Disables stalebot from closing an issue stale stalebot believes this issue/PR has not been touched recently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants