openfaas / openfaas-cloud

The Multi-user OpenFaaS Platform
https://docs.openfaas.com/openfaas-cloud/intro/
MIT License
770 stars 227 forks source link

failed to deploy functions using openfaas operator #707

Closed viveksyngh closed 3 years ago

viveksyngh commented 3 years ago

Failed to deploy function on openfaas cloud while using openfaas operator for the function where environment field in not present in stack.yml

Reference functions: https://github.com/viveksyngh/openfaas-functions

Expected Behaviour

It should deploy function if openfaas is deployed with operator

Current Behaviour

It gives error

2020/12/15 10:56:31 Success=false, Error=exit status 1
2020/12/15 10:56:31 Out=2020/12/15 10:56:19 0 env-vars for fn2
2020/12/15 10:56:19 0 env-vars for viveksyngh-fn2
2020/12/15 10:56:30 Image build status: 200
2020/12/15 10:56:30 buildshiprun: image 'docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-6631b26'
2020/12/15 10:56:30 pipeline-log: status: 200
2020/12/15 10:56:30 Deploying docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-6631b26 as viveksyngh-fn2
2020/12/15 10:56:30 Deploying: docker.io/viveksyngh/viveksyngh-openfaas-functions-fn2:latest-master-6631b26 as viveksyngh-fn2

Unexpected status: 500, message: Error creating function: Function.openfaas.com "viveksyngh-fn2" is invalid: spec.environment: Invalid value: "null": spec.environment in body must be of type object: "null"

Possible Solution

Workaround is add environment field in stack.yml even there are no environment variable to the function

Steps to Reproduce (for bugs)

  1. Deploy OpenFaaS cloud with OpenFaaS operator
  2. Deploy a function from github with no env value

Context

Your Environment

alexellis commented 3 years ago

Fixes:

https://github.com/openfaas/faas-cli/commit/598336a0cad38a79d5466e6a3a9aebab4fc61ba9 https://github.com/openfaas/faas-provider/commit/cf1e9f39556bc52eef96265fbda11ea1251f6ab2 https://github.com/openfaas/faas-netes/pull/730

alexellis commented 3 years ago

I believe this gives resolution to the issue. @viveksyngh could you take a look please?

And add operator: true/false to the ofc-bootstrap YAML file?

viveksyngh commented 3 years ago

derek close

viveksyngh commented 3 years ago

/close