<p>Im having trouble invoking functions using kubeless. 
Here is the function spec</p>

<pre><code>---
apiVersion: kubeless.io/v1beta1
kind: Function
metadata:
  name: smk
  namespace: smktest
spec:
  handler: hello.handler
  runtime: python2.7
  function: |
      import json
      def handler():
              return "hello world"
  deployment:
    spec:
      template:
        spec:
          containers:
             - env:
               - name: FOO
                 value: bar
               name: "smk-deployment"
               resources:
                 limits:
                   cpu: 100m
                   memory: 100Mi
                 requests:
                   cpu: 100m
                   memory: 100Mi
</code></pre>

<p>When I try to call the function as below,</p>

<pre><code>kubeless function call smk 
</code></pre>

<p>I get </p>

<p><code>FATA[0000] Unable to find the service for smk</code></p>

<p>Two part question</p>

<ol>
<li>How do I expose my function as  a service</li>
<li>How do I specify Environment variables needed by this function ? 
Thank you</li>
</ol>

<p><strong><em>Update</em></strong>
Running kubeless function ls --namespace=smktest yields below</p>

<pre><code>NAME    NAMESPACE   HANDLER         RUNTIME     DEPENDENCIES    STATUS
smk     smktest     hello.handler   python2.7                   MISSING: Check controller logs
</code></pre>

<p>Next I tried <code>kubectl logs -n kubeless -l kubeless=controller</code> there's tons of error logs but I don't see anything specific to this function</p>

<blockquote>
  <p>When I try to call the function as below,</p>
  
  <p><code>kubeless function call smk</code></p>
  
  <p>I get</p>
  
  <p><code>FATA[0000] Unable to find the service for smk</code></p>
  
  <p>Running <code>kubeless function ls --namespace=smktest</code></p>
</blockquote>

<p>Then surely you would need to include the <code>--namespace=smktest</code> in your invocation command, too:</p>

<pre><code>kubeless function call --namespace=smktest smk 
</code></pre>

<hr>

<blockquote>
  <p>How do I specify Environment variables needed by this function ? Thank you</p>
</blockquote>

<p>As best I can tell, there seems to be two approaches in use:</p>

<ul>
<li><a href="https://github.com/kubeless/kubeless/blob/v0.6.0/pkg/apis/kubeless/v1beta1/function.go#L45" rel="nofollow noreferrer">Provide a <code>Deployment</code> template</a>, which the <a href="https://github.com/kubeless/kubeless/blob/v0.6.0/pkg/controller/function_controller.go#L311" rel="nofollow noreferrer"><code>function controller</code> appears to merge</a> but as far as I know <code>container: image:</code> is required in a <code>Deployment</code>, so you'd have to specify one in order to get access to its <code>env:</code> declaration</li>
<li>Otherwise "cheat" and use the <code>Pod</code>s <code>ServiceAccount</code> token to <a href="https://github.com/kubeless/functions/blob/d80825f1d21e2686a1f817a45d333729a360da8a/incubator/slack/bot.py#L11" rel="nofollow noreferrer">request cluster resources manually</a> which might include a <code>ConfigMap</code>, <code>Secret</code>, or even resolving your own <code>kubeless.io/function</code> manifest and pulling something out of its annotations or similar</li>
</ul>
