Skip to content
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 eds cluster loadassignment with invalid endpoint #50690

Merged

Conversation

hzxuzhonghu
Copy link
Member

@hzxuzhonghu hzxuzhonghu commented Apr 26, 2024

Please provide a description of this PR:

Fix #50688

@hzxuzhonghu hzxuzhonghu requested a review from a team as a code owner April 26, 2024 08:00
@istio-testing istio-testing added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 26, 2024
@zirain zirain added cherrypick/release-1.20 Set this label on a PR to auto-merge it to the release-1.20 branch cherrypick/release-1.21 Set this label on a PR to auto-merge it to the release-1.21 branch cherrypick/release-1.22 Set this label on a PR to auto-merge it to the release-1.22 branch labels Apr 26, 2024
@@ -335,6 +335,10 @@ func (b *EndpointBuilder) BuildClusterLoadAssignment(endpointIndex *model.Endpoi
if svcPort.Name != ep.ServicePortName {
return false
}
// filter out endpoint that has invalid ip address, mostly domain name. Because this is generated from ServiceEntry.
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this a regression?

Copy link
Member Author

Choose a reason for hiding this comment

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

From the issue, it is

Copy link
Contributor

Choose a reason for hiding this comment

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

curious which commit?

Copy link
Member

Choose a reason for hiding this comment

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

start from 1.20.0, maybe 1.19

Copy link
Member Author

Choose a reason for hiding this comment

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

TBH i am not sure. It was since 1.18+? @zirain

Copy link
Member

Choose a reason for hiding this comment

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

I'm sure it's fine in 1.18, and broken since 1.20.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to confirm the regression so we know this is the correct fix

Copy link
Contributor

Choose a reason for hiding this comment

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

+1. It would be good identify what commit caused this so that we can know what happened

Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

This one LGTM but I would love a high level reproduction test... maybe in sidecar_simulation_test.go?

// There are other two cases that should not be filtered out:
// 1. ep.Address can be empty since https://github.com/istio/istio/pull/45150, in this case we will replace it with gateway ip.
// 2. ep.Address can be uds when EndpointPort = 0
if ep.Address != "" && ep.EndpointPort != 0 && net.ParseIP(ep.Address) == nil {
Copy link
Member

Choose a reason for hiding this comment

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

nit: we have IsValidIPAddress function already

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@hzxuzhonghu
Copy link
Member Author

There is cases covering in pilot/pkg/xds/endpoints/ep_filters_test.go

And also both for UDS and empty address, which is actually found via CI failiure

@istio-testing istio-testing merged commit 067d2ec into istio:master Apr 28, 2024
28 checks passed
@istio-testing
Copy link
Collaborator

In response to a cherrypick label: #50690 failed to apply on top of branch "release-1.20":

Applying: fix eds cluster has invalid endpoints
Using index info to reconstruct a base tree...
M	pilot/pkg/xds/endpoints/endpoint_builder.go
Falling back to patching base and 3-way merge...
Auto-merging pilot/pkg/xds/endpoints/endpoint_builder.go
CONFLICT (content): Merge conflict in pilot/pkg/xds/endpoints/endpoint_builder.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix eds cluster has invalid endpoints
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

@istio-testing
Copy link
Collaborator

In response to a cherrypick label: new issue created for failed cherrypick: #50717

@istio-testing
Copy link
Collaborator

In response to a cherrypick label: #50690 failed to apply on top of branch "release-1.21":

Applying: fix eds cluster has invalid endpoints
Using index info to reconstruct a base tree...
M	pilot/pkg/xds/endpoints/endpoint_builder.go
Falling back to patching base and 3-way merge...
Auto-merging pilot/pkg/xds/endpoints/endpoint_builder.go
CONFLICT (content): Merge conflict in pilot/pkg/xds/endpoints/endpoint_builder.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix eds cluster has invalid endpoints
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

@istio-testing
Copy link
Collaborator

In response to a cherrypick label: new issue created for failed cherrypick: #50718

@istio-testing
Copy link
Collaborator

In response to a cherrypick label: new pull request created: #50719

zirain pushed a commit to zirain/istio that referenced this pull request Apr 28, 2024
* fix eds cluster has invalid endpoints

* Add release note

* Fix specical case ep address empty

* add uds addr check

* use IsValidIP
zirain pushed a commit to zirain/istio that referenced this pull request Apr 28, 2024
* fix eds cluster has invalid endpoints

* Add release note

* Fix specical case ep address empty

* add uds addr check

* use IsValidIP
zirain pushed a commit to zirain/istio that referenced this pull request Apr 28, 2024
* fix eds cluster has invalid endpoints

* Add release note

* Fix specical case ep address empty

* add uds addr check

* use IsValidIP
zirain pushed a commit to zirain/istio that referenced this pull request Apr 28, 2024
* fix eds cluster has invalid endpoints

* Add release note

* Fix specical case ep address empty

* add uds addr check

* use IsValidIP
@hzxuzhonghu hzxuzhonghu deleted the fix-eds-cluster-loadassignment branch April 28, 2024 03:17
istio-testing pushed a commit that referenced this pull request Apr 28, 2024
…50721)

* move port name and labels check outside of filterIstioEndpoint (#49629)

* move port name and labels check outside of filterIstioEndpoint

* fix slices filter

* fix ut

* Fix eds cluster loadassignment with invalid endpoint (#50690)

* fix eds cluster has invalid endpoints

* Add release note

* Fix specical case ep address empty

* add uds addr check

* use IsValidIP

---------

Co-authored-by: Zhonghu Xu <xuzhonghu@huawei.com>
istio-testing pushed a commit that referenced this pull request Apr 29, 2024
…50720)

* move port name and labels check outside of filterIstioEndpoint (#49629)

* move port name and labels check outside of filterIstioEndpoint

* fix slices filter

* fix ut

* Fix eds cluster loadassignment with invalid endpoint (#50690)

* fix eds cluster has invalid endpoints

* Add release note

* Fix specical case ep address empty

* add uds addr check

* use IsValidIP

---------

Co-authored-by: Zhonghu Xu <xuzhonghu@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick/release-1.20 Set this label on a PR to auto-merge it to the release-1.20 branch cherrypick/release-1.21 Set this label on a PR to auto-merge it to the release-1.21 branch cherrypick/release-1.22 Set this label on a PR to auto-merge it to the release-1.22 branch size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ServiceEntry regression
6 participants