Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

config/meshConfig: New localProxyMode field #4686

Merged

Conversation

keithmattix
Copy link
Contributor

Add new spec.sidecar.localProxyMode field for user to
control how mesh traffic gets proxied

Signed-off-by: Keith Mattix II keithmattix2@gmail.com

Description:
Part of the fix for #4653

Testing done:

Affected area:

Functional Area
New Functionality [X]
CI System [ ]
CLI Tool [ ]
Certificate Management [ ]
Control Plane [ ]
Demo [ ]
Documentation [ ]
Egress [ ]
Ingress [ ]
Install [ ]
Networking [ ]
Observability [ ]
Performance [ ]
SMI Policy [ ]
Security [ ]
Sidecar Injection [ ]
Tests [ ]
Upgrade [ ]
Other [ ]

Please answer the following questions with yes/no.

  1. Does this change contain code from or inspired by another project? no

    • Did you notify the maintainers and provide attribution? no
  2. Is this a breaking change? no

  3. Has documentation corresponding to this change been updated in the osm-docs repo (if applicable)?

Add new `spec.sidecar.localProxyMode` field for user to
control how mesh traffic gets proxied

Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
case configv1alpha2.LocalProxyModeLocalhost, configv1alpha2.LocalProxyModePodIP:
return proxyConfig
default:
// unrecognized proxy mode; return the default: ProxyModeLocalhost
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the API rejects any other value up front anyway and the default is defined in the CRD, I have a feeling enforcing the default again here isn't worth it since any other theoretical implementation of this interface (including the mock used in tests) would presumably need to do the same thing which may not be obvious. Then we wouldn't necessarily need to add this method to the interface and GetMeshConfig().Spec.Sidecar.LocalProxyMode could be used directly instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just followed the approach envoyLogLevel did. I added the function GetLocalProxyMode because it allows us to explicitly define this behavior on the Configurator interface, rather than an implementation detail of MeshConfig. You're right though, at the moment, it's not likely this codepath gets hit

@keithmattix keithmattix requested a review from nojnhuh April 25, 2022 19:58
@steeling
Copy link
Contributor

Do we want this to be a mesh-wide option? Are there situations where a user might want to use a mix (particularly if they use other OSS services outside of their control)?

Would it make more sense for this to be a pod annotation?

@keithmattix
Copy link
Contributor Author

@steeling I think a mesh-wide approach is best for a few reasons:

  1. It's simplest
  2. Making teams choose mesh-wide lowers the possibility of customers wanting us to support the old way when...
  3. ...we're eventually going to deprecate localhost proxy mode.

charts/osm/values.schema.json Outdated Show resolved Hide resolved
pkg/configurator/methods.go Outdated Show resolved Hide resolved
Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #4686 (e96b690) into main (bc3ff99) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #4686      +/-   ##
==========================================
- Coverage   69.44%   69.44%   -0.01%     
==========================================
  Files         217      217              
  Lines       15287    15419     +132     
==========================================
+ Hits        10616    10707      +91     
- Misses       4621     4662      +41     
  Partials       50       50              
Flag Coverage Δ
unittests 69.44% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/utils/proto.go 36.00% <0.00%> (-24.00%) ⬇️
pkg/injector/webhook.go 88.37% <0.00%> (-0.04%) ⬇️
pkg/k8s/client.go 93.09% <0.00%> (ø)
pkg/injector/volumes.go 100.00% <0.00%> (ø)
pkg/injector/envoy_config.go 71.79% <0.00%> (+0.07%) ⬆️
pkg/cli/verifier/envoy_config.go 65.97% <0.00%> (+1.54%) ⬆️
pkg/injector/patch.go 75.95% <0.00%> (+2.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc3ff99...e96b690. Read the comment docs.

Copy link
Contributor

@jaellio jaellio left a comment

Choose a reason for hiding this comment

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

Leaving a note as a reminder to update the Mesh Configuration doc

@jaellio jaellio merged commit 86690a3 into openservicemesh:main Apr 27, 2022
@keithmattix keithmattix deleted the feature/add-localProxyMode-field branch April 27, 2022 17:10
keithmattix added a commit to keithmattix/osm that referenced this pull request May 3, 2022
Add new `spec.sidecar.localProxyMode` field for user to
control how mesh traffic gets proxied

Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants