Skip to content

sds: secret discovery service.#180

Merged
htuch merged 7 commits intoenvoyproxy:masterfrom
PiotrSikora:kds
Oct 3, 2017
Merged

sds: secret discovery service.#180
htuch merged 7 commits intoenvoyproxy:masterfrom
PiotrSikora:kds

Conversation

@PiotrSikora
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Comment thread api/bootstrap.proto
// to know how to speak to the management server. These cluster definitions
// may not use EDS (i.e. they should be static IP or DNS-based).
repeated Cluster clusters = 2;
repeated Secret secrets = 3;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@htuch Thoughts on placement of repeated fields?

message StaticResources {
  repeated Listener listeners = 1;
  repeated Cluster clusters = 2;
  repeated Secret secrets = 3;
}

message Secret {
  TlsCertificate tls_certificate = 1;
}

vs

message StaticResources {
  repeated Listener listeners = 1;
  repeated Cluster clusters = 2;
  Secret secrets = 3;
}

message Secret {
  repeated TlsCertificate tls_certificates = 1;
}

vs

message StaticResources {
  repeated Listener listeners = 1;
  repeated Cluster clusters = 2;
  repeated Secret secrets = 3;
}

message Secret {
  repeated TlsCertificate tls_certificates = 1;
}

Note that Secret will contain more than just TlsCertificate objects in the future.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Option 1 is cleaner, since when we have a DiscoveryResponse, it already is a repeated list of resources, with the caveat below about the recursive definition.

Comment thread api/tls_context.proto Outdated
// via KDS. When name is specified, but kds_config is empty, the certificate will be loaded
// from static resources [V2-API-DIFF].
string name = 6;
ConfigSource kds_config = 7;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's a recursive relation here, where a TlsCertificate can point to another one delivered by KDS and then the fetched Secret can point to another ConfigSource etc. Is the intention to support this kind of chaining? Could we instead use a flatter structure, based on oneof, to allow folks to say "this cert must be either on the filesystem, inline, or providing by KDS"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The intention was to be able to update inlined TLS certificates via KDS in order to rotate them, but there is indeed a KDS recursion when doing that... oneof would indeed be cleaner, but it wouldn't work with the mentioned use case... Good catch, let me think about it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is something similar here with not allowing the bootstrap clusters to be an EDS cluster. (It makes no sense to have the EDS cluster use EDS). We could potentially just block this in code like we do there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, looking at EDS, it has the same problem, so I'm not sure if it's worth diverging from it.

I don't have strong opinion here (but slight preference to keep it in line with EDS), so I'll leave it as-is, unless @htuch objects.

Comment thread api/kds.proto Outdated

import "google/api/annotations.proto";

service KeyDiscoveryService{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we just name this SecretDiscoveryService? We have SDS back now because we moved SDS -> EDS.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems reasonable, as long as we never require a ServiceDiscoverySecret ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with either... But it might be a bit confusing, considering that we just removed old SDS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To clarify - I need one or both of you to make a ruling on KDS vs SDS.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's do SDS.

Comment thread api/tls_context.proto Outdated
// via KDS. When name is specified, but kds_config is empty, the certificate will be loaded
// from static resources [V2-API-DIFF].
string name = 6;
ConfigSource kds_config = 7;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is something similar here with not allowing the bootstrap clusters to be an EDS cluster. (It makes no sense to have the EDS cluster use EDS). We could potentially just block this in code like we do there.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Comment thread api/base.proto Outdated
message AggregatedConfigSource {
}

message KdsSecretConfig {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note: this landed in base.proto and not in kds.proto, because there was a cycle between tls_context.proto and kds.proto.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora PiotrSikora changed the title [DO NOT MERGE] kds: key discovery service. sds: secret discovery service. Sep 28, 2017
Comment thread api/sds.proto Outdated
}

message Secret {
TlsCertificate tls_certificate = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we make this a oneof now since we might add other types of secrets in the future? Not sure if the caller would need to specify the type?

Also, doesn't this need to include name so that Envoy can match up the response secret with the requested secret?

Comment thread api/tls_context.proto Outdated
repeated DataSource signed_certificate_timestamp = 5;

// SDS configuration which allows to fetch and/or reload this TLS certificates.
SdsSecretConfig sds_secret_config = 6;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering if we can just take existing sites where we have TlsCertificate and make them a oneof with TlsCertificate as exists today and SdsSecretConfig? Not sure if the rules for wire compatibility allow this if we preserve the existing field numbering. Can you look into this and see if it's possible? If so, we could avoid this weirdness (or make use of oneof internally within TlsCertificate to at least make clear these are mutually exclusive).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, we can't, since there is no such thing as repeated oneof and existing code uses repeated TlsCertificate.

If we want to add oneof in order to enforce mutually exclusive behavior, then we would need to add something like this:

message TlsCertificateSource {
  oneof source {
    TlsCertificate tls_certificate = 1;
    SdsSecretConfig sds_secret_config = 2;
  }
}
repeated TlsCertificateSource tls_certificate_sources = 6;

and deprecate existing repeated TlsCertificate tls_certificates (or use it as a fallback).

Alternative and backward-compatible way of adding SDS would be to add repeated SdsSecretConfig sds_secret_config along existing repeated TlsCertificate tls_certificates to the CommonTlsContext message, since in theory there can be a mix of static and SDS-provided certificates anyway, but that's a bit less clean API than the oneof approach.

Thoughts?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with having two repeated fields, one for static and the other for dynamic resources. This is similar to what we do in bootstrap. I don't think anyone is relying on the TlsCertificate today that we know of, but there's folks who are building management servers around v2, so it might be bad form to break them given these APIs are nominally frozen, so the TlsCertificateSource option probably isn't optimal form that perspective.

Comment thread api/base.proto Outdated
message AggregatedConfigSource {
}

message SdsSecretConfig {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The EDS/RDS config protos live in rds.proto/eds.proto. Could we put this in sds.proto for consistency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Per previous comment, which disappeared during rebranding, it's added here, otherwise there is dependency cycle between sds.proto and tls_context.proto.

Perhaps we should pull tls_context.proto into sds.proto?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ping. Should I merge tls_context.proto into sds.proto or are you OK with leaving this in base.proto?

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

The other alternative would be to put SdsSecreteConfig in tls_context.proto to break the cycle. That seems less disruptive, but I'm good with it all being moved into sds.proto, there is precedent for grouping messages related to an xDS API in the service.proto they are most closely related to.

Comment thread api/tls_context.proto Outdated
repeated DataSource signed_certificate_timestamp = 5;

// SDS configuration which allows to fetch and/or reload this TLS certificates.
SdsSecretConfig sds_secret_config = 6;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with having two repeated fields, one for static and the other for dynamic resources. This is similar to what we do in bootstrap. I don't think anyone is relying on the TlsCertificate today that we know of, but there's folks who are building management servers around v2, so it might be bad form to break them given these APIs are nominally frozen, so the TlsCertificateSource option probably isn't optimal form that perspective.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM

@htuch htuch merged commit daec566 into envoyproxy:master Oct 3, 2017
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.

3 participants