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

[Refactor] Rewrite ExecPodCmd with client-go remotecommand package #2462

Closed
2 tasks done
MortalHappiness opened this issue Oct 22, 2024 · 2 comments · Fixed by #2467
Closed
2 tasks done

[Refactor] Rewrite ExecPodCmd with client-go remotecommand package #2462

MortalHappiness opened this issue Oct 22, 2024 · 2 comments · Fixed by #2467
Assignees
Labels
enhancement New feature or request

Comments

@MortalHappiness
Copy link
Member

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

In

func ExecPodCmd(t Test, pod *corev1.Pod, containerName string, cmd []string) {
kubectlCmd := []string{"exec", pod.Name, "-n", pod.Namespace, "-c", containerName, "--"}
kubectlCmd = append(kubectlCmd, cmd...)
t.T().Logf("Executing command: kubectl %s", kubectlCmd)
output, err := exec.Command("kubectl", kubectlCmd...).CombinedOutput()
t.T().Logf("Command output: %s", output)
t.Expect(err).NotTo(gomega.HaveOccurred())
}

we called external kubectl command.

It's better to use the remotecommand package from client-go because this can remove dependencies for external command.

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
@MortalHappiness MortalHappiness added the enhancement New feature or request label Oct 22, 2024
@MortalHappiness MortalHappiness self-assigned this Oct 22, 2024
@MortalHappiness
Copy link
Member Author

@CheyuWu would you want to do this? Because this is found while reviewing #2459

@CheyuWu
Copy link
Contributor

CheyuWu commented Oct 22, 2024

Hi @MortalHappiness I'd like to help with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants