vmware-archive / runtimes

Kubeless function runtimes: https://kubeless.io/docs/runtimes/
Apache License 2.0
81 stars 89 forks source link

How to install unreleased runtime? #65

Closed har07 closed 4 years ago

har07 commented 4 years ago

I want to use .NET core 3.1 runtime but current kubeless release (v1.0.6), which I have installed, only have .NET core up to 2.2. Is there a way to install unreleased runtime and is there any documentation on that?

lorenzo-ange commented 4 years ago

Hello @har07 , I don't know if there is documentation about it but to use a custom kubeless runtime you need to do a couple of things in Kubernetes:

1. Edit the ConfigMap "kubeless-config" in the namespace "kubeless" For example to add a 3.1 dotnet runtime edit the dotnetcore section of the runtime-images json field to become like this:

kubectl -n kubeless edit configmap kubeless-config

...

{
   "ID":"dotnetcore",
   "depName":"project.csproj",
   "fileNameSuffix":".cs",
   "versions":[
      {
         "images":[
            {
               "command":"/app/compile-function.sh $KUBELESS_INSTALL_VOLUME",
               "image":"allantargino/aspnetcore-build@sha256:0d60f845ff6c9c019362a68b87b3920f3eb2d32f847f2d75e4d190cc0ce1d81c",
               "phase":"compilation"
            },
            {
               "env":{
                  "DOTNETCORE_HOME":"$(KUBELESS_INSTALL_VOLUME)/packages"
               },
               "image":"allantargino/kubeless-dotnetcore@sha256:1699b07d9fc0276ddfecc2f823f272d96fd58bbab82d7e67f2fd4982a95aeadc",
               "phase":"runtime"
            }
         ],
         "name":"dotnetcore2.0",
         "version":"2.0"
      },
      {
         "images":[
            {
               "command":"/app/compile-function.sh $KUBELESS_INSTALL_VOLUME",
               "image":"allantargino/aspnetcore-build@sha256:36123cf0279b87c5d27d69558062678a5353cc6db238af46bd5c0e508109f659",
               "phase":"compilation"
            },
            {
               "env":{
                  "DOTNETCORE_HOME":"$(KUBELESS_INSTALL_VOLUME)/packages"
               },
               "image":"allantargino/kubeless-dotnetcore@sha256:6d6c659807881e9dac7adde305867163ced5711ef77a3a76e50112bca1ba14cf",
               "phase":"runtime"
            }
         ],
         "name":"dotnetcore2.1",
         "version":"2.1"
      },
      {
         "images":[
            {
               "command":"/app/compile-function.sh $KUBELESS_INSTALL_VOLUME",
               "image":"lennartquerter/kubless_compile_dotnetcore22:4761f204190ad59807b9231e096cbcb3901226cd",
               "phase":"compilation"
            },
            {
               "env":{
                  "DOTNETCORE_HOME":"$(KUBELESS_INSTALL_VOLUME)/packages"
               },
               "image":"lennartquerter/kubless_runtime_dotnetcore22:4761f204190ad59807b9231e096cbcb3901226cd",
               "phase":"runtime"
            }
         ],
         "name":"dotnetcore2.2",
         "version":"2.2"
      },
      {
         "images":[
            {
               "command":"/app/compile-function.sh $KUBELESS_INSTALL_VOLUME",
               "image":"lorenzoangelini3/kubeless-compile-dotnetcore31@sha256:4e6adfe873f7c4cd5e0d582bb5122f94c6d6ea73baa03b486dd93b8406deb8ca",
               "phase":"compilation"
            },
            {
               "env":{
                  "DOTNETCORE_HOME":"$(KUBELESS_INSTALL_VOLUME)/packages"
               },
               "image":"lorenzoangelini3/kubeless-runtime-dotnetcore31@sha256:ccdff9e6428f17d9f263fb49619121dde1f06f364d0815368348f9dca4a35c67",
               "phase":"runtime"
            }
         ],
         "name":"dotnetcore3.1",
         "version":"3.1"
      }
   ]
},

...

2. Delete all the pods in the namespace kubeless

We need to delete the kubeless controller pod to make it restart and load the config-map updates:

kubectl -n kubeless delete pod --all

3. Now you have installed a new kubeless runtime with name "dotnetcore3.1"

har07 commented 4 years ago

@lorenzo-ange Thanks a lot. The steps you explained seems to work for me to add custom kubeless runtime in general. That really helped.

The custom image will be pulled from docker hub, right? So the steps above should work with any custom runtime image, not only one that already defined in kubeless/runtime repo but not released in the main kubeless repo?

har07 commented 4 years ago

@lorenzo-ange now that I can use dotnetcore 3.1 runtime, I got error when trying a simple function using dotnetcore 3.1. I posted the error in another issue so that it can be found easily if anybody else will have the same problem: https://github.com/kubeless/runtimes/issues/67

Really appreciate all the help and contribution from you so far