Open
Description
What is the feature and why do you need it:
I have the use case to do the python equivalent of
cat $local_file | kubectl exec command_in_container
I have been able to use something like this
core_api = client.CoreV1Api(api_client)
stream_response: WSClient = stream(
core_api.connect_get_namespaced_pod_exec, pod_name,
pod_namespace, command=command,
stdin=True,
stdout=False,
stderr=True,
_preload_content=False,
)
# Ideally I need to do streaming-write, but for sake of example, just a text:
if input_text:
stream_response.write_stdin(input_text)
But here's the problem. The process invoked on container through the exec
command needs to know the input has ended. I don't find a way to close
the stdin of the command.
Describe the solution you'd like to see:
I think ideally we have a function to close the stdin
response.close_stdin()
Need to check how go client and kubectl
handles this.