Commit Graph
37 Commits
Author SHA1 Message Date
Ta-Ching ChenandSoam Vasani 380b7d1bcd Use k8s client store to sync functions and triggers for fast synchronization (#382) 2017-11-06 12:58:19 -08:00
Ta-Ching ChenandSoam Vasani 5f14b9b0ae Switch from ThirdPartyResources to CustomResourceDefinitions (#381)
Switch Fission's storage over to the new CustomResourceDefinitions, from the deprecated ThirdPartyResources. This allows us to be compatible with Kubernets 1.8 and onwards.

This also adds a CLI tool for dumping state from an old fission version and restoring state into new CRDs.

The storage service is unaffected by this change.
2017-11-04 14:55:16 -07:00
Ta-Ching ChenandSoam Vasani 439e7d4535 Use Kubernetes informer and cache in router (#376)
Use Kubernetes client's informer and cache to watch functions and triggers in the router. This replaces the polling loop we were using so far.
2017-10-25 15:10:44 -07:00
Ta-Ching ChenandSoam Vasani a25c167d23 Update k8s client version to 4.0.0 (#351)
Move to client-go v4.0.0 from 1.5.
2017-09-29 07:37:36 -07:00
Erwin van EykandSoam Vasani 33f967b61b Fission workflow env integration (#336)
Add a flag to the environment to control multiple specialization -- the max number of functions per container. This can be set to 1 or infinity. 

Add an api proxy to workflow apiserver from the controller.

Add function metadata to FunctionLoadRequest; every v2 environment now knows which function it's loading (but can ignore that information if it wants to).

Add function identity headers to router. This is useful for multiple specialization, so the router can disambiguate between different function calls. (If this turns out to be a non-trivial perf overhead, we could add these headers conditionally, but for now they are always added.)
2017-09-26 18:36:07 -07:00
Soam VasaniandGitHub c63a427ca3 Fix internal route setup bug (#335)
Fixes #334 which broke internal routes, and adds a test.
2017-09-20 06:51:56 -07:00
Ta-Ching ChenandSoam Vasani 9d7bd49338 Use latest function metadata to check cached function service. (#316)
Watch functions in the router and use that to trigger functionReferenceResolver cache invalidation.

We might want to rate-limit syncTriggers in a future change, since we might be triggering it more often than needed.
2017-09-08 13:53:02 -07:00
Soam VasaniandGitHub e238776bf7 V2 types and TPR (#266)
This changes the core fission function, environment and trigger types. It also changes Fission's storage to use ThirdPartyResources.

 - Functions are now specified by packages. Functions can also have both source and deployment packages. A package can be specified by a literal, or by a URL.
 - Environments have a build and runtime component.
 - Triggers reference functions by a FunctionReference. This is a layer of indirection between triggers and functions, and will allow things like incremental function upgrades in future releases.

See Documentation/wip/env-v2.md for design discussion about points 1 and 2.

Changes:

* V2 Types

All types now have a spec, following the pattern of K8s objects.

Functions now have source and deployment packages. A Package can be
specified by literal, or by URL.

Environments now have a builder and runtime component.

All triggers use a new FunctionReference to specify the function. This
for now only uses a function name, but in the future can be extended
to be more flexible.

A new FunctionLoadRequest type is added for specialization requests to
the environment runtime.

* TPR types, TPR init code, and a "fission client"

Implements TPR types using the spec types in fission/types.go.

Adds code for adding creating TPR types, and convenient types for crud
operations on each of our resource types.

Adds code for connecting to K8s API and configuring a REST client with
fission types set up.

* Change old stateful controller into a thin apiserver

This apiserver is now simply a stateless api layer on top of the TPR
types. At the moment it doesn't do anything that couldn't be done by
simply talking to the TPR types. In the future we can have better
validation and potentially some higher level APIs (like versioning for
example) in here.

* Split controller client into files and update for v2 types.

* Update CLI for v2 types.

As far as possible we keep the CLI flags the same. We'll have to add
flags for source/deploy packages and builder/runtime
environments. That will come in the next change.

* Update poolmgr and fetcher for v2 types.

Also adds a poolmgr_test.

* Update router for new types.

Also adds a function reference resolver, which separates out the job
of resolving a FunctionReference to a function.

* Update kubewatcher and timer for v2 types.

* Update Message Queue trigger type for v2 types.

* Minor odds and ends.

* Fission bundle CLI updates

Remove controllerUrl flag, since we don't need it any more.

* Remove etcd deployment (replaced by storing state in TPR)

Also update the poolmgr commandline, and use an env var for the
fetcher image URL.

* Explicit ChecksumType and consts

* Clarify separation of environment interface types
2017-08-05 01:18:30 -07:00
yang qfandSoam Vasani ce4d3ac42d Fix creation of redundant pods on heavy load cold start (#232)
Modifies function specialization so that concurrent requests for the same function cause only one pod to be created.
2017-06-19 18:56:38 -07:00
yang qfandSoam Vasani b1e66663bd Retrieve URL params in functions (#226)
Addresses #158. Adds URL params into HTTP headers. A URL param named `KEY` with the value `VALUE` in the actual URL will appear as the header "X-Fission-Params-KEY: VALUE" in the fission function.
2017-06-17 21:12:12 -07:00
yang qfandSoam Vasani c1dd8a9f35 Aggregate tap service request in interval (#229)
The poolmgr client now aggregates successive tapService() calls and sends them to the poolmgr service every 5 sec, instead of sending them immediately.
2017-06-17 20:58:10 -07:00
Soam Vasani 92cd5334ec Add a default handler for the / route
Before this change, if the user doesn't define a route for /, the
router happily 404s at that path.  This breaks GKE Ingress, which uses
that request as a health check.  So this change adds a handler for
"GET /", unless the user already has one.

Also, log the delay for slow requests.
2017-02-20 23:57:40 -08:00
Soam Vasani 1d4875ff74 Bugfix for internal routes
Poolmgr removed the default-latest-version semantics to simplify
caching.  But this broke the router's internal function routes, which
are used by kubeWatcher.  The router now exposes a versionless url
and regularly updates that to point to the latest version.
2017-01-19 09:27:05 -08:00
Soam Vasani 3ed5e772cf Update test to include method 2017-01-17 22:06:02 -08:00
Soam Vasani 3f02ccaf34 Bug fix for handling a route's HTTP method in router 2017-01-17 18:42:54 -08:00
Soam Vasani fa272f20a0 Update router cache on new function version
Addresses issue #51. Makes versioning in poolmgr explicit, so its
cache needs no invalidation on version update.  Functions in poolmgr
are always cached by name and UID.

Router now updates implictly versioned routes with the latest version
of a function.

This means that users will see requests to implicitly-versioned routes
go to the latest version of a function within 3 seconds.  (Those 3 sec
will go away when we use a real watch instead of polling the
controller.)

There's no change in behaviour for routes that explictly specify a
function UID.
2017-01-05 15:02:16 -08:00
J. Gavin Ray 943d430870 # This is a combination of 2 commits.
# This is the 1st commit message:

Changed package names to match the new organization

# This is the commit message #2:

Forgot Cache
2016-12-24 08:11:35 -08:00
Soam Vasani 4bc7480acd Add request logging to router 2016-12-15 09:33:02 -08:00
Soam Vasani b7906905c2 Make the internal triggers point to the latest version 2016-12-11 19:59:10 -08:00
Soam Vasani 0fb4cc1536 Use latest version of function for watches 2016-12-11 00:07:25 -08:00
Soam Vasani 3a6d5bb070 Add "internal" routes for all functions
These routes allow us to call any function without explicitly defining
a route for them.  TODO: if we can serve these routes from a separate
instance of router (controlled by a commandline flag or env var), we'd
be able to keep this instance of the router "private" by not assigning
it a loadbalancer/nodeport or other externally-visible service.
2016-12-09 23:34:46 -08:00
Soam Vasani 8491aaf7fc Minor router update for cache interface change 2016-11-05 21:42:39 -07:00
Soam Vasani 68f860dcb3 Update unit tests for functionServiceMap change 2016-11-04 23:05:29 -07:00
Soam Vasani a000d4cc32 Update router for cache expiry 2016-11-04 23:05:29 -07:00
Soam Vasani f639bc3558 Use fission.Cache for functionServiceMap 2016-11-04 23:05:29 -07:00
Soam Vasani f3eba4b825 Call poolmgr from router while using a cached service
Poolmgr needs to know usage statistics for a function's pod.  This
change asynchronously taps poolmgr API when router uses a service.
Poolmgr can use this information to control pod expiry.  It may also
be useful later as one of the metrics for autoscaling.
2016-11-04 23:05:29 -07:00
Soam Vasani 59cc772b89 Add retries to router's proxy
Create an implementation of http.RoundTrip which does retries --
RetryingRoundTripper.  K8s services seem to timeout for about ~1-2 sec
after they're created even when the pods being routed to are ready to
serve requests.
2016-11-03 14:59:41 -07:00
Soam Vasani 1b76cdf200 Remove request path when routing
Route all requests to / on the function run container.  It doesn't
need to do any routing since it has only one function.
2016-11-03 10:11:43 -07:00
Soam Vasani 4cd3e65692 Another bug due to initialization/assignment confusion 2016-11-02 22:42:43 -07:00
Soam Vasani af8e5f360f Don't put internal fission error details in responses 2016-11-02 16:07:07 -07:00
Soam Vasani 3ca1191117 Make some router settings configurable; silence noisy logs 2016-11-02 00:28:07 -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 fbd76149f5 Add exports to make router usable as a library 2016-10-29 20:40:41 -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 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 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