Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about API / envProcess #1219

Closed
3 tasks done
ameier38 opened this issue Jun 11, 2019 · 10 comments
Closed
3 tasks done

Question about API / envProcess #1219

ameier38 opened this issue Jun 11, 2019 · 10 comments
Labels

Comments

@ameier38
Copy link

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 #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: fa93655
commit: Update test for metrics server

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

  • 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

@alexellis
Copy link
Member

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
Copy link
Member

Derek set title: Question about API / envProcess

@derek derek bot changed the title envProcess is blank in /system/function/<function> response Question about API / envProcess Jun 11, 2019
@alexellis
Copy link
Member

Derek add label: question

@derek derek bot added the question label Jun 11, 2019
@alexellis
Copy link
Member

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

@ameier38
Copy link
Author

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

@ewilde
Copy link
Contributor

ewilde commented Jun 11, 2019

@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

@ameier38
Copy link
Author

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

@ewilde
Copy link
Contributor

ewilde commented Jun 11, 2019

@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

@ameier38
Copy link
Author

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.

@alexellis
Copy link
Member

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants