-
Notifications
You must be signed in to change notification settings - Fork 7.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
fix filter and virtual host patch removal #36404
fix filter and virtual host patch removal #36404
Conversation
ramaraochavali
commented
Dec 7, 2021
•
edited
Loading
edited
- Configuration Infrastructure
- Docs
- Installation
- Networking
- Performance and Scalability
- Policies and Telemetry
- Security
- Test and Release
- User Experience
- Developer Infrastructure
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
can you add some tests, since i can see the previous remove handling seems ok
|
Will add tests then we can review |
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.
seems good but can we have a test?
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.
VHOST remove is broken as well:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: connect-match
namespace: default
spec:
configPatches:
- applyTo: VIRTUAL_HOST
match:
context: SIDECAR_OUTBOUND
routeConfiguration:
vhost:
name: allow_any
patch:
operation: REMOVE
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
Listener patch removal seems to be working fine. So just added a test |
@howardjohn VHOST remove is broken as well - It may be because we are catching the catchAllVirtualHost? Or are you thinking it is because of some other problem? |
No I had the same issue I think? With empty name. But maybe also related to vhost cache. But if we remove it should not be a problem for the cache/ |
Ok. Let me try that Envoy filter and see what is going on. |
@@ -524,7 +528,7 @@ func patchHTTPFilters(patchContext networking.EnvoyFilter_PatchContext, | |||
func patchHTTPFilter(patchContext networking.EnvoyFilter_PatchContext, | |||
patches map[networking.EnvoyFilter_ApplyTo][]*model.EnvoyFilterConfigPatchWrapper, | |||
listener *xdslistener.Listener, fc *xdslistener.FilterChain, filter *xdslistener.Filter, | |||
httpFilter *hcm.HttpFilter, httpFilterRemoved *bool) { | |||
httpFilter *hcm.HttpFilter) bool { |
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.
Better document the meaning of return value
I was able to reproduce virtual host removal issue in our environment. But not able to do it via unit test. It works correctly. I will continue to spend some time to reproduce it via unit test. |
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@howardjohn @hzxuzhonghu Fixed the issue for vhost and listeners. Added test for vhost - with out this change, the last test case in |
/test unit-tests_istio |
@@ -506,11 +506,11 @@ func patchHTTPFilters(patchContext networking.EnvoyFilter_PatchContext, | |||
} | |||
IncrementEnvoyFilterMetric(lp.Key(), HttpFilter, applied) | |||
} | |||
if httpFiltersRemoved { | |||
if len(removedFilters) > 0 { | |||
tempArray := make([]*hcm.HttpFilter, 0, len(httpconn.HttpFilters)) |
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.
nit: len(httpconn.HttpFilters)-len(removedFilters)