Skip to content

Sds: Ssl socket factory owns ContextConfig#4028

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
istio:sds_config_ptr
Aug 2, 2018
Merged

Sds: Ssl socket factory owns ContextConfig#4028
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
istio:sds_config_ptr

Conversation

@qiwzhang
Copy link
Contributor

@qiwzhang qiwzhang commented Aug 1, 2018

Description:

This change is one of PR to support dynamic SDS. The overall implementation PR is here #3700

Changes in this PR

  • use unique_ptr for ContextConfig object. If the config is updated (secret is updated), the same object will be used.
  • ssl socket factory owns ContextConfig object so later it can be used to re-create Context if config is updated
  • ssl socket factory adds un-used function onConfigUpdate() to illustrate how Context is created from updated config. This function will be called in a later PR.

Risk Level: Low

Testing: Unit-test

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

qiwzhang commented Aug 1, 2018

@lizan @PiotrSikora could you help to review it?

@lizan lizan self-assigned this Aug 1, 2018
@lizan lizan requested a review from PiotrSikora August 1, 2018 23:51
Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Generally LGTM for make TransportSocketFactory own ContextConfig, but prefer deferring onConfigUpdate.


private:
// Will be called when config_ is changed
void onConfigUpdate();
Copy link
Member

Choose a reason for hiding this comment

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

How this will be called? and tests? If the caller is not in this PR, include this in that PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. onConfigUpdate is removed.

Signed-off-by: Wayne Zhang <qiwzhang@google.com>
private:
Ssl::ContextManager& manager_;
Stats::Scope& stats_scope_;
ClientContextConfigPtr config_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to retain those? IT doesn't seem that those are used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be used in a later PR to create a new context when context_config is updated with new secret.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the code to use it

void ServerSslSocketFactory::onConfigUpdate() {
  ssl_ctx_ = manager_.createSslServerContext(stats_scope_, *config_, server_names_);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks!

@mattklein123 mattklein123 merged commit cb3356f into envoyproxy:master Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants