vmware-archive / kubeless

Kubernetes Native Serverless Framework
https://kubeless.io
Apache License 2.0
6.86k stars 754 forks source link

BUG - Appears .NET Core namespaces does not work (I think).... #1064

Open natiki opened 5 years ago

natiki commented 5 years ago

Hi,

Environment:

[root@node01 hello-world]# kubectl version Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:23:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e6bcfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-06-19T16:32:14Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"} [root@node01 hello-world]# kubeless version Kubeless version: v1.0.4-dirty [root@node01 hello-world]# minikube version minikube version: v1.2.0

I am testing the .NET namespace change from https://github.com/kubeless/runtimes/pull/17 and it is not clear how to deploy the function as it assumed that instead of:

kubeless function deploy hwn-lc --from-file HwNamespace.cs --handler hwn.handler --dependencies Function.HelloWorld.csproj --runtime dotnetcore2.1 you would need something like the following (I have included the original source as well, because I am guessing that .NET Core runtime also does not do well with casing of namespaces as it does not do casing elsewhere).

[root@node01 hello-world]# cat HwNamespace.cs
using Kubeless.Functions;

namespace Function.HelloWorld
{
    public class hwn
    {
        public object handler(Event k8Event, Context k8Context)
        {
            return $"HwNamespace - {k8Event.Data}";
        }
    }
}
[root@node01 hello-world]# kubeless function deploy hwn-tc  --from-file HwNamespace.cs --handler Function.HelloWorld.hwn.handler --dependencies Function.HelloWorld.csproj --runtime dotnetcore2.1
INFO[0000] Deploying function...
INFO[0000] Function hwn-tc submitted for deployment
INFO[0000] Check the deployment status executing 'kubeless function ls hwn-tc'
[root@node01 hello-world]# vi HwNamespace.cs
[root@node01 hello-world]# cat HwNamespace.cs
using Kubeless.Functions;

namespace function.helloworld
{
    public class hwn
    {
        public object handler(Event k8Event, Context k8Context)
        {
            return $"HwNamespace - {k8Event.Data}";
        }
    }
}
[root@node01 hello-world]# kubeless function deploy hwn-lc  --from-file HwNamespace.cs --handler function.helloworld.hwn.handler --dependencies Function.HelloWorld.csproj --runtime dotnetcore2.1
INFO[0000] Deploying function...
INFO[0000] Function hwn-lc submitted for deployment
INFO[0000] Check the deployment status executing 'kubeless function ls hwn-lc'
[root@node01 hello-world]# [root@node01 hello-world]# cat HwNamespace.cs
            return $"HwNamespace - {k8Event.Data}";
        }
    }
}

however both deployments produce the same error:

[root@node01 hello-world]# kubeless function ls hwn-tc
NAME    NAMESPACE       HANDLER                         RUNTIME         DEPENDENCIES                                            STATUS
                        MISSING: Check controller logsr dotnetcore2.1   <Project Sdk="Microsoft.NET.Sdk">

                                                                          <PropertyGroup>

                                                                        <TargetFramework>netcoreapp2.1</TargetFramework>
                                                                          </PropertyGroup>

                                                                          <ItemGroup>
                                                                            <PackageReference Include="Kubeless.Functions"
                                                                        Version="0.1.1" />
                                                                            <PackageReference Include="YamlDotNet"
                                                                        Version="6.1.1" />
                                                                          </ItemGroup>

                                                                              ect>

[root@node01 hello-world]# kubeless function ls hwn-lc
NAME    NAMESPACE       HANDLER                         RUNTIME         DEPENDENCIES                                            STATUS
                        MISSING: Check controller logsr dotnetcore2.1   <Project Sdk="Microsoft.NET.Sdk">

                                                                          <PropertyGroup>

                                                                        <TargetFramework>netcoreapp2.1</TargetFramework>
                                                                          </PropertyGroup>

                                                                          <ItemGroup>
                                                                            <PackageReference Include="Kubeless.Functions"
                                                                        Version="0.1.1" />
                                                                            <PackageReference Include="YamlDotNet"
                                                                        Version="6.1.1" />
                                                                          </ItemGroup>

                                                                              ect>

Not sure if this is a runtime problem or with kubeless itself?

andresmgot commented 5 years ago

I am not an expert in the .NET runtime but this seems to be an error in the backend. You can check the controller logs executing kubectl logs -n kubeless -l kubeless=controller

More info about how to debug functions here: https://kubeless.io/docs/debug-functions/