kubeless
kubeless copied to clipboard
Support for folders in handlers
FEATURE REQUEST:
What happened:
Defining the handler with a path handler: dist/index.js
results in the error from https://github.com/kubeless/kubeless/blob/2507dc8ba457a9e89ebb9e7b06b99db39dae6595/pkg/utils/kubelessutil.go#L238 being logged.
What you expected to happen: Should be able to define handlers from files e.g. (linked from the serverless examples) https://github.com/boazdejong/serverless-graphql-api/blob/master/serverless.yml#L30
How to reproduce it (as minimally and precisely as possible): Define a hanlder with a path as shown above
Anything else we need to know?: Relates to https://github.com/serverless/serverless-kubeless/issues/121
Environment:
- Kubernetes version (use
kubectl version
): 1.8.10 - Kubeless version (use
kubeless version
): v1.0.0-alpha.4 - Cloud provider or physical cluster: AWS
looks like it is supported in the AWS serverless provider .
we would need to add it indeed.
@andresmgot is this something that is still being planned to be added?
@kody-abe for the moment we don't have time allocated for this. We are open to contributions though!
Hello, such a feature is very handy actually. I was trying to debug this problem and the underlying architecture is working actually. The problem is only in the API for deploying the function.
Steps I took
1- Run the following command
kubeless function deploy hello --runtime nodejs12 --from-file dist/index.js --handler dist/index.hello --dependencies package.json
This deployed the function but failed to create the kubernetes resources (deployment, services, configmap...)
2- Create handler with root path
kubeless function deploy hello --runtime nodejs12 --from-file dist/index.js --handler index.hello --dependencies package.json
This works fine but we don't have the folder in the handler and the index.js is in the root dir.
3- Go inside the pod 4- Create dist folder and move index.js inside dist. 5- Edit Kubernetes Deployment and change the environment MOD_NAME from index => dist/index Now everything is working fine.
I was using serverless library and my yml file looks like this:
functions:
hello:
handler: dist/index.hello
This will fail as step one. If I remove dist from yaml file and deploy will work fine. And since serverless take care of zip/unzip the whole folder structure the only changes I had to do was step number 5. Change the MOD_NAME environment to point to the right folder/file inside my project