faas-cli icon indicating copy to clipboard operation
faas-cli copied to clipboard

Add Rio to faas-cli generate

Open alexellis opened this issue 6 years ago • 3 comments

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.

  • Install K8s somewhere
  • Install Rio - https://github.com/rancher/rio
  • Try kubectl apply for the sample YAML above
  • Next update the faas-cli code to generate Service YAML

alexellis avatar May 24 '19 07:05 alexellis

I'll take a look at this, @alexellis

dpen2000 avatar May 24 '19 07:05 dpen2000

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 avatar May 24 '19 08:05 alexellis

We will definitely need the env.

alexellis avatar May 24 '19 08:05 alexellis