@@ -117,12 +117,16 @@ def _k3s_ready(time_wait: int = 300, delay: int = 10) -> bool:
117117 return False
118118
119119
120- def _run_installer (k3s_script_path : str , logs_file_path : str ):
120+ def _run_installer (k3s_script_path : str , logs_file_path : str , node_name : str | None = None ):
121121 """
122122 Run K3S installer by running downloaded script in 'k3s_script_path' and writing
123- execution logs to 'logs_dir'.
123+ execution logs to 'logs_dir'. node_name contains optional name of a node of k3s cluster
124124 """
125+ if node_name :
126+ k3s_configuration .node_name = node_name
125127 k3s_env_vars = k3s_configuration .to_env_var_dict ()
128+
129+ logger .info (f"envs for k3s installation: { k3s_env_vars } " )
126130 env = os .environ .copy ()
127131 env .update (k3s_env_vars )
128132
@@ -221,6 +225,7 @@ def _install_k3s_selinux_rpm() -> None:
221225def install_k3s ( # noqa: ANN201
222226 logs_file_path : str = K3S_INSTALL_LOG_FILE_PATH ,
223227 setup_remote_kubeconfig : bool = True ,
228+ node_name : str | None = None ,
224229):
225230 """
226231 Install K3S to current system. Write installation logs to 'logs_dir'. Use optionally 'external_address' to adjust
@@ -230,7 +235,7 @@ def install_k3s( # noqa: ANN201
230235 k3s_script_path = f"{ K3S_OFFLINE_INSTALLATION_FILES_PATH } /install.sh"
231236 _prepare_k3s_files_structure ()
232237 _install_k3s_selinux_rpm ()
233- _run_installer (k3s_script_path = k3s_script_path , logs_file_path = logs_file_path )
238+ _run_installer (k3s_script_path = k3s_script_path , logs_file_path = logs_file_path , node_name = node_name )
234239 _update_containerd_config (logs_file_path = logs_file_path )
235240 _mark_k3s_installation ()
236241 except subprocess .CalledProcessError as ex :
0 commit comments