-
-
Notifications
You must be signed in to change notification settings - Fork 506
fix: change private network interface and ssh connection timeout #1950
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
base: master
Are you sure you want to change the base?
fix: change private network interface and ssh connection timeout #1950
Conversation
Summary of ChangesHello @fabioluciano, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses two key areas to enhance the stability and correctness of host provisioning. It extends the SSH connection timeout to prevent premature failures during host initialization and updates the private network interface naming convention in cloud-init configurations to ensure proper network routing for private-only setups. These adjustments collectively contribute to more robust and reliable host deployments. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request addresses two issues: it increases the SSH connection timeout and changes the hardcoded private network interface name. While these changes likely fix immediate problems, they introduce new hardcoded values. My review suggests making both the SSH timeout and the network interface name configurable through variables. This will make the module more robust and flexible for different environments and use cases.
| %{if private_network_only~} | ||
| # Private-only setup: eth0 is the private interface | ||
| - [ip, route, add, default, via, '${network_gw_ipv4}', dev, 'eth0', metric, '100'] | ||
| - [ip, route, add, default, via, '${network_gw_ipv4}', dev, 'enp7s0', metric, '100'] |
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.
Hardcoding the network interface name to enp7s0 is brittle. Network interface names can vary across different operating systems or even kernel versions (e.g., eth0 vs. predictable network interface names like enp7s0). This change might fix the issue for one environment but break it for others. A more robust solution would be to make the interface name configurable via a template variable. Additionally, the comment on the preceding line (37) is now outdated and should be updated to avoid confusion.
| command = <<-EOT | ||
| timeout 600 bash <<EOF | ||
| until ssh ${local.ssh_args} -i /tmp/${random_string.identity_file.id} ${local.ssh_proxy_jump} -o ConnectTimeout=2 -p ${var.ssh_port} root@${coalesce(self.ipv4_address, self.ipv6_address, try(one(self.network).ip, null))} true 2> /dev/null | ||
| until ssh ${local.ssh_args} -i /tmp/${random_string.identity_file.id} ${local.ssh_proxy_jump} -o ConnectTimeout=10 -p ${var.ssh_port} root@${coalesce(self.ipv4_address, self.ipv6_address, try(one(self.network).ip, null))} true 2> /dev/null |
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.
The ConnectTimeout value is hardcoded to 10. While increasing the timeout from 2s is a good improvement, hardcoding the new value reduces the module's flexibility. It would be better to expose this as a variable (e.g., ssh_connect_timeout with a default of 10) so that users of the module can adjust it based on their specific network conditions and server startup times.
fixes #1949