Closed jvenant closed 3 years ago
The OpenAPI spec says it's a single string.
"/api/v1/namespaces/{namespace}/pods/{name}/exec": {
"get": {
"consumes": [
"*/*"
],
"description": "connect GET requests to exec of Pod",
"operationId": "connectCoreV1GetNamespacedPodExec",
[...]
},
"parameters": [
{
"description": "Command is the remote command to execute. argv array. Not executed within a shell.",
"in": "query",
"name": "command",
"type": "string",
"uniqueItems": true
},
The golang type says it's a string slice.
Now, the JSON tag on the golang type doesn't matter because this type is serialized through the querystring, not as JSON body. So the OpenAPI spec is at least correct that the parameter location is query
.
But as for whether it's a string or a string array, I haven't found the code that actually parses a PodExecOptions
from the query string. If it does want a string array, I would need to look at the code to figure out how exactly does it want that when the serialization format is a query string - command=ls&command=-la
? URL-encoded JSON array? Something else?
FYI this is how kube
does exec:
for c in command.into_iter() {
qp.append_pair("command", &c.into());
}
It seems like kube specifies command parameter multiple times, once per each argument.
Thanks for confirming. So we'll need a fixup to change the parameter from Type::String
to Type::Array { Type::String }
, plus add support for that in write_operation
Thank you very much !
Hi,
I'm trying to use the exec api using
connect_get_namespaced_pod_exec
ofv1_20
to generate the http request, it works perfectly with a single command likels
through kubeconnect
function. But I didn't find a way to pass commands with arguments likels -la
for exampleThe command variable definition doesn't seem to be compatible with the comment description :
From my understanding, command should be an array of str.