Skip to content

Conversation

@Gufran
Copy link
Contributor

@Gufran Gufran commented Jan 6, 2026

closes #478

@koct9i koct9i merged commit a751ed9 into ytsaurus:main Jan 8, 2026
12 of 13 checks passed
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 setting the @cluster_name attribute in the init job during YTsaurus cluster initialization. The change refactors how cluster connection configuration is obtained and adds a new command to explicitly set the cluster name.

  • Refactored to use GetClusterConnection() directly instead of GetClusterConnectionConfig() to access both the marshaled config and the cluster name field
  • Added a new init command that sets //sys/@cluster_name to the value from clusterConn.ClusterName

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

"/usr/bin/yt create map_node //home --ignore-existing",
RunIfExists("//sys/@provision_lock", fmt.Sprintf("/usr/bin/yt set //sys/@cluster_connection '%s'", string(clusterConnection))),
RunIfExists("//sys/@provision_lock", fmt.Sprintf("/usr/bin/yt set //sys/@cluster_connection '%s'", string(connConfig))),
RunIfExists("//sys/@provision_lock", fmt.Sprintf("/usr/bin/yt set //sys/@cluster_name '%s'", clusterConn.ClusterName)),
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The cluster name is directly interpolated into the shell command without proper escaping. If the cluster name contains special characters like single quotes, this could break the command or potentially lead to command injection. Consider using proper shell escaping or validating that the cluster name doesn't contain problematic characters.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Set //sys/@cluster_name in init jobs

2 participants