Large functions: API proxy for storage svc, upload support in the CLI (#304)

This change contains CLI support for uploading large functions to the storage service.

It also adds a reverse proxy into the storage service to the fission API.

The helm chart is not yet updated to actually run the storage service -- that will come in the next change.
This commit is contained in:
Soam Vasani
2017-08-31 15:42:59 -07:00
committed by GitHub
parent 9d1b096bac
commit 8d103fa35b
4 changed files with 115 additions and 35 deletions
+13 -2
View File
@@ -35,7 +35,8 @@ import (
type (
API struct {
fissionClient *tpr.FissionClient
fissionClient *tpr.FissionClient
storageServiceUrl string
}
logDBConfig struct {
@@ -46,7 +47,16 @@ type (
)
func MakeAPI() (*API, error) {
return makeTPRBackedAPI()
api, err := makeTPRBackedAPI()
u := os.Getenv("STORAGE_SERVICE_URL")
if len(u) > 0 {
api.storageServiceUrl = strings.TrimSuffix(u, "/")
} else {
api.storageServiceUrl = "http://storagesvc"
}
return api, err
}
func (api *API) respondWithSuccess(w http.ResponseWriter, resp []byte) {
@@ -149,6 +159,7 @@ func (api *API) Serve(port int) {
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiDelete).Methods("DELETE")
r.HandleFunc("/proxy/{dbType}", api.FunctionLogsApiPost).Methods("POST")
r.HandleFunc("/proxy/storage/v1/archive", api.StorageServiceProxy)
address := fmt.Sprintf(":%v", port)