Add the function * constraints * environment variables * secrets * requests and limits This can be tested as follows: Create a test cluster using KinD ```sh kind create cluster --config=cluster.yaml arkade install openfaas -a=false --function-pull-policy=IfNotPresent --wait faas-cli store deploy nodeinfo --annotation sample=true --label status=418 ``` Now deploy a sample function ```sh $ faas-cli describe nodeinfo Name: nodeinfo Status: Ready Replicas: 1 Available replicas: 1 Invocations: 0 Image: ghcr.io/openfaas/nodeinfo:latest Function process: <default> URL: http://127.0.0.1:8080/function/nodeinfo Async URL: http://127.0.0.1:8080/async-function/nodeinfo Labels faas_function : nodeinfo status : 418 Annotations sample : true prometheus.io.scrape : false Constraints <none> Environment <none> Secrets <none> Requests <none> Limits <none> ``` Now we add some more interesting values, like a secret and env variables. ```sh $ faas-cli secret create db-password --from-literal=password Creating secret: db-password. Created: 202 Accepted $ faas-cli store deploy nodeinfo --annotation sample=true --label status=418 --secret db-password --env db-user=postgres --env db-host=rds.aws.example.com Deployed. 202 Accepted. URL: http://127.0.0.1:8080/function/nodeinfo $ faas-cli describe nodeinfo Name: nodeinfo Status: Ready Replicas: 1 Available replicas: 1 Invocations: 0 Image: ghcr.io/openfaas/nodeinfo:latest Function process: <default> URL: http://127.0.0.1:8080/function/nodeinfo Async URL: http://127.0.0.1:8080/async-function/nodeinfo Labels: faas_function: nodeinfo status: 418 uid: 736815901 Annotations: prometheus.io.scrape: false sample: true Constraints: <none> Environment: <none> Secrets: - db-password Requests: <none> Limits: <none> ``` To see how multiple Secrets and the Requests and Limits are rendered, use ```yaml version: 1.0 provider: name: openfaas gateway: http://127.0.0.1:8080 functions: nodeinfo: lang: Dockerfile image: ghcr.io/openfaas/nodeinfo:latest secrets: - cache-password - db-password environment: db-host: rds.aws.example.com cache-host: redis.aws.example.com labels: status: 481 annotations: sample: "true" requests: cpu: 100m memory: 128Mi limits: cpu: 200m memory: 256Mi ``` then ```sh $ faas-cli secret create cache-password --from-literal=password Creating secret: cache-password. Created: 202 Accepted $ faas-cli deploy Deploying: nodeinfo. Deployed. 202 Accepted. URL: http://127.0.0.1:8080/function/nodeinfo $ faas-cli describe nodeinfo Name: nodeinfo Status: Ready Replicas: 1 Available replicas: 1 Invocations: 0 Image: ghcr.io/openfaas/nodeinfo:latest Function process: <default> URL: http://127.0.0.1:8080/function/nodeinfo Async URL: http://127.0.0.1:8080/async-function/nodeinfo Labels: faas_function: nodeinfo status: 481 uid: 679245186 Annotations: prometheus.io.scrape: false sample: true Constraints: <none> Environment: <none> Secrets: - cache-password - db-password Requests: CPU: 100m Memory: 128Mi Limits: CPU: 200m Memory: 256Mi ``` Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
16 lines
439 B
Go
16 lines
439 B
Go
// Copyright (c) OpenFaaS Author(s) 2018. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
package schema
|
|
|
|
import "github.com/openfaas/faas-provider/types"
|
|
|
|
//FunctionDescription information related to a function
|
|
type FunctionDescription struct {
|
|
types.FunctionStatus
|
|
Status string
|
|
InvocationCount int
|
|
URL string
|
|
AsyncURL string
|
|
}
|