From 80abea8109fdd10ae4d3e149a8a740c3b4c40e91 Mon Sep 17 00:00:00 2001 From: lpirvanescu Date: Sat, 6 Sep 2025 22:47:36 +0300 Subject: [PATCH] fix: SSH provisioning for existing node pools when AppendRKEProvisionUserData is false - Always add SSH user configuration to cloud-init when RKE provisioning is involved - Ensures proper SSH access for both new and existing node pools - Fixes issue where existing node pools failed deployment when AppendRKEProvisionUserData flag was false - Updated tests to reflect new expected behavior - Updated changelog for version 7.0.9 --- docs/changelog.md | 6 ++++++ ionos_create_machine.go | 5 ++++- ionos_create_machine_test.go | 24 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index dad234a..0674e36 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,11 @@ # Changelog +## \[7.0.9] +### Fixed +* Fixes: + * Fixed SSH provisioning issue for existing node pools when `AppendRKEProvisionUserData` is false + * SSH user configuration is now always added to cloud-init when RKE provisioning is involved, ensuring proper SSH access for both new and existing node pools + ## \[7.0.8] ### Fixed * Fixes: diff --git a/ionos_create_machine.go b/ionos_create_machine.go index 6b63aa8..b6a9dbf 100644 --- a/ionos_create_machine.go +++ b/ionos_create_machine.go @@ -89,7 +89,10 @@ func (d *Driver) GetFinalUserData() (userdata string, err error) { d.CloudInit = ud } - if d.SSHUser != "root" || d.SSHInCloudInit { + // Always add SSH user configuration when RKE provisioning is involved + // This ensures SSH access works for both new and existing node pools + needsSSHUser := d.SSHUser != "root" || d.SSHInCloudInit || d.RKEProvisionUserData != "" + if needsSSHUser { d.CloudInit, err = d.addSSHUserToYaml() if err != nil { return "", err diff --git a/ionos_create_machine_test.go b/ionos_create_machine_test.go index b5a4115..5176ac2 100644 --- a/ionos_create_machine_test.go +++ b/ionos_create_machine_test.go @@ -60,6 +60,14 @@ packages: runcmd: - sh user_script.sh - sh /etc/rke.sh +users: + - create_groups: false + lock_passwd: true + name: root + no_user_group: true + ssh_authorized_keys: + - "" + sudo: ALL=(ALL) NOPASSWD:ALL write_files: - content: some user content path: /etc/user_script.sh @@ -106,6 +114,14 @@ write_files: hostname: test-host runcmd: - sh /etc/rke.sh +users: + - create_groups: false + lock_passwd: true + name: root + no_user_group: true + ssh_authorized_keys: + - "" + sudo: ALL=(ALL) NOPASSWD:ALL write_files: - content: some install content path: /etc/rke.sh @@ -150,6 +166,14 @@ packages: - somepackage runcmd: - sh user_script.sh +users: + - create_groups: false + lock_passwd: true + name: root + no_user_group: true + ssh_authorized_keys: + - "" + sudo: ALL=(ALL) NOPASSWD:ALL write_files: - content: some user content path: /etc/user_script.sh