Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Drop sudo from system agent install command #780

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exp/etcdrestore/webhooks/rke2config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions exp/etcdrestore/webhooks/rke2config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down