Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

File suffix for functions with content type base64 is not set #986

@me-viper

Description

@me-viper

Is this a BUG REPORT or FEATURE REQUEST?:
BUG REPORT

What happened:
I've created function definition yaml file and set function content type to base64.
Then I deploy the function with kubectl. Function fails to start.

kubeless does not set file suffix for functions with "base64" content type as it does for "text" and "url" content types so the file name of the function in image is <file_name>. But bootstrap expects it to have extension specific to the runtime (in my case <file_name>.py).

What you expected to happen:
kubeless sets file suffix for functions with "base64" content type as it does for "text" and "url" content types.

How to reproduce it (as minimally and precisely as possible):

apiVersion: kubeless.io/v1beta1
kind: Function
metadata:
  name: bug
  namespace: default
  label:
    created-by: kubeless
    function: bug
spec:
  runtime: python3.6
  timeout: "180"
  handler: bug.foo
  function-content-type: base64
  function: ZGVmIGZvbyhldmVudCwgY29udGV4dCk6DQogICAgcmV0dXJuICJoZWxsbyB3b3JsZCI==

kubectl.exe create -f .\bug.yaml

kubeless function ls

NAME    NAMESPACE       HANDLER         RUNTIME         DEPENDENCIES    STATUS
bug     default         bug.foo         python3.6                       0/1 NOT READY

kubectl logs -l function=bug

Traceback (most recent call last):
File "/kubeless.py", line 12, in
'/kubeless/%s.py' % os.getenv('MOD_NAME'))
File "/opt/bitnami/python/lib/python3.6/imp.py", line 172, in load_source
module = _load(spec)
File "", line 684, in _load
File "", line 665, in _load_unlocked
File "", line 674, in exec_module
File "", line 780, in get_code
File "/opt/bitnami/python/lib/python3.6/imp.py", line 158, in get_data
return super().get_data(path)
File "", line 832, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/kubeless/bug.py'

kubectl get pods -l function=bug -o yaml
...
initContainers:
- args:
- base64 -d < /src/bug > /tmp/func.decoded && cp /tmp/func.decoded /kubeless/bug
&& cp /src/requirements.txt /kubeless

Anything else we need to know?:
No

Environment:

  • Kubernetes version (use kubectl version):
    Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"windows/amd64"}
    Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-10T23:28:14Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}
  • Kubeless version (use kubeless version):
    v1.0.1
  • Cloud provider or physical cluster:
    physical cluster

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions