-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
sds: clusters and listeners read static secrets from Bootstrap.static_resources #3378
sds: clusters and listeners read static secrets from Bootstrap.static_resources #3378
Conversation
Excited to see this being worked on. @lizan @PiotrSikora can you take a first pass? |
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.
A quick pass. (I already went over once before this PR)
unittests for SecretManagerImpl?
ci/do_circle_ci.sh
Outdated
@@ -4,7 +4,7 @@ set -e | |||
|
|||
# bazel uses jgit internally and the default circle-ci .gitconfig says to | |||
# convert https://github.com to ssh://git@github.com, which jgit does not support. | |||
mv ~/.gitconfig ~/.gitconfig_save | |||
# mv ~/.gitconfig ~/.gitconfig_save |
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.
?
include/envoy/secret/secret.h
Outdated
virtual const std::string& getPrivateKey() PURE; | ||
}; | ||
|
||
typedef std::shared_ptr<Secret> SecretPtr; |
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.
nit: SecretSharedPtr
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.
Replaced
source/common/json/config_schemas.cc
Outdated
@@ -1678,4 +1678,19 @@ const std::string Json::Schema::SDS_SCHEMA(R"EOF( | |||
"required" : ["hosts"] | |||
} | |||
)EOF"); | |||
|
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.
This is not going to v1 so I don't think you need this.
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.
Removed
source/common/secret/secret_impl.cc
Outdated
certificate_chain_(readDataSource(config.tls_certificate().certificate_chain(), true)), | ||
private_key_(readDataSource(config.tls_certificate().private_key(), true)) {} | ||
|
||
const std::string SecretImpl::readDataSource(const envoy::api::v2::core::DataSource& source, |
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.
Just use Config::DataSource::read
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.
Done
source/common/secret/secret_impl.h
Outdated
public: | ||
SecretImpl(const envoy::api::v2::auth::Secret& config); | ||
|
||
virtual ~SecretImpl() {} |
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.
no need of this line
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.
Removed
source/common/secret/secret_impl.h
Outdated
private: | ||
const std::string readDataSource(const envoy::api::v2::core::DataSource& source, | ||
bool allow_empty); | ||
const std::string getDataSourcePath(const envoy::api::v2::core::DataSource& source); |
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.
Unused?
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.
Removed
include/envoy/secret/secret.h
Outdated
/** | ||
* @return a name of the SDS secret | ||
*/ | ||
virtual const std::string& getName() PURE; |
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.
make these getters as const method?
Also I would prefer not having get
prefix for those properties, so just name
, certificateChain
...
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.
Renamed
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.
still not const method. (i.e. virtual const std::string& name() const PURE;
)
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.
Done
} | ||
|
||
SecretSharedPtr SecretManagerImpl::getStaticSecret(const std::string& name) { | ||
return (static_secrets_.find(name) != static_secrets_.end()) ? static_secrets_[name] : nullptr; |
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.
You're looking up twice, prefer:
auto it = static_secrets_.find(name);
return it != static_secrets_.end() ? it->second : nullptr;
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.
Done
@@ -0,0 +1,30 @@ | |||
#pragma once | |||
|
|||
#include <shared_mutex> |
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.
unused
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.
Removed. It will be added later for dynamic secret support.
include/envoy/secret/secret.h
Outdated
|
||
typedef std::shared_ptr<Secret> SecretSharedPtr; | ||
|
||
typedef std::unordered_map<std::string, SecretSharedPtr> SecretSharedPtrMap; |
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.
The map and vector are not used in interfaces, so move them to impl.h?
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.
Moved,
@mangchiandjjoe Can you try merge master? |
FIrst pass done, @mattklein123 can you take a look? |
@mangchiandjjoe since we are going to have to fix DCO eventually, can you potentially just do it now before we start more reviews? Feel free to squash/rebase/force push. |
Signed-off-by: jae Kim <jaebong.kim@gmail.com>
Presumably #3465 replaces this so closing. |
Description:
Clusters and listeners read secrets from the static resources in the bootstrap configuration.
Reading secrets from the Secret Discovery Service will follow.
Risk Level: Low
Fixes #1194
Signed-off-by: Jae Kim jaebong.kim@gmail.com