cloud-functions-operator

module
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2019 License: Apache-2.0

README

Apache OpenWhisk Operators

Build Status License

This project provides a collection of Kubernetes operators for managing Apache OpenWhisk resources namely actions, packages, rules and triggers.

Quick start

Prerequisites

  • A cluster running Kubernetes 1.11+
  • kubectl installed and configured.
  • kustomize installed.

Installing the operators

  1. Install the CRDs using kubectl:
$ kustomize build github.com/IBM/openwhisk-operator//config/crds | kubectl apply -f -
  1. Then install the operators:
$ kustomize build github.com/IBM/openwhisk-operator//config/default | kubectl apply -f -

By default the operators are installed in the openwhisk-system namespace and are granted clustor-wide permissions.

Using the operators

Setting up OpenWhisk credentials

By default, all operators look for OpenWhisk credentials in the seed-default-owprops secret:

# Extract properties from .wskprops
AUTH=$(cat ~/.wskprops | grep 'AUTH' | awk -F= '{print $2}')
APIHOST=$(cat ~/.wskprops | grep 'APIHOST' | awk -F= '{print $2}')

# And create secret
kubectl create secret generic seed-defaults-owprops \
    --from-literal=apihost=$APIHOST \
    --from-literal=auth=$AUTH

Alternativalely, you can directly create a k8s secret

apiVersion: v1
kind: Secret
metadata: 
  name: seed-default-owprops
stringData:
  apihost: localhost
  auth: "23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP"
  insecure: "true"

NOTE: be aware that all operators update OpenWhisk entities and can potentially override existing entitites.

Deploying your first function

The Function resource kind allows the deployement of actions:

apiVersion: openwhisk.seed.ibm.com/v1beta1
kind: Function
metadata:
  name: greetings
spec:
  codeURI: https://raw.githubusercontent.com/apache/incubator-openwhisk-catalog/master/packages/utils/echo.js
  runtime: nodejs:6
  parameters:
  - name: message
    value: Bonjour

Deploy it:

$ kubectl apply -f sample.yaml

wait a little bit and run:

$ wsk action invoke greetings -br

Learn more

Directories

Path Synopsis
cmd
hack
pkg
apis
Package apis contains Kubernetes API groups.
Package apis contains Kubernetes API groups.
apis/openwhisk
Package openwhisk contains openwhisk API versions
Package openwhisk contains openwhisk API versions
apis/openwhisk/v1beta1
Package v1beta1 contains API Schema definitions for the openwhisk v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/ibm/openwhisk-operator/pkg/apis/openwhisk +k8s:defaulter-gen=TypeMeta +groupName=openwhisk.seed.ibm.com
Package v1beta1 contains API Schema definitions for the openwhisk v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/ibm/openwhisk-operator/pkg/apis/openwhisk +k8s:defaulter-gen=TypeMeta +groupName=openwhisk.seed.ibm.com
controller/auth
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL