openwhisk-operator

module
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0

README

IBM Cloud Functions Operator

Build Status License

This project provides a Kubernetes operator for managing IBM Cloud Functions resources: actions, packages, rules and triggers.

Quick start

Prerequisites

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

Installing the operator

  1. Clone this repository
  2. Install the CRDs using kubectl:
$ kubectl apply -f config/crds
  1. Then install the operator:
$ kubectl apply -f config/manager -f config/rbac/

By default the operator is installed in the ibmcloud-operators namespace and is granted clustor-wide permissions.

Using the operators

Setting up IBM cloud credentials

By default, all operators look for the IBM cloud function credentials in the seed-defaults-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 IBM cloud function entities and can potentially override existing entities.

Deploying your first function

The Function resource kind allows the deployment of actions:

apiVersion: ibmcloud.ibm.com/v1alpha1
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:

$ ibmcloud 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/ibmcloud
Package ibmcloud contains ibmcloud API versions
Package ibmcloud contains ibmcloud API versions
apis/ibmcloud/v1alpha1
Package v1alpha1 contains API Schema definitions for the cloud functions v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/ibm/cloud-functions-operator/pkg/apis/ibmcloud +k8s:defaulter-gen=TypeMeta +groupName=ibmcloud.ibm.com
Package v1alpha1 contains API Schema definitions for the cloud functions v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/ibm/cloud-functions-operator/pkg/apis/ibmcloud +k8s:defaulter-gen=TypeMeta +groupName=ibmcloud.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