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

generating ingress virtualservice to enable cross-cluster communication with passthrough gateway #324

Conversation

shriramsharma
Copy link
Collaborator

Checklist

🚨 Please review this repository's contribution guidelines.

  • I've read and agree to the project's contribution guidelines.
  • I'm requesting to pull a topic/feature/bugfix branch.
  • I checked that my code additions will pass code linting checks and unit tests.
  • I updated unit and integration tests (if applicable).
  • I'm ready to notify the team of this contribution.

Description

What does this change do and why?
This change would generate VS exported to ingress running in passthrough mode.

[Link to related ISSUE]

Thank you!

@codecov-commenter
Copy link

codecov-commenter commented Aug 15, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 69.17808% with 45 lines in your changes missing coverage. Please review.

Project coverage is 71.45%. Comparing base (747a58e) to head (91d212c).
Report is 3 commits behind head on master.

Files Patch % Lines
admiral/pkg/clusters/serviceentry.go 5.00% 16 Missing and 3 partials ⚠️
admiral/pkg/clusters/virtualservice_handler.go 87.71% 8 Missing and 6 partials ⚠️
admiral/pkg/controller/common/config.go 0.00% 12 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #324      +/-   ##
==========================================
- Coverage   71.49%   71.45%   -0.05%     
==========================================
  Files          65       65              
  Lines        8845     8990     +145     
==========================================
+ Hits         6324     6424     +100     
- Misses       2191     2227      +36     
- Partials      330      339       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -260,6 +262,17 @@ func modifyServiceEntryForNewServiceOrPod(
util.LogElapsedTimeSinceForModifySE(ctxLogger, "AdmiralCacheCreateServiceEntryForDeployment",
deploymentOrRolloutName, deploymentOrRolloutNS, rc.ClusterID, "", start)
modifySEerr = common.AppendError(modifySEerr, errCreateSE)

if common.IsVSBasedRoutingEnabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Coud we start introducing interface and decouple the interaction of service entry? This would help test units in isolation and not have integration style unit tests. we would be benefit from injecting mock implementations in the unit tests.

WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thats a valid point and it has been discussed several times in the past to refactor the modifySE code. Some parts of the code does employ interface driven mocking strategy but it is specifically lacking in this piece of code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Where are we adding the sni value in DestinationRules?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nirvanagit , with your fix in istio we would probably won't need to add that. So this implementation currently works with istio versions that contain your fix.
We could make it backwards compatible and I'll be doing that later in upcoming PRs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it.

So the plan is to keep the VirtualServices ready, and then test out by modifying Gateway to use PASSTHROUGH in a dev setup?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@nirvanagit Yes we did test changing the to passthrough and rolling back to auto_passthrough, it works without errors. Once the VS is in place

@shriramsharma shriramsharma force-pushed the generate-vs-cross-cluster-routing branch 3 times, most recently from 79c05fe to 3656a1c Compare August 18, 2024 18:45
admiral/pkg/clusters/serviceentry.go Show resolved Hide resolved
if fqdn == "" {
return "", fmt.Errorf("fqdn is empty")
}
return fmt.Sprintf("outbound_.80_._.%s", fqdn), nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

We already talked about making this port configurable.

}

vs := networkingV1Alpha3.VirtualService{
Hosts: []string{host},
Copy link
Collaborator

Choose a reason for hiding this comment

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

We spoke about this as well, the host needs to match the SNI host

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this is a bug in the istio implementation

@shriramsharma shriramsharma force-pushed the generate-vs-cross-cluster-routing branch 4 times, most recently from 8689a3c to 9d0ca04 Compare August 22, 2024 22:52
// We are using the SNI host in hosts field as they need to match
Hosts: []string{sniHost},
Gateways: gateways,
ExportTo: []string{"istio-system"},
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this be a constant ?

…on with passthrough gateway

Signed-off-by: Shriram Sharma <[email protected]>
Signed-off-by: Shriram Sharma <[email protected]>
Signed-off-by: Shriram Sharma <[email protected]>
Signed-off-by: Shriram Sharma <[email protected]>
Signed-off-by: Shriram Sharma <[email protected]>
Signed-off-by: Shriram Sharma <[email protected]>
@shriramsharma shriramsharma force-pushed the generate-vs-cross-cluster-routing branch from 5cc8608 to d4c9629 Compare August 23, 2024 20:56
Signed-off-by: Shriram Sharma <[email protected]>
@shriramsharma shriramsharma merged commit 2d8556d into istio-ecosystem:master Aug 26, 2024
3 checks passed
@shriramsharma shriramsharma deleted the generate-vs-cross-cluster-routing branch August 26, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants