Skip to content

ssh plugin: allow custom SSH port configuration#5047

Open
aadhil2k4 wants to merge 1 commit intovolcano-sh:masterfrom
aadhil2k4:issue_2492
Open

ssh plugin: allow custom SSH port configuration#5047
aadhil2k4 wants to merge 1 commit intovolcano-sh:masterfrom
aadhil2k4:issue_2492

Conversation

@aadhil2k4
Copy link

What type of PR is this?

Feature

What this PR does / why we need it:

This PR adds support for configuring a custom SSH port in the SSH plugin via the --ssh-port flag.
This is useful when host networking is used and port 22 is pre occupied, allowing jobs to use a non standard SSH port.

Which issue(s) this PR fixes:

Fixes #2492

Special notes for your reviewer:

Does this PR introduce a user-facing change?

SSH plugin now supports a custom SSH port via the `--ssh-port` flag.

Copilot AI review requested due to automatic review settings February 16, 2026 18:32
@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign k82cn for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot
Copy link
Contributor

Welcome @aadhil2k4! It looks like this is your first PR to volcano-sh/volcano 🎉

@gemini-code-assist
Copy link

Summary of Changes

Hello @aadhil2k4, 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 enhances the SSH plugin by enabling the configuration of a custom SSH port. This change provides crucial flexibility for users whose environments, especially those utilizing host networking, may have port 22 already in use. By allowing a non-standard port, the plugin ensures broader compatibility and smoother operation for SSH-dependent jobs.

Highlights

  • Custom SSH Port Configuration: Introduced a new --ssh-port flag to allow users to specify a custom SSH port for the SSH plugin, moving beyond the default port 22.
  • Enhanced Flexibility: This feature addresses scenarios where port 22 might be pre-occupied, particularly in host networking setups, providing greater flexibility for job execution.
  • Codebase Updates: Modified the SSH plugin's core logic to incorporate the custom port into SSH configuration generation, affecting both user-provided and auto-generated RSA keys.
  • Documentation and Testing: Updated user documentation to reflect the new ssh-port parameter and added comprehensive unit tests to validate its functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docs/user-guide/how_to_use_ssh_plugin.md
    • Added ssh-port as a new configurable parameter in the SSH plugin documentation table.
    • Included a note explaining the utility of the custom SSH port.
    • Updated example SSH configuration snippets to explicitly include the Port directive.
  • pkg/controllers/job/plugins/ssh/ssh.go
    • Added sshPort field to the sshPlugin struct to store the custom port.
    • Initialized sshPort to the default value of 22 in the New function.
    • Modified generateRsaKey and withUserProvidedRsaKey functions to accept and utilize the port parameter when generating SSH configurations.
    • Introduced a new command-line flag --ssh-port for configuring the custom SSH port.
    • Updated generateSSHConfig to include the specified port in the generated SSH client configuration.
  • pkg/controllers/job/plugins/ssh/ssh_test.go
    • Extended the test case struct to include the sshPort field.
    • Updated existing test cases to assert the default sshPort value.
    • Added a new test case specifically for validating the custom SSH port functionality.
Activity
  • No human activity (comments, reviews) was detected on this pull request.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@volcano-sh-bot volcano-sh-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 16, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a 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 introduces a new feature to allow configuring a custom SSH port via the --ssh-port flag, which is useful in environments where the default port 22 is already in use. The changes include updating the documentation, adding the new flag, and modifying the SSH config generation logic. The implementation is mostly correct, but I found a bug where the custom port is not applied when SSH keys are auto-generated. I've left a specific comment with a suggested fix for this issue.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for configuring a custom SSH port in the SSH plugin via the --ssh-port flag, addressing the need for non-standard SSH ports when port 22 is already in use (e.g., when using host networking).

Changes:

  • Added sshPort field to the SSH plugin structure with a default value of 22
  • Modified generateRsaKey and withUserProvidedRsaKey functions to accept a port parameter
  • Updated generateSSHConfig to include the port configuration in the SSH config output
  • Added test coverage for the custom SSH port flag parsing
  • Updated documentation to describe the new --ssh-port flag

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
pkg/controllers/job/plugins/ssh/ssh.go Adds sshPort field, flag parsing, and passes port to key generation functions
pkg/controllers/job/plugins/ssh/ssh_test.go Adds test case to verify custom port flag parsing
docs/user-guide/how_to_use_ssh_plugin.md Documents the new ssh-port parameter and updates example config output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aadhil2k4
Copy link
Author

@hwdef @Thor-wl This issue has been open for a while and a PR is open but unresponsive for months. So, I thought to take up this issue. I hope it's ok?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@hajnalmt hajnalmt left a comment

Choose a reason for hiding this comment

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

Hello @aadhil2k4,
Thank you for the contribution overall looks good, please fix copilot's suggestion they are needed and we can merge it 👍!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Adds support for custom SSH port via `--ssh-port` flag. Default port remains 22.
Validates the port range and falls back to the default when an invalid port is provided.

Signed-off-by: Aadhil Ahamed <aadhil2k4@gmail.com>
@aadhil2k4
Copy link
Author

@hajnalmt I have made the changes.

@aadhil2k4 aadhil2k4 requested a review from hajnalmt February 18, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow customisation of SSH port

3 participants