Skip to content

[MM-61277] Allow selecting between private and public connection types #881

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

Merged
merged 20 commits into from
Feb 13, 2025

Conversation

fmartingr
Copy link
Contributor

Summary

Adds a new ConnectionType deployer configuration option to allow the user to choose between using public/private IPs and DNS. This is necessary when a load test is deployed under private subnets.

Ticket Link

https://mattermost.atlassian.net/browse/MM-61277

@fmartingr
Copy link
Contributor Author

@agnivade @agarciamontoro Can you guys take a look at this and let me know if the approach makes sense?

@agarciamontoro agarciamontoro self-requested a review January 21, 2025 16:53
@agarciamontoro
Copy link
Member

Self-requested a review so I don't forget!

Comment on lines +90 to +93
PrivateIP string `json:"private_ip"`
PublicIP string `json:"public_ip"`
PublicDNS string `json:"public_dns"`
PrivateDNS string `json:"private_dns"`
Copy link
Member

Choose a reason for hiding this comment

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

Let's make these private fields to prevent mistakes of accessing them in the future.

Copy link
Member

Choose a reason for hiding this comment

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

I realized that making these fields private would stop JSON unmarshal. In that case, I'd suggest to have a separate struct to unmarshal InstanceToParse and then create a new Instance by calling the Set methods.

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 don't think this is necessary, there may be situations where we want to use the private or public ips directly. For example for intra-server communication we favor Private IPs over Public ones. One example is on the proxy IP in the getServerURL method. I'm currently reviewing usages and making sure I'm not breaking the services. Will re-request review once done and we can discuss in there, there is some tooling that I don't know how it would behave with this change.

Copy link
Member

Choose a reason for hiding this comment

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

For example for intra-server communication we favor Private IPs over Public ones. One example is on the proxy IP in the getServerURL method. I'm currently reviewing usages and making sure I'm not breaking the services.

Ok, this is tricky. I'd prefer to have clear APIs that cannot be misused.

Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

Thanks for this! The approach makes sense to me. Left a couple of comments below.

@fmartingr fmartingr marked this pull request as ready for review January 27, 2025 15:10
Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

Looks good to me now! Just a few nits below and a typo. I haven't tested this, but if you want me to, I can give it a try before merging.

@fmartingr
Copy link
Contributor Author

Looks good to me now! Just a few nits below and a typo. I haven't tested this, but if you want me to, I can give it a try before merging.

Hey, I made two small tests myself, but if you want to check it out just in case I missed something I'm not stopping you. The more 👀 the better.

Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

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

Given that we still have the fields exposed, and needed in cases for private communication, I am still a bit concerned that this highly increases the chances of a mistake happening in the future.

Anything we can do to prevent the user making this mistake, or atleast guide them in the right direction?

@fmartingr
Copy link
Contributor Author

Given that we still have the fields exposed, and needed in cases for private communication, I am still a bit concerned that this highly increases the chances of a mistake happening in the future.

Anything we can do to prevent the user making this mistake, or atleast guide them in the right direction?

By that you mean adding a few docstrings to Instance or some change in the code?

@agnivade
Copy link
Member

agnivade commented Feb 6, 2025

I was thinking of some changes in the code. But if adding docs is the best we can do, then let's do that atleast.

@fmartingr
Copy link
Contributor Author

I was thinking of some changes in the code. But if adding docs is the best we can do, then let's do that atleast.

Don't know how to properly solve that at the moment and I don't want this PR to become bigger, added some comments, please check them out: 2ba1e8f

We can discuss further modifications for this on a follow up effort.

@agarciamontoro
Copy link
Member

Tested this using private first, then re-running deployment create after having changed it to public and all looks good to me! Thanks, @fmartingr :)

Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

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

Looks good. Sorry this took longer than usual. I fear that the tool is becoming too hard to maintain because of the need to support so many options.

@fmartingr fmartingr self-assigned this Feb 13, 2025
@fmartingr fmartingr merged commit cae104d into master Feb 13, 2025
1 check passed
@fmartingr fmartingr deleted the feat/allow-choosing-private-ip-dns branch February 13, 2025 06:10
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.

3 participants