diff --git a/exp/etcdrestore/webhooks/rke2config.go b/exp/etcdrestore/webhooks/rke2config.go index 24b8ebc6..5797f498 100644 --- a/exp/etcdrestore/webhooks/rke2config.go +++ b/exp/etcdrestore/webhooks/rke2config.go @@ -500,7 +500,7 @@ preserveWorkDirectory: true`, // addPostInstallCommands adds the post install command to the RKE2Config. func (r *RKE2ConfigWebhook) AddPostInstallCommands(rke2Config *bootstrapv1.RKE2Config) { - postInstallCommand := "sudo sh /opt/system-agent-install.sh" + postInstallCommand := "sh /opt/system-agent-install.sh" for _, cmd := range rke2Config.Spec.PostRKE2Commands { if cmd == postInstallCommand { diff --git a/exp/etcdrestore/webhooks/rke2config_test.go b/exp/etcdrestore/webhooks/rke2config_test.go index 13dde340..9be6766b 100644 --- a/exp/etcdrestore/webhooks/rke2config_test.go +++ b/exp/etcdrestore/webhooks/rke2config_test.go @@ -259,11 +259,11 @@ preserveWorkDirectory: true`, It("Should add post-install command when it's not present", func() { r.AddPostInstallCommands(rke2Config) - Expect(rke2Config.Spec.PostRKE2Commands).To(ContainElement("sudo sh /opt/system-agent-install.sh")) + Expect(rke2Config.Spec.PostRKE2Commands).To(ContainElement("sh /opt/system-agent-install.sh")) }) It("Should not add post-install command when it's already present", func() { - rke2Config.Spec.PostRKE2Commands = append(rke2Config.Spec.PostRKE2Commands, "sudo sh /opt/system-agent-install.sh") + rke2Config.Spec.PostRKE2Commands = append(rke2Config.Spec.PostRKE2Commands, "sh /opt/system-agent-install.sh") r.AddPostInstallCommands(rke2Config)