openfaas / faas-cli

Official CLI for OpenFaaS
https://www.openfaas.com/
Other
798 stars 224 forks source link

Add Rio to faas-cli generate #640

Open alexellis opened 5 years ago

alexellis commented 5 years ago

Expected Behaviour

The following should generate a Rancher Rio Service definition:

faas-cli generate --api=services.rio.cattle.io
apiVersion: rio.cattle.io/v1
kind: Service
metadata:
  name: figlet
  namespace: default
spec:
  concurrency: 10
  cpus: "0"
  env:
  - name: a
    value: b
  image: functions/figlet:latest
  imagePullPolicy: IfNotPresent
  maxScale: 1
  minScale: 1
  ports:
  - port: 8080
    protocol: HTTP
    targetPort: 8080
  rollout: true
  rolloutIncrement: 5
  rolloutInterval: 5
  scale: 1
  weight: 100

Current Behaviour

We have OpenFaaS CRD and Knative Serving CRD in place. I'd like to see the Rio CRD there next.

Possible Solution

Copy the approach used for the current generation as per: https://github.com/openfaas/faas-cli/blob/master/commands/generate.go#L164

Set all default / minimum needed to get a service running.

dpen2000 commented 5 years ago

I'll take a look at this, @alexellis

alexellis commented 5 years ago

I'm quite keen to get this done quickly. Once you've had a look please can you reply if you can work on it and when you think that you may have a PR up?

The port is always fixed as: 8080

We have ways to translate the OpenFaaS scaling parameters but I am OK with just replicating the above YAML 1:1 with all the defaults for the first iteration then, we can improve on that. Secrets are also not needed for this PR.

alexellis commented 5 years ago

We will definitely need the env.