diff --git a/Gopkg.lock b/Gopkg.lock index 88635e47..eef61faa 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -165,7 +165,7 @@ version = "0.9.14" [[projects]] - digest = "1:7442559937743ee9b276449f9237f1eef94df954070fc1f8d49c6325b3685f62" + digest = "1:1139eef7d0247b13271aaed61ed289a01bb4a4ab3b4b30ecba78c727f5e234e8" name = "github.com/openfaas/faas-provider" packages = [ ".", @@ -174,8 +174,8 @@ "types", ] pruneopts = "UT" - revision = "220324e98f5db5aa61f02d1ab13f03e91310796c" - version = "0.8.1" + revision = "6a76a052deb12fd94b373c082963d8a8ad44d4d1" + version = "0.9.0" [[projects]] digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747" diff --git a/Gopkg.toml b/Gopkg.toml index e0904617..028defb0 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -16,7 +16,7 @@ [[constraint]] name = "github.com/openfaas/faas-provider" - version = "0.8.1" + version = "0.9.0" # match docker/distribution revision with moby [[override]] diff --git a/server.go b/server.go index a906d07f..c263789e 100644 --- a/server.go +++ b/server.go @@ -56,7 +56,7 @@ func main() { ReplicaReader: handlers.ReplicaReader(dockerClient), ReplicaUpdater: handlers.ReplicaUpdater(dockerClient), UpdateHandler: handlers.UpdateHandler(dockerClient, maxRestarts, restartDelay), - Health: handlers.Health(), + HealthHandler: handlers.Health(), InfoHandler: handlers.MakeInfoHandler(version.BuildVersion(), version.GitCommit), SecretHandler: handlers.MakeSecretsHandler(dockerClient), } diff --git a/vendor/github.com/openfaas/faas-provider/.gitignore b/vendor/github.com/openfaas/faas-provider/.gitignore index bac5c3e8..c1546d29 100644 --- a/vendor/github.com/openfaas/faas-provider/.gitignore +++ b/vendor/github.com/openfaas/faas-provider/.gitignore @@ -13,4 +13,7 @@ # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 .glide/ +# Goland IDE +.idea + faas-backend diff --git a/vendor/github.com/openfaas/faas-provider/README.md b/vendor/github.com/openfaas/faas-provider/README.md index 691884cd..6d4a42a5 100644 --- a/vendor/github.com/openfaas/faas-provider/README.md +++ b/vendor/github.com/openfaas/faas-provider/README.md @@ -1,23 +1,30 @@ faas-provider ============== -This is a common template or interface for you to start building your own OpenFaaS backend. +This faas-provider can be used to write your own back-end for OpenFaaS. The Golang SDK can be vendored into your project so that you can provide a provider which is compliant and compatible with the OpenFaaS gateway. -Checkout the [backends guide here](https://github.com/openfaas/faas/blob/master/guide/backends.md) before starting. +![Conceptual diagram](docs/conceptual.png) -OpenFaaS projects use the MIT License and are written in Golang. We encourage the same for external / third-party providers. +The faas-provider provides CRUD for functions and an invoke capability. If you complete the required endpoints then you will be able to use your container orchestrator or back-end system with the existing OpenFaaS ecosystem and tooling. -### How to use this code +> See also: [backends guide](https://github.com/openfaas/faas/blob/master/guide/deprecated/backends.md) -We will setup all the standard HTTP routes for you, then start listening on a given TCP port - it should be 8080. +### Recommendations -Just implement the supplied routes. +The following is used in OpenFaaS and recommended for those seeking to build their own back-ends: -For an example checkout the [server.go](https://github.com/openfaas/faas-netes/blob/master/server.go) file in the [faas-netes](https://github.com/openfaas/faas-netes) Kubernetes backend. +* License: MIT +* Language: Golang + +### How to use this project + +All the required HTTP routes are configured automatically including a HTTP server on port 8080. Your task is to implement the supplied HTTP handler functions. + +For an example see the [server.go](https://github.com/openfaas/faas-netes/blob/master/server.go) file in the [faas-netes](https://github.com/openfaas/faas-netes) Kubernetes backend. I.e.: -```golang +```go bootstrapHandlers := bootTypes.FaaSHandlers{ FunctionProxy: handlers.MakeProxy(), DeleteHandler: handlers.MakeDeleteHandler(clientset), @@ -27,6 +34,7 @@ I.e.: ReplicaUpdater: handlers.MakeReplicaUpdater(clientset), InfoHandler: handlers.MakeInfoHandler(), } + var port int port = 8080 bootstrapConfig := bootTypes.FaaSConfig{ @@ -37,3 +45,7 @@ I.e.: bootstrap.Serve(&bootstrapHandlers, &bootstrapConfig) ``` + +### Need help? + +Join `#faas-provider` on [OpenFaaS Slack](https://docs.openfaas.com/community/) diff --git a/vendor/github.com/openfaas/faas-provider/serve.go b/vendor/github.com/openfaas/faas-provider/serve.go index cf50d07e..3a9705d8 100644 --- a/vendor/github.com/openfaas/faas-provider/serve.go +++ b/vendor/github.com/openfaas/faas-provider/serve.go @@ -66,7 +66,7 @@ func Serve(handlers *types.FaaSHandlers, config *types.FaaSConfig) { r.HandleFunc("/function/{name:[-a-zA-Z_0-9]+}/{params:.*}", handlers.FunctionProxy) if config.EnableHealth { - r.HandleFunc("/healthz", handlers.Health).Methods("GET") + r.HandleFunc("/healthz", handlers.HealthHandler).Methods("GET") } readTimeout := config.ReadTimeout diff --git a/vendor/github.com/openfaas/faas-provider/types/config.go b/vendor/github.com/openfaas/faas-provider/types/config.go index fe446d31..75b686ab 100644 --- a/vendor/github.com/openfaas/faas-provider/types/config.go +++ b/vendor/github.com/openfaas/faas-provider/types/config.go @@ -19,7 +19,7 @@ type FaaSHandlers struct { // Optional: Update an existing function UpdateHandler http.HandlerFunc - Health http.HandlerFunc + HealthHandler http.HandlerFunc InfoHandler http.HandlerFunc }