From 7b670d20d31021b893862d234f4a1f72453c1000 Mon Sep 17 00:00:00 2001 From: Danil Grigorev Date: Fri, 11 Oct 2024 12:27:35 +0200 Subject: [PATCH] Drop sudo from system agent install command (#780) Signed-off-by: Danil-Grigorev --- exp/etcdrestore/webhooks/rke2config.go | 2 +- exp/etcdrestore/webhooks/rke2config_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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)