Closed joshuasprow closed 4 years ago
We changed the image so that the CLI itself is the entry point. That's probably why. Cc @utsavanand2 @LucasRoesler
/set title: Support request for faas-cli docker image
Hii @joshuasprow !
You might want to make some changes to your CronJob by adding a command
field with value ["/bin/sh", "-c"]
and hence remove /bin/sh
and -c
from the args
.
The final YAML of your CronJob should look something like this.
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: function
namespace: openfaas
spec:
schedule: "*/30 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 5
failedJobsHistoryLimit: 10
jobTemplate:
spec:
template:
spec:
containers:
- name: openfaas-cli
image: openfaas/faas-cli:0.12.6
command: ["/bin/sh", "-c"]
args:
- echo "verbose" | faas-cli invoke function -g http://gateway.openfaas:8080
restartPolicy: OnFailure
Let us know if it works out for you!
You'll need to try different things out, but this is the reason the docs you followed didn't work. You can always look at the changelog and pin to the version before the change was merged.
One you do figure it out, we'd appreciate a PR
Moving those args into a command did the trick. Thanks @utsavanand2 !!
If I understand correctly, this happened because changing the CLI to be the entry point meant that the arguments were out of order. I was trying to pass /bin/sh
as an argument to faas-cli
and that's not a thing.
I'd be happy to make a PR to update the docs if that's the case.
@joshuasprow Yes you're right 😉. Glad it worked out for you
/close
I have a function deployed to OpenFaas on a Rancher Kubernetes cluster and started seeing cron jobs fail when using image 0.12.6 and later. I'm using basically the same yaml from the docs and haven't changed my function code, so
faas-cli
is the most likely culprit.Expected Behaviour
The cron workload triggers the OpenFaas function, as expected.
Current Behaviour
When the job fails, it emits an error:
Unknown command "/bin/sh" for "faas-cli"
from the cron workload. Also, the function itself is not triggered.Possible Solution
Lock the faas-cli version to 0.12.4. It's probably a good idea to lock the version regardless, right? I'm pretty new to Kubernetes, so I could use a hand.
Steps to Reproduce (for bugs)
Context
Just trying to schedule my OpenFaas functions.
Your Environment
FaaS-CLI version ( Full output from:
faas-cli version
):0.12.6
I'd give the full output but the container crashes before I canexec
into it.Docker version ( Full output from:
docker version
):18.9.2
Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)?
Kubernetes
Operating System and version (e.g. Linux, Windows, MacOS):
Linux
Link to your project or a code example to reproduce issue: I'm not sure what code would be relevant other than the yaml above. I'd be happy to provide any other info if someone asks for something specific.