Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Fission Environment integration #35

Merged
merged 6 commits into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Docs/controller-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Controller

The controller is responsible for managing invocations to completion.
It makes use of the scheduler to determine the strategy towards the completion of these invocations.
It makes use of the InvocationApi, FunctionApi and WorkflowApi to perform actions.

## Control Flow
The controller can best be described as an interruptible control loop.
It contains the following ways of managing the lifecycle of invocations.
- Long control loop
- Short control loop
- Notification interruption

### Long Control Loop
The long control loop has a frequency measured in seconds.
In this control loop, the controller will refresh the cache and check the event store for any active invocation.
This is meant to avoid missing any invocations that for whatever reason did not make it into the controller's active invocation cache.

### Short Control Loop
The short control loop has a frequency as high as possible performance-wise (most likely somewhere between 100-1000 ms)
The controller checks for updates on invocations in its active invocation cache.
This is meant to capture any invocations of which the notification (see notification section) did not occur.

### Notification
The notification resembles more or less an interrupt.
Whenever a relevant event occurs for an invocation, the controller receives a notification of this event.
Note that notifications are entirely optional, and only serve to reduce the latency of a workflow invocation.
In case of errors or an overload of notifications, the short or long control loop will pick up the invocation


## Procedure
The controller can be represented in the following steps.

1. Controller evaluation is triggered for a invocation.
2. Controller gathers required data needed for the evaluation (workflow definition, invocation).
3. Controller submits the invocation to the scheduler for evaluation.
4. Scheduler evaluates the current state of the invocation.
5. Scheduler responds with a set of actions for the controller to undertake.
6. Controller interprets the received actions, and executes them concurrently.
7. The actions (invoking/pausing tasks) result in new events being added
8. The new events of a specific invocation result trigger step 1.
2 changes: 1 addition & 1 deletion build/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
workflow-engine
fission-workflow-bundle
3 changes: 0 additions & 3 deletions build/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion build/build-linux.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
GOOS=linux GOARCH=386 go build github.com/fission/fission-workflow/cmd/workflow-engine/
GOOS=linux GOARCH=386 go build github.com/fission/fission-workflow/cmd/fission-workflow-bundle/
2 changes: 2 additions & 0 deletions build/bundle/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM alpine
ADD fission-workflow-bundle /
14 changes: 9 additions & 5 deletions build/docker.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env bash

set -e
set -x
set -ex

if [ ! -f ./workflow-engine ]; then
echo "Executable './workflow-engine' not found!"
if [ ! -f ./fission-workflow-bundle ]; then
echo "Executable './fission-workflow-bundle' not found!"
exit 1;
fi

docker build --tag="fission/fission-workflow" .
chmod +x fission-workflow-bundle
yes | cp fission-workflow-bundle bundle/
yes | cp fission-workflow-bundle env/

docker build --tag="fission/fission-workflow-bundle" bundle/
docker build --tag="fission/workflow-env" env/
12 changes: 12 additions & 0 deletions build/env/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM alpine

ADD fission-workflow-bundle /

EXPOSE 8888

ENV FNENV_FISSION_CONTROLLER http://controller.fission
ENV FNENV_FISSION_POOLMGR http://poolmgr.fission
ENV ES_NATS_URL nats://nats-streaming:4222
ENV ES_NATS_CLUSTER fissionMQTrigger

ENTRYPOINT ["/fission-workflow-bundle", "--nats", "--fission", "--controller", "--api-http", "--api-workflow-invocation", "--api-workflow", "--api-admin"]
22 changes: 18 additions & 4 deletions build/fission-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,29 @@ spec:
spec:
containers:
- name: workflow-engine
image: fission/fission-workflow
command: ["/workflow-engine"]
image: fission/fission-workflow-bundle
imagePullPolicy: IfNotPresent
command: ["/fission-workflow-bundle"]
args: [
"--nats",
"--fission",
"--controller",
"--api-http",
"--api-workflow-invocation",
"--api-workflow",
"--api-admin",
]
env:
- name: EVENT_STORE_URL
- name: ES_NATS_URL
value: nats://nats-streaming:4222
- name: EVENT_STORE_CLUSTER
- name: ES_NATS_CLUSTER
value: fissionMQTrigger
- name: FNENV_FISSION_POOLMGR
value: http://poolmgr.fission
- name: FNENV_FISSION_CONTROLLER
value: http://controller.fission
---
# TODO Remove this temporary node ports
apiVersion: v1
kind: Service
metadata:
Expand Down
Loading