core & ios: implement typed configurations & template#328
Conversation
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
junr03
left a comment
There was a problem hiding this comment.
I have a general concern with this approach. Sorry I had not voiced it earlier, I was catching up to this.
If we structure the configuration in swift we are opening up the gates for having to do the same in every language we want to support. In addition we are creating a new API surface for envoy configuration. i.e the "Envoy Mobile" subset of Envoy configuration, and thus every time we need to support something new or deprecate a field we need to go and do so in every language we support.
The Network team at Lyft has struggled in the past with providing a subset API and it has come with several maintenance headaches.
What are your thoughts about maintenance of this typed configuration approach?
I outlined some of the concerns with a purely string-based approach in the linked issue, but to add some more color:
In summary: I think the reduced barrier to entry, ease of use, and simplicity of typed configurations far out-weighs the minimal maintenance cost this will incur. |
|
Thanks for that explanation. It goes to show my bias from the far more complex land of service mesh configurations. I think all the reasons listed above really assuage any immediate concerns I have with this approach :)
This specially makes me agree with the approach taken here. And reminds me that a very similar pattern is being used in cronet; with, as you say here, a very small configuration surface. |
|
I talked with @junr03 a bit about this offline. In general, while I think @junr03's concerns merit consideration, I tend to agree with @rebello95's points above. To summarize a couple of the things we discussed: I think the challenges the Network Team has faced are a bit beyond the scope of what we'll encounter here. The configuration of Lyft's mesh is far more complex than our default template configuration will ever have to be. The proto generation, serialization and deserialization that would be required to support the proto based approach is a fair amount of overhead, whereas string interpolation is cheap, and at least for a smaller set of configurable touch points, easy. Finally, I think we can avoid the risks of implementing across languages by having the templating be well-documented. If this ends up being a pain point, we can also consider migrating templating logic down into the common layer at some point down the road. |
Yep I think documenting this is very valuable, and we can also use upstream Envoy's comprehensive docs as a point of reference here too. I also think it's useful to allow consumers to instantiate Envoy Mobile instances using raw string files (which is maintained in this PR), for those who are interested in doing something ultra-customized. |
| @implementation EnvoyConfiguration | ||
|
|
||
| + (NSString *)templateString { | ||
| return [[NSString alloc] initWithUTF8String:config_template]; |
There was a problem hiding this comment.
nit: how about putting
static NSString * const kEnvoyTemplateString = [[NSString alloc] initWithUTF8String:config_template];
above the @implementation and then just returning that each time.
There was a problem hiding this comment.
Unfortunately this doesn't work since we hit the following error:
Initializer element is not a compile-time constant
There was a problem hiding this comment.
Ah, makes sense. Silly, since of course it is constant at compile-time, but I understand the limitations at this scope.
You could work around this by using #define instead of the extern'd const... but, let's not worry about it.
|
Implementation looks great; just a couple minor suggestions. |
Introduces a
Configurationtype which consumers will use to start instances ofEnvoy. This change allows us to:This PR:
.ccfile, exposed through the common layer all the way through to the platform layersConfigurationtype for accessing this configurationTests will be added in a separate PR that updates this interface further with a builder for
Envoyinstances.Resolves #169.
Related issue (why this is in C++ instead of a
yamlresource): #341Signed-off-by: Michael Rebello me@michaelrebello.com