kubeless
kubeless copied to clipboard
Multipart support for nodejs kubeless functions
Feature request
What happened: I'm trying to implement a kubeless function in nodejs that receives a multipart form with a file and additional properties (JSON), commonly this can be easily achieved using express and an external library like multer. However, it seems like kubeless is converting the request data into a string no matter the type.
What you expected to happen:
I'd like to be able to read streams from the request.
First step would be something like: https://github.com/kubeless/runtimes/pull/29
Environment:
- Kubernetes version (use
kubectl version
):
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
- Kubeless version (use
kubeless version
): v1.0.3 - Cloud provider or physical cluster: Physical cluster
hi @diugalde,
I have rebuilt and push the NodeJS images with your patch (https://github.com/kubeless/runtimes/pull/30/files)
If you want to try the changes you can edit the kubeless config (kubectl edit configmap -n kubeless kubeless-config
), change the checksum in the NodeJS images, and restart the controller pod (kubectl delete pod -n kubeless -l kubeless=controller
).
Can you try that and let me know if that fixes your issue?
Hi @andresmgot , I followed your steps but it seems like the new image is not being loaded after running kubectl delete pod -n kubeless -l kubeless=controller
(event.data still has a string).
can you check if the function pod is using the new image? The following command (changing the name of your function):
kubectl get pods -o jsonpath="{.items[0].spec.containers[0].image}" -l function=your-function
should return the new sha256 (28fe2edc427e1deefb9d2cb12878d98e64fd14dc0299f4bf009f9ce26bd8b14a
for node 6 or 1c57908576b80142b070018091d2fd2d6446428de94d331aa0483ddc5e6e002c
for node 8)
@andresmgot It was my mistake, I was using the kubeless-serverless-offline plugin, I have to make the change there too. However, once I was able to test it, I noticed we also needed an additional change related to the body parser. Here: https://github.com/kubeless/runtimes/pull/31