faas icon indicating copy to clipboard operation
faas copied to clipboard

Question about API / envProcess

Open andymeierdev opened this issue 7 years ago • 10 comments

My actions before raising this issue

Expected Behaviour

I would expect the envProcess value to be populated in the response from /system/function/<function name>

Current Behaviour

envProcess is a blank string in the /system/function/<function name> response despite the fprocess having a value.

Possible Solution

Not sure yet

Steps to Reproduce (for bugs)

  1. Start kubernetes using Docker Desktop
  2. Deploy openfaas using the official helm chart
  3. Deploy figlet from the function store using the openfaas ui
  4. Make a call to http://localhost:8080/system/function/figlet

Response is:

{
    "name": "figlet",
    "image": "functions/figlet:0.13.0",
    "invocationCount": 0,
    "replicas": 1,
    "envProcess": "",
    "availableReplicas": 1,
    "labels": {
        "faas_function": "figlet"
    },
    "annotations": {
        "prometheus.io.scrape": "false"
    }
}

note the blank envProcess

Looking at the function store I see that fprocess is populated.

{
        "title": "Figlet",
        "name": "figlet",
        "description": "Generate ASCII logos with the figlet CLI",
        "images": {
            "armhf": "functions/figlet:latest-armhf",
            "x86_64": "functions/figlet:0.13.0"
        },
        "fprocess": "figlet",
        "repo_url": "https://github.com/openfaas/faas/tree/master/sample-functions/figlet"
 }

Context

I am trying to use https://github.com/ewilde/terraform-provider-openfaas but having trouble running acceptance tests for some recent changes. Digging in, I could not figure out why the envProcess was always blank despite it being set in the request. Maybe this is a desired behavior 🤔 ? Searching for issues I also came across https://github.com/openfaas/faas/issues/848 which also be very helpful.

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):

CLI: commit: 96f159fc3e85a6782461c9dde77cbf88308aa21d version: 0.8.6

Gateway uri: http://localhost:8080 version: 0.13.0 sha: fa93655d90d1518b04e7cfca7d7548d7d133a34e commit: Update test for metrics server

Provider name: faas-netes orchestration: kubernetes version: 0.7.5 sha: 4d3671bae8993cf3fde2da9845818a668a009617

  • Docker version docker version (e.g. Docker 17.0.05 ):

Client: Docker Engine - Community Version: 18.09.2 API version: 1.39 Go version: go1.10.8 Git commit: 6247962 Built: Sun Feb 10 04:12:31 2019 OS/Arch: windows/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 18.09.2 API version: 1.39 (minimum version 1.12) Go version: go1.10.6 Git commit: 6247962 Built: Sun Feb 10 04:13:06 2019 OS/Arch: linux/amd64 Experimental: false

  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?

Kubernetes

  • Operating System and version (e.g. Linux, Windows, MacOS):

Windows 10 64bit

andymeierdev avatar Jun 11 '19 20:06 andymeierdev

envProcess/fprocess is optional, so it will only come back if it went in via the create. There is no way to bubble up any value that has been set in the Dockerfile.

I'm not sure what the issue is? Can you try creating a deployment using the API and then show whether the value you inputted is coming back or not?

alexellis avatar Jun 11 '19 20:06 alexellis

Derek set title: Question about API / envProcess

alexellis avatar Jun 11 '19 20:06 alexellis

Derek add label: question

alexellis avatar Jun 11 '19 20:06 alexellis

Do you see it set on http://localhost:8080/system/functions ?

alexellis avatar Jun 11 '19 20:06 alexellis

I just ran POST http://localhost:8080/system/functions with body

{
  "service": "figlet-test",
  "image": "functions/figlet:latest",
  "envProcess": "figlet",
  "labels": {
    "foo": "bar"
  }
}

And the ran GET http://localhost:8080/system/function/figlet-test with response

{
    "name": "figlet-test",
    "image": "functions/figlet:latest",
    "invocationCount": 0,
    "replicas": 1,
    "envProcess": "",
    "availableReplicas": 1,
    "labels": {
        "faas_function": "figlet-test"
    },
    "annotations": {
        "prometheus.io.scrape": "false"
    }
}

envProcess is blank despite being passed into the request to create

andymeierdev avatar Jun 11 '19 20:06 andymeierdev

@ameier38 as you mentioned I think you are running into #848. Perhaps we can get some consensus on the way forward in #848, that should resolve the problem you are seeing

ewilde avatar Jun 11 '19 21:06 ewilde

Agree, I would love to help pick up #848 but wasn't sure if this was a bug that should addressed first.

andymeierdev avatar Jun 11 '19 21:06 andymeierdev

@ameier38 looks like in faas-netes it's set as an environment variable during deployment here: https://github.com/openfaas/faas-netes/blob/master/handlers/deploy.go#L283

But its not read back here: https://github.com/openfaas/faas-netes/blob/master/handlers/reader.go#L93

ewilde avatar Jun 11 '19 21:06 ewilde

Ahh I see now. Thanks. Sorry just started looking at the code and trying to wrap my head around how it all connects.

I think #848 would address the issue as you said. Ill close this and pick up the conversation there.

andymeierdev avatar Jun 11 '19 23:06 andymeierdev

@ameier38 please can you try reading back the env-var from the container spec? I am not sure if it will be available, but you could try?

If you are not sure where to start please ask in #contributors.

Alex

alexellis avatar Jun 29 '19 09:06 alexellis