Commit Graph
79 Commits
Author SHA1 Message Date
Soam Vasani d124c1331c fission-bundle: executable package for router, controller, poolmgr
fission-bundle is a single binary that can be run as one or more of
the router, controller and poolmgr.  It's built into one docker image
which can then be run with different commands.
2016-11-01 18:37:10 -07:00
Soam VasaniandGitHub c07311d214 Merge pull request #16 from platform9/router-poolmgr
Router integration with poolmgr and controller
2016-11-01 18:29:27 -07:00
Soam Vasani 3d5e52dc3d Router integration with poolmgr and controller
Router uses poolmgr to specialize pods when necessary.

Router uses controller to get the list of triggers to listen for.  For
now this integration is pretty crappy -- we just poll the controller
every few seconds and cache the result.  The right way would be to
have some sort of watch API on the controller and use that.  Or maybe
share access to etcd directly.
2016-11-01 18:22:04 -07:00
Soam Vasani 2b15b726d4 Poolmgr client 2016-11-01 18:14:38 -07:00
Soam Vasani 6e86182e19 Poolmgr API tweaks + convenient Start function 2016-11-01 18:14:23 -07:00
Soam Vasani 1cf531038a fission.Error constructor from http response 2016-11-01 18:11:46 -07:00
Soam Vasani 8b8e8c6539 Trim server url in client init 2016-11-01 18:11:21 -07:00
Soam VasaniandGitHub e49f165ba2 Merge pull request #15 from platform9/poolmgr
Poolmgr -- manage generic containers and their specialization
2016-11-01 02:20:00 -07:00
Soam Vasani 01bfa8b082 Minor changes; remove noisy test logs 2016-11-01 01:32:02 -07:00
Soam Vasani 40dfba1a41 Switch to official Kubernetes Go client -- client-go/1.4
Switch to client-go package instead of pulling the from kubernetes.
Use a versioned client with sensible compatiblity.

This change breaks 'go get'.  For now you have to manually checkout
the 'release-1.4' branch of the client-go package after 'go get'
fetches it.  TODO: use one of the build tools to fix this.
2016-11-01 01:32:02 -07:00
Soam Vasani 7d1058d7be Pool Manager -- manage generic containers and their specialization
GenericPool is a pool of generic containers for an environment.
GenericPoolManager keeps track of all GenericPools, creating them
on-demand.

The pool manager API is simply a "lookup" for the service URL of a
function.  If one exists it is returned immediately; otherwise, a
generic pool is created, and then a pod is specialized from that pool.

poolmgr is designed to run from within the cluster, since it connects
to pod IP addresses directly.

This is a first cut with many pieces missing.

TODO:
* Use versioned kubernetes clients instead of the unversioned one
* Unit tests for GenericPoolMgr; improve unit test for GenericPool;
  test for API.
* Handle cases where a service exists but pod backing it has failed.
* On start up, use existing deployments/pods/services if they exist;
  in other words don't orphan resources on restart.
* Kill idle resources (services, pods, even generic pools)
* Autoscale generic pool (for example, by watching num ready pods)
2016-11-01 01:32:02 -07:00
Soam VasaniandGitHub 0cbd489cbf Merge pull request #14 from platform9/fetcher
Fetcher is a helper for function run containers
2016-11-01 01:31:27 -07:00
Soam Vasani 95e38203a9 Fetcher is a helper for function run containers
Fetcher is a tool to download functions from the controller.  It is
meant to be run in a container in the same pod as the function run
container, with a shared volume.
2016-11-01 01:29:40 -07:00
Soam VasaniandGitHub 9f34fc3dd9 Merge pull request #13 from platform9/cache
Cache -- simple threadsafe map
2016-11-01 01:28:27 -07:00
Soam Vasani 1c32ce19fe Cache -- simple threadsafe map 2016-11-01 01:26:12 -07:00
Soam VasaniandGitHub ac440ac99f Merge pull request #12 from platform9/packaging-etc
Change controller and router exports to make them usable as libraries
2016-10-29 23:48:38 -07:00
Soam Vasani fbd76149f5 Add exports to make router usable as a library 2016-10-29 20:40:41 -07:00
Soam Vasani 83c995e019 Don't crash on user function exceptions 2016-10-29 20:39:41 -07:00
Soam Vasani a93c17548c Add exports that make controller usable 2016-10-29 20:38:50 -07:00
Soam VasaniandGitHub ff3efa3434 Merge pull request #11 from platform9/api-version-urls
Add API version to URLs
2016-09-29 22:33:27 -07:00
Soam Vasani 012a8de1ec Add API version to URLs 2016-09-29 21:41:52 -07:00
Soam VasaniandGitHub 3177c035c6 Merge pull request #10 from platform9/nodejs-improvements
Nodejs improvements
2016-09-24 12:17:54 -07:00
Soam Vasani 5d76ee8894 Remove outdated comment 2016-09-24 12:17:08 -07:00
Soam Vasani 35e3b3b421 Add logging middleware to log requests 2016-09-24 12:14:27 -07:00
Soam Vasani b42f4dee6a Add bodyParser calls for urlencoded and json request content-types 2016-09-24 11:47:01 -07:00
Soam VasaniandGitHub fedc3f76e3 Merge pull request #9 from platform9/function-raw-code-api
Base64 encode the code in json objects.
2016-09-22 01:11:44 -07:00
Soam Vasani 9a65c8a6fb Undo changes to client function obj 2016-09-22 01:11:17 -07:00
Soam Vasani 79fb54820e Base64 encode the code in json objects.
This will make the API easier for clients.  Also add a ?raw=1 flag to
the function GET API, to get just the code of the function.
2016-09-22 01:07:34 -07:00
Soam VasaniandGitHub d836be88da Merge pull request #8 from platform9/controller-environment-api
API for environments
2016-09-21 23:47:35 -07:00
Soam Vasani 6b67bc0a61 API for environments
Environments for functions. For now this is just the image URL for the
function run container. In the future, Environments will also have
build container image URLs, and perhaps parameters to those
containers.

Create/read/update/delete/list. Versioning will be added later. For
now, only the latest update is stored.
2016-09-21 22:29:51 -07:00
Soam VasaniandGitHub 80e73f7f09 Merge pull request #7 from platform9/controller-httptriggerapi
Add HTTP trigger API and client
2016-09-21 17:10:12 -07:00
Soam Vasani f7757bdcc1 Add HTTP trigger API and client
This implemenents create/read/update/delete/list for http triggers.
This isn't quite the final implementation: you can't look up old
versions by UUID since it only stores the latest update.  I'll get to
that later.
2016-09-21 15:56:29 -07:00
Soam Vasani fee2fb1d70 Helper func to connect to etcd 2016-09-20 21:58:53 -07:00
Soam Vasani 16a75c8887 Remove call to the validator function
(This will be better handled in a higher layer.)
2016-09-20 10:51:44 -07:00
Soam VasaniandGitHub d88e9837a3 Merge pull request #5 from platform9/controller
Controller
2016-09-20 00:58:13 -07:00
Soam Vasani 641cae0206 Fission error type 2016-09-20 00:55:31 -07:00
Soam Vasani 39ef1da415 Key methods for Resource types 2016-09-20 00:55:13 -07:00
Soam Vasani f02f58cd12 Controller API unit tests 2016-09-20 00:54:26 -07:00
Soam Vasani 72ff031624 Controller API client.
Just Functions so far.
2016-09-20 00:53:57 -07:00
Soam Vasani 14734f6435 HTTP API for Functions
So far, just Function create/read/update/delete/list.  FunctionApi
glues HTTP request/response to functionStore.
2016-09-20 00:45:13 -07:00
Soam Vasani be16c6a2aa Minor stuff: debug logs, unit test update 2016-09-20 00:44:19 -07:00
Soam Vasani a0cfadbd73 Fix deleteFile (missing deletes for etcd metadata)
Also move resource and serializer interfaces to types.go
2016-09-20 00:25:50 -07:00
Soam Vasani 66854ff286 Add fission.Error type; add JSON annotations 2016-09-20 00:16:15 -07:00
Soam Vasani 7963d7527c Wrap resourceStore for Functions, HTTPTriggers and Environments
FunctionStore uses fileStore for function code and resourceStore for
the Function's metadata.  Environment- and HTTPTrigger- Store are just
thin wrappers on resourceStore.

There is probably a better way to organize this code, maybe with
reflection.
2016-09-20 00:12:21 -07:00
Soam Vasani 94899a88a7 Some sort of generic etcd-backed store
- A generic Resource interface, which is serializable and has
  a key() method to get an identifying key.

- A resourceStore, which has create, read, update, delete and list.
  This wraps etcd key operations and serialization/deserialization in
  a convenient service.  Serialization is provided to the
  resourceStore as a 'serialization' interface.  This can be JSON or
  anything else.

- The resourceStore also has file operations -- this has read, write
  and delete operations.  The general idea is to store metadata in
  etcd and data on the fileStore (which could also be an object store,
  we don't really use any file-specific properties).  Files are also
  versioned -- each writeFile writes to a new UUID and that UUID is
  stored in an etcd in-order list.  readFile can retrieve an arbitrary
  version by UUID, or just get the latest contents.
2016-09-10 01:01:27 -07:00
Soam Vasani 5c336043db Move /src/controller/ to /controller 2016-09-10 01:01:27 -07:00
Soam Vasani 60de12dfce Add delete command to fileStore 2016-09-10 01:01:27 -07:00
Soam Vasani 6ea465c67c Simple single-threaded file store service
Intended for storing function source code.
2016-09-10 01:01:27 -07:00
Soam Vasani 732634b53c Define main resource types
Functions, HTTPTriggers, Metadata, Environment.  Update the router to
use fission.Metadata, not fission.Function, to identify functions.
2016-09-10 00:59:39 -07:00
Soam VasaniandGitHub 405dd6fa0f Merge pull request #6 from platform9/top-level-package
Move some fission structs to top level package
2016-09-09 15:10:09 -07:00
Soam Vasani fb08d98037 Move Function and HTTPTrigger types to top level 'fission' package 2016-09-09 15:04:15 -07:00
Soam Vasani 796a9810a4 Capitalize type names to prepare for moving them to the top level package 2016-09-09 14:39:31 -07:00
Soam VasaniandGitHub 67ce88ebcc Merge pull request #4 from platform9/move-to-root-dir
Move packages to root dir from src/
2016-09-07 14:08:56 -07:00
Soam Vasani 2aa4c58556 Move packages to root dir from src/
This is supposed to work slightly better with go import paths. I think.
2016-09-07 14:07:26 -07:00
Soam VasaniandGitHub 3cd3dc37e1 Merge pull request #3 from platform9/router
Router, initial merge.

This doesn't yet talk to the Controller or PoolManager APIs.
2016-09-07 14:01:46 -07:00
Soam Vasani 993130d36b Router unit test 2016-09-07 14:00:18 -07:00
Soam Vasani b03e7bad2d HTTP trigger set
This is currently:
 1. A list of http triggers
 2. A method to generate a mux router from that list

This will be in the future:
 1. A way to keep the set of triggers up to date, by watching the controller API
 2. A way to update the router when the trigger set changes
2016-09-07 13:41:26 -07:00
Soam Vasani 8c56818e0a apply gofmt 2016-09-01 16:32:32 -07:00
Soam Vasani 2c872642f3 Put it all together 2016-09-01 14:38:47 -07:00
Soam Vasani 865a60110f Rename mutablemux updateRouter method 2016-09-01 14:37:33 -07:00
Soam Vasani 322ca405f6 Verify request success while testing http requests 2016-09-01 14:34:56 -07:00
Soam Vasani 9bd586ce61 Include PoolManager URL in function handler state and initializer 2016-09-01 14:34:33 -07:00
Soam Vasani 53eeff3c44 Build test utils only in 'go test' 2016-08-31 11:00:42 -07:00
Soam Vasani 2b0b2e28ae HTTP Handler for functions
The function handler will be the handler for each http trigger.  It
will look up the function service map to find a service for the
function (and call the pool manager to create a new service if one
doesn't already exist, though this isn't implemented yet).  It'll then
proxy the request to the service.
2016-08-30 16:41:16 -07:00
Soam Vasani a33f4e48e9 Simplify test a bit 2016-08-30 16:40:20 -07:00
Soam Vasani b9b7f9bbfc Function service map: cache parsed URLs instead of strings 2016-08-30 16:39:39 -07:00
Soam Vasani d990a0b9af Function (name, uid) -> service URL map
Concurrency-safe mapping from a function's (name, uid) identifier to a
URL.  This will be used to look up the service URL associated with a
given function.
2016-08-29 15:31:53 -07:00
Soam Vasani 828fa5f88c Fix test shutdown
Mutable mux test occasionally panics because the server is shut down
before the client goroutine.  Fix this by shutting down the client
goroutines before shutting down the server.
2016-08-29 15:30:04 -07:00
Soam Vasani ad961d4f4d Wrapper around mux to allow runtime route changes
We want to be able to update routes without restarting the http
server.  mutableRouter is a very thin wrapper around
github.com/gorilla/mux that enables safely switching to a new mux
router without pausing requests.
2016-08-26 13:50:51 -07:00
Soam VasaniandGitHub a45ec1448c Merge pull request #2 from platform9/nodejs-function-run-container
NodeJS Function Run Container
2016-08-24 13:52:07 -07:00
Soam Vasani 12f6a93352 Test other http verbs: get, put, post, delete, options, trace, head. 2016-08-24 13:49:45 -07:00
Soam Vasani 0ea5e2b05e Remove unused dependency
And we aren't using the 'start' command either.
2016-08-24 13:18:43 -07:00
Soam Vasani 7a316b14e6 Use require instead of eval to load user code 2016-08-24 13:10:35 -07:00
Soam Vasani 337843f5bc Test script bugfix 2016-08-24 13:10:17 -07:00
Soam Vasani 076b57c50a A very rudimentary test script
We should have real tests with mocha/chai etc. Until then, use this
little bash script.
2016-08-24 11:56:49 -07:00
Soam Vasani ef04ff83cb Use const where appropriate.
And log errors to stderr instead of stdout.
2016-08-24 11:55:40 -07:00
Soam Vasani 67be5a7b10 NodeJS Function Run Container
First cut of a function run container for NodeJS. So far, just the
simplest stuff: loads a user function and routes requests to it. The
user function is assumed to be in a file at a provided location. The
fission runtime is expected to place the file there securely (exactly
how we'll do that is TBD).

Doesn't handle path template params, query strings, etc. Will also
need to be extended later with some sort of hook for graceful
shutdown.
2016-08-23 17:23:20 -07:00
Soam Vasani 206a8c262e Initial docs commit 2016-08-18 21:37:52 -07:00
Soam Vasani 90c14cfa08 Create master branch 2016-08-18 21:35:42 -07:00