vmware-archive/kubeless

kubeless deploy with local zip

julientamisier opened this issue · 2 comments

Is this a BUG REPORT or FEATURE REQUEST?:
Seems to be a bug
What happened:
I am testing Kubeless using zip package . While it's properly working using standard deploy from single file, using the same as a zip package doesn't work, the file module is never found.
What you expected to happen:
I am expecting the function to run properly and find the handler
How to reproduce it (as minimally and precisely as possible):
Doing : kubeless function deploy hello-kubeless-python --runtime python3.6 --from-file hello-kubeless/handler.py --handler handler.main
works perfectly
But doing :
kubeless function deploy hello-kubeless-python --runtime python3.6 --from-file hello-kubeless.zip --handler handler.main
leads to
$ kubectl logs -l function=handler
Traceback (most recent call last):
File "/_kubeless.py", line 20, in
mod = importlib.import_module(os.getenv('MOD_NAME'))
File "/opt/bitnami/python/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'handler'
please find here the simple used package :
hello-kubeless.zip

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):
  • Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:50:19Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"darwin/amd64"}
    Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
  • Kubeless version (use kubeless version): Kubeless version: v1.0.8
  • Cloud provider or physical cluster: using my mac with minikube

hi @julientamisier, the function file should be at the root directory of the zip

ah ok got it ! I was zipping a folder containing the handler.py effectively, now it works !
many thanks
I close the ticket