-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add Exec command to Pods #38
Conversation
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
0a55d50
to
dafdf22
Compare
const result = kubernetes.pods.exec({ | ||
namespace: namespace, | ||
pod: podName, | ||
container: container.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing the example from a user perspective, it would be ideal to skip passing the container name.
What makes me think if we could pass the pod directly , so either the podName
or the pod
.
kubernetes.pods.exec({
pod: pod,
command:[]
stadin: []
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pods can have multiple containers, so it is important that the API allows specifying the target container.
For example, when using ephemeral containers to add chaos behavior to a running pod, it is necessary to be able to execute commands in the ephemeral container.
What could be improved is to mimic the behavior of the kubectl command and chose a default container if none is specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could be improved is to mimic the behavior of the kubectl command and chose a default container if none is specified.
Personally, I never liked this behavior :(
So, I would keep it as it is right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
posted a code comment
cc @javaducky |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add function for executing a command in an existing pod and return the output (stdin and strerr) in a similar way than executing a non interactive command using
kubectl exec
Note: for implementing this functionality it is necessary to access the k8s client configuration. As the client library does not allow to retrieve it from the client instance, it was necessary to add the config to the Pod structure.
Closes #35