A Kubernetes / Openshift Operator, based on the Operator SDK that manages (creates and deletes) Openwhisk actions.
Prerequisite: Openwhisk deployed to a namespace. You can follow the instructions to set up Openwhisk.
Download the resources:
$ curl https://raw.githubusercontent.com/pb82/serverless-operator/master/deploy/operator.yaml > operator.yaml
$ curl https://raw.githubusercontent.com/pb82/serverless-operator/master/deploy/rbac.yaml > rbac.yaml
$ curl https://raw.githubusercontent.com/pb82/serverless-operator/master/deploy/crd.yaml > crd.yaml
Create the resources:
$ oc create -f rbac.yaml
$ oc create -f crd.yaml
$ oc create -f operator.yaml --namespace=<Namespace containing Openwhisk>
NOTE: You need to have admin permissions to create the role bindings and custom resource.
You interact with the Operator by creating instances of the following custom resource:
apiVersion: "serverless.pb82.com/v1alpha1"
kind: "ServerlessAction"
metadata:
name: "<Resource name>"
spec:
name: "<Action name>"
kind: "<Action type, e.g. nodejs:6>"
code: "<Code for the Action>"
username: "<Openwhisk Username>"
password: "<Openwhisk Password>"
namespace: "<Openwhisk Namespace>"
Create a copy of the above and save it as cr.yaml
. Make sure to fill out the fields, then run:
$ oc create -f cr.yaml
This will trigger the operator to create the action. In order to delete the action from Openwhisk you delete the custom resource:
$ oc delete -f cr.yaml
Prerequisite: The Operator SDK needs to be installed on your machine. Follow the docs to set it up.
You can run the Operator without deploying it to your namespace by cloning this repository and running:
$ dep ensure
$ operator-sdk build docker.io/pb82/serverless-operator
$ operator-sdk up local --namespace=<Namespace containing Openwhisk>