-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Refactor dns cluster api #36353
base: main
Are you sure you want to change the base?
Refactor dns cluster api #36353
Conversation
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
072cab0
to
e1a1e5f
Compare
@markdroth @wbpcode Just wanted to check in that I'm going in the right direction |
a305ccc
to
928ef02
Compare
928ef02
to
2f5e253
Compare
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
2f5e253
to
9048a69
Compare
@markdroth I would also appreciate some guidance on what you expect for testing. |
Sorry can you provide some context on this? /wait |
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.
@mattklein123 For context, see #35479 (comment).
@Stevenjin8, I'm not the right person to ask about testing for the Envoy implementation, so I'll let one of the Envoy maintainers do that. My feedback here is just on the xDS API changes.
Please let me know if you have any questions. Thanks!
api/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto
Outdated
Show resolved
Hide resolved
@@ -944,6 +920,9 @@ message Cluster { | |||
// [#next-major-version: make this a list of typed extensions.] | |||
map<string, google.protobuf.Any> typed_extension_protocol_options = 36; | |||
|
|||
// [#extension-category: envoy.clusters.dns] | |||
envoy.extensions.clusters.dns.v3.DnsConfig dns_config = 59; |
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.
We don't need a new extension point here. The DNS cluster config should instead be loaded via the existing cluster_type
field:
CustomClusterType cluster_type = 38; |
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.
@markdroth Oh I see, so we are adding relevant DNS fields to the cluster config types of each cluster type. So I would add a api/envoy/extensions/clusters/strict_dns/v3/cluster.proto
file with the corresponding fields. and same for logical_dns, etc
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.
That would work. But it may also be the case that there's enough in common (config-wise and/or implementation-wise) between STRICT_DNS and LOGICAL_DNS that we can combine them into a single DNS cluster type, and the config for that DNS cluster type can have a field that says whether it uses STRICT or LOGICAL behavior.
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.
@markdroth wait... So would I add an extension point to the typed config. So the configuration would like
clusters:
- name: my_cluster
...
cluster_type:
name: envoy.clusters.strict_dns
typed_config:
"@type": type.googleapis.com/envoy.extensions.clusters.strict_dns.v3.ClusterConfig
dns_config:
dns_jitter: false
... the rest of the dns_* fields
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 new DNS cluster type should not use any of the existing dns_*
fields in the Cluster
message; those fields should all be copied into the new envoy.extensions.clusters.dns_cluster.v3.DnsCluster
message.
The existing dns_*
fields in the Cluster
message should be used only for backward-compatibility reasons, for existing Cluster
resources that use STRICT_DNS
or LOGICAL_DNS
and configure these existing fields. However, Envoy should internally convert such a config into the corresponding new-style config that uses the new envoy.extensions.clusters.dns_cluster.v3.DnsCluster
message.
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.
In the above example, I just worry that we are forcing both strict and logical dns to share the same typed_cofig
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.
Oh I messed up the indentation in the first example. Sorry! I meant
clusters:
- name: my_cluster
...
cluster_type:
name: envoy.clusters.strict_dns
typed_config:
"@type": type.googleapis.com/envoy.extensions.clusters.strict_dns.v3.ClusterConfig
dns_config:
dns_jitter: false
... the rest of the dns_* fields
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.
In the above example, I just worry that we are forcing both strict and logical dns to share the same typed_cofig
Why would that a problem, as long as there's still a way to configure the behavior for each? My suspicion is that if we had separate config messages for STRICT_DNS and LOGICAL_DNS, then both messages would have almost identical sets of fields. If that's the case, then the duplication doesn't really make sense, which is why I suggested having a single message that can be used for both with a knob that controls which behavior is used.
The type present in the type_url
field dictates which cluster implementation gets used, so if we have two different implementations for STRICT_DNS and LOGICAL_DNS, then we would need probably-identical config messages, like this:
message StrictDnsCluster {
// ...a bunch of DNS fields...
}
message LogicalDnsCluster {
// ...exactly the same set of DNS fields...
}
In contrast, if we have a single cluster implementation for both DNS types with a knob to control the behavior, we can have a single config proto, like this:
message DnsCluster {
// if true, STRICT_DNS semantics; otherwise, LOGICAL_DNS semantics
// (could also be an enum or whatever)
bool strict = N;
// ...the set of DNS fields...
}
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.
@markdroth I agree that most fields are Dns-related and would thus be duplicated, but I was thinking something along the lines of
message DnsConfig {
// ... DNS fields
}
message StrictDnsCluster {
DnsConfig dns_config = N
}
message LogicalDnsCluster {
DnsConfig dns_config = N
}
This way we don't have duplicate code and
- In the future, if we want to add a logical dns-specific field, it won't appear in the strict dns configuration (same for strict dns).
- It follows the general pattern (AFAIK) of each cluster type having its own config type. We see this pattern for filters too.
Let me know what you think. I'm still new to envoy so if you feel that having a shared config type is the way to go, I'm happy to implement it.
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.
My inclination is that we're unlikely to have too many fields that are specific to either STRICT_DNS or LOGICAL_DNS, so combining them makes the most sense. But I'd be open to input from @wbpcode or other Envoy maintainers.
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
CC @envoyproxy/runtime-guard-changes: FYI only for changes made to |
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
* Also tests for strict dns Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
8543549
to
fd255d0
Compare
Sorry everybody I messed up my git history |
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
@markdroth I think I'm ready for another review. I'm hoping CI is passing now. |
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
/help |
/retest |
/assign @Stevenjin8 |
dns_cluster.mutable_dns_refresh_rate()->CopyFrom(cluster.dns_refresh_rate()); | ||
} | ||
|
||
// FIXME: tests 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.
delete this
TODO:
Commit Message: Refactor DNS cluster configuration in its own extension
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]