-
Notifications
You must be signed in to change notification settings - Fork 337
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
Automatically convert JSON patch paths in MeshProxyPatch
es from snake_case
to camelCase
#8510
Comments
I did some debugging, it is caused by not setting OrigName to true https://github.com/kumahq/kuma/blob/master/pkg/util/proto/proto.go#L44
Envoy's I think this issue might not be the case if we agree that what shows UI is a source of truth, but if we decide that we should stick to the same format as Envoy(which would be the best for cross docs reading) then we need to rewrite a lot of things and we need to keep backward compatibility for old patches in JSON format |
|
This because of the sanitization: kuma/pkg/envoy/admin/client.go Lines 145 to 161 in 6233521
How about we retrieve the tokens that needs to be redacted in the first step and then redacted from the raw payload? This would avoid the reserialization. |
We are sanitizing |
What I mean is something like: configDump, err := a.executeRequest(ctx, proxy, "config_dump")
if err != nil {
return nil, err
}
toReplace := []string{}
cd := &envoy_admin_v3.ConfigDump{}
if err := util_proto.FromJSON(configDump, cd); err != nil {
return nil, err
}
// Retrieve strings that need to be sanitized
for _, config := range configDump.Configs {
if config.MessageIs(&envoy_admin_v3.BootstrapConfigDump{}) {
bootstrapConfigDump := &envoy_admin_v3.BootstrapConfigDump{}
if err := config.UnmarshalTo(bootstrapConfigDump); err != nil {
return err
}
for _, grpcService := range bootstrapConfigDump.GetBootstrap().GetDynamicResources().GetAdsConfig().GetGrpcServices() {
for i, initMeta := range grpcService.InitialMetadata {
if initMeta.Key == "authorization" {
toReplace = append(toReplace, grpcService.InitialMetadata[i].Value, "[redacted]")
}
}
}
for _, grpcService := range bootstrapConfigDump.GetBootstrap().GetHdsConfig().GetGrpcServices() {
for i, initMeta := range grpcService.InitialMetadata {
if initMeta.Key == "authorization" {
toReplace = append(toReplace, grpcService.InitialMetadata[i].Value, "[redacted]")
}
}
}
}
}
return strings.NewReplacer(toReplace).Replace(configDump) It seems to also avoid multiple occurences of serialization which likely makes this quicker too :) WDYT? |
Description
Currently, Envoy's config dump presents paths in
snake_case
format, while JSON patches inMeshProxyPatch
requirecamelCase
format. Instead of documenting this discrepancy, we can implement logic to automatically convert paths fromsnake_case
tocamelCase
when encountered. This approach would eliminate the need for users to manually convert paths, improving the overall usability of the system.xref. kumahq/kuma-website#1539
The text was updated successfully, but these errors were encountered: