Feature: Generate Kubernetes CRD YAML files via cli #426
The new definition for the Kubernetes CRD used in OpenFaaS Operator is different from the current stack file YAML definition.
I think the faas-cli should be used to generate/build/test functions in the stack.yml format and then if deployment is needed via
provider: name: faas gateway: http://127.0.0.1:8080 functions: nodeinfo: lang: node handler: ./nodeinfo image: nodeinfo
The Kubernetes YAML omits any build-context such as the language or the
apiVersion: openfaas.com/v1alpha2 kind: Function metadata: name: nodeinfo namespace: openfaas-fn spec: name: nodeinfo image: functions/nodeinfo environment: write_debug: "true"
Suggested CLI command:
faas-cli generate --api=openfaas.com/v1alpha2 -f stack.yml # Pipe to kubectl: faas-cli generate --api=openfaas.com/v1alpha2 --yaml stack.yml | kubectl apply -f
This would go to stdout and could be piped into a yaml file for use with kubectl
Unsure on the wording for
Two primary ideas for implementation:
The ClientSet will be a huge dependency and only useful for Kubernetes, it may bloat the repo and binary a lot. On the flip side it will also mean versioning is easier. Slightly less maintenance is needed because bringing in schema changes means just revendoring.
Creating a parallel struct with a simple .go file would be much less of a burden. Slightly more maintenance will be needed for this as changes in the ClientSet have to be brought into the local struct copy.