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

refactor transport socket merge logic #36619

Merged
merged 4 commits into from
Dec 31, 2021

Conversation

ramaraochavali
Copy link
Contributor

@ramaraochavali ramaraochavali commented Dec 23, 2021

No functional change. Just refactors merge transport logic to simplify if conditions and also when the cluster does not have transport socket avoids proto.Merge call.

  • 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>
@ramaraochavali ramaraochavali requested a review from a team as a code owner December 23, 2021 08:23
@istio-policy-bot istio-policy-bot added area/networking release-notes-none Indicates a PR that does not require release notes. labels Dec 23, 2021
@istio-testing istio-testing added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 23, 2021
Comment on lines 93 to 97
// Now check if this matches if existing cluster's transport socket.
if c.GetTransportSocket() != nil {
if cpValueCast.GetTransportSocket().Name == c.GetTransportSocket().Name {
tsmPatch = c.GetTransportSocket()
}
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest, although in theory c.GetTransportSocket() != nil and ·len(c.GetTransportSocketMatches()) > 0 can not be true simultanously

if cpValueCast.GetTransportSocket() != nil {
    if len(c.GetTransportSocketMatches()) > 0 {
    } else if c.GetTransportSocket() != nil{
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Changed.

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 28, 2021
break
}
}
if tsmPatch == nil && len(c.GetTransportSocketMatches()) > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

len(c.GetTransportSocketMatches()) > 0 checked in L81

// There is a name mismatch, so we cannot do a deep merge. Instead just replace the transport socket
// This means either there is a name mismatch or cluster does not have transport socket matches/transport socket.
// We cannot do a deep merge. Instead just replace the transport socket
if tsmPatch == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this shoube under else if c.GetTransportSocket() != nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It really does not matter. But refactored a bit more to simplify further. PTAL.

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@istio-testing istio-testing added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 28, 2021
@istio-testing istio-testing merged commit 17ac63d into istio:master Dec 31, 2021
@ramaraochavali ramaraochavali deleted the fix/refactor_tls branch January 2, 2022 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking release-notes-none Indicates a PR that does not require release notes. 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.

5 participants