mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-18 03:56:35 +00:00
Migrate to containerd v1.7.0 and update dependencies
* Updates containerd to v1.7.0 and new binary for 32-bit Arm OSes. * Updates Go dependencies - openfaas and external Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
9efd019e86
commit
c41c2cd9fc
25
vendor/github.com/openfaas/faas-provider/README.md
generated
vendored
25
vendor/github.com/openfaas/faas-provider/README.md
generated
vendored
@ -7,7 +7,7 @@ This faas-provider can be used to write your own back-end for OpenFaaS. The Gola
|
||||
|
||||
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.
|
||||
|
||||
> See also: [backends guide](https://github.com/openfaas/faas/blob/master/guide/deprecated/backends.md)
|
||||
Read more: [The power of interfaces in OpenFaaS](https://blog.alexellis.io/the-power-of-interfaces-openfaas/)
|
||||
|
||||
### Recommendations
|
||||
|
||||
@ -27,14 +27,18 @@ I.e.:
|
||||
```go
|
||||
timeout := 8 * time.Second
|
||||
bootstrapHandlers := bootTypes.FaaSHandlers{
|
||||
FunctionProxy: handlers.MakeProxy(),
|
||||
DeleteHandler: handlers.MakeDeleteHandler(clientset),
|
||||
DeployHandler: handlers.MakeDeployHandler(clientset),
|
||||
FunctionReader: handlers.MakeFunctionReader(clientset),
|
||||
ReplicaReader: handlers.MakeReplicaReader(clientset),
|
||||
ReplicaUpdater: handlers.MakeReplicaUpdater(clientset),
|
||||
InfoHandler: handlers.MakeInfoHandler(),
|
||||
LogHandler: logs.NewLogHandlerFunc(requestor,timeout),
|
||||
ListNamespaces: handlers.MakeNamespaceLister(),
|
||||
FunctionProxy: handlers.MakeProxyHandler(),
|
||||
FunctionLister: handlers.MakeFunctionLister(),
|
||||
DeployFunction: handlers.MakeDeployFunctionHandler(),
|
||||
DeleteFunction: handlers.MakeDeleteFunctionHandler(),
|
||||
UpdateFunction: handlers.MakeUpdateFunctionHandler(),
|
||||
FunctionStatus: handlers.MakeFunctionStatusHandler(),
|
||||
ScaleFunction: handlers.MakeScaleFunctionHandler(),
|
||||
Secrets: handlers.MakeSecretHandler(),
|
||||
Logs: handlers.MakeLogsHandler(),
|
||||
Info: handlers.MakeInfoHandler(),
|
||||
Health: handlers.MakeHealthHandler(),
|
||||
}
|
||||
|
||||
var port int
|
||||
@ -48,6 +52,3 @@ I.e.:
|
||||
bootstrap.Serve(&bootstrapHandlers, &bootstrapConfig)
|
||||
```
|
||||
|
||||
### Need help?
|
||||
|
||||
Join `#faas-provider` on [OpenFaaS Slack](https://docs.openfaas.com/community/)
|
||||
|
29
vendor/github.com/openfaas/faas-provider/proxy/proxy.go
generated
vendored
29
vendor/github.com/openfaas/faas-provider/proxy/proxy.go
generated
vendored
@ -7,15 +7,16 @@
|
||||
//
|
||||
// openfaas-provider has implemented a standard HTTP HandlerFunc that will handle setting
|
||||
// timeout values, parsing the request path, and copying the request/response correctly.
|
||||
// bootstrapHandlers := bootTypes.FaaSHandlers{
|
||||
// FunctionProxy: proxy.NewHandlerFunc(timeout, resolver),
|
||||
// DeleteHandler: handlers.MakeDeleteHandler(clientset),
|
||||
// DeployHandler: handlers.MakeDeployHandler(clientset),
|
||||
// FunctionReader: handlers.MakeFunctionReader(clientset),
|
||||
// ReplicaReader: handlers.MakeReplicaReader(clientset),
|
||||
// ReplicaUpdater: handlers.MakeReplicaUpdater(clientset),
|
||||
// InfoHandler: handlers.MakeInfoHandler(),
|
||||
// }
|
||||
//
|
||||
// bootstrapHandlers := bootTypes.FaaSHandlers{
|
||||
// FunctionProxy: proxy.NewHandlerFunc(timeout, resolver),
|
||||
// DeleteHandler: handlers.MakeDeleteHandler(clientset),
|
||||
// DeployHandler: handlers.MakeDeployHandler(clientset),
|
||||
// FunctionLister: handlers.MakeFunctionLister(clientset),
|
||||
// ReplicaReader: handlers.MakeReplicaReader(clientset),
|
||||
// ReplicaUpdater: handlers.MakeReplicaUpdater(clientset),
|
||||
// InfoHandler: handlers.MakeInfoHandler(),
|
||||
// }
|
||||
//
|
||||
// proxy.NewHandlerFunc is optional, but does simplify the logic of your provider.
|
||||
package proxy
|
||||
@ -50,11 +51,11 @@ type BaseURLResolver interface {
|
||||
// NewHandlerFunc creates a standard http.HandlerFunc to proxy function requests.
|
||||
// The returned http.HandlerFunc will ensure:
|
||||
//
|
||||
// - proper proxy request timeouts
|
||||
// - proxy requests for GET, POST, PATCH, PUT, and DELETE
|
||||
// - path parsing including support for extracing the function name, sub-paths, and query paremeters
|
||||
// - passing and setting the `X-Forwarded-Host` and `X-Forwarded-For` headers
|
||||
// - logging errors and proxy request timing to stdout
|
||||
// - proper proxy request timeouts
|
||||
// - proxy requests for GET, POST, PATCH, PUT, and DELETE
|
||||
// - path parsing including support for extracing the function name, sub-paths, and query paremeters
|
||||
// - passing and setting the `X-Forwarded-Host` and `X-Forwarded-For` headers
|
||||
// - logging errors and proxy request timing to stdout
|
||||
//
|
||||
// Note that this will panic if `resolver` is nil.
|
||||
func NewHandlerFunc(config types.FaaSConfig, resolver BaseURLResolver) http.HandlerFunc {
|
||||
|
45
vendor/github.com/openfaas/faas-provider/serve.go
generated
vendored
45
vendor/github.com/openfaas/faas-provider/serve.go
generated
vendored
@ -43,39 +43,40 @@ func Serve(handlers *types.FaaSHandlers, config *types.FaaSConfig) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
handlers.FunctionReader = auth.DecorateWithBasicAuth(handlers.FunctionReader, credentials)
|
||||
handlers.DeployHandler = auth.DecorateWithBasicAuth(handlers.DeployHandler, credentials)
|
||||
handlers.DeleteHandler = auth.DecorateWithBasicAuth(handlers.DeleteHandler, credentials)
|
||||
handlers.UpdateHandler = auth.DecorateWithBasicAuth(handlers.UpdateHandler, credentials)
|
||||
handlers.ReplicaReader = auth.DecorateWithBasicAuth(handlers.ReplicaReader, credentials)
|
||||
handlers.ReplicaUpdater = auth.DecorateWithBasicAuth(handlers.ReplicaUpdater, credentials)
|
||||
handlers.InfoHandler = auth.DecorateWithBasicAuth(handlers.InfoHandler, credentials)
|
||||
handlers.SecretHandler = auth.DecorateWithBasicAuth(handlers.SecretHandler, credentials)
|
||||
handlers.LogHandler = auth.DecorateWithBasicAuth(handlers.LogHandler, credentials)
|
||||
handlers.FunctionLister = auth.DecorateWithBasicAuth(handlers.FunctionLister, credentials)
|
||||
handlers.DeployFunction = auth.DecorateWithBasicAuth(handlers.DeployFunction, credentials)
|
||||
handlers.DeleteFunction = auth.DecorateWithBasicAuth(handlers.DeleteFunction, credentials)
|
||||
handlers.UpdateFunction = auth.DecorateWithBasicAuth(handlers.UpdateFunction, credentials)
|
||||
handlers.FunctionStatus = auth.DecorateWithBasicAuth(handlers.FunctionStatus, credentials)
|
||||
handlers.ScaleFunction = auth.DecorateWithBasicAuth(handlers.ScaleFunction, credentials)
|
||||
handlers.Info = auth.DecorateWithBasicAuth(handlers.Info, credentials)
|
||||
handlers.Secrets = auth.DecorateWithBasicAuth(handlers.Secrets, credentials)
|
||||
handlers.Logs = auth.DecorateWithBasicAuth(handlers.Logs, credentials)
|
||||
}
|
||||
|
||||
hm := newHttpMetrics()
|
||||
|
||||
// System (auth) endpoints
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.FunctionReader, "")).Methods(http.MethodGet)
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.DeployHandler, "")).Methods(http.MethodPost)
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.DeleteHandler, "")).Methods(http.MethodDelete)
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.UpdateHandler, "")).Methods(http.MethodPut)
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.FunctionLister, "")).Methods(http.MethodGet)
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.DeployFunction, "")).Methods(http.MethodPost)
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.DeleteFunction, "")).Methods(http.MethodDelete)
|
||||
r.HandleFunc("/system/functions", hm.InstrumentHandler(handlers.UpdateFunction, "")).Methods(http.MethodPut)
|
||||
|
||||
r.HandleFunc("/system/function/{name:["+NameExpression+"]+}",
|
||||
hm.InstrumentHandler(handlers.ReplicaReader, "/system/function")).Methods(http.MethodGet)
|
||||
hm.InstrumentHandler(handlers.FunctionStatus, "/system/function")).Methods(http.MethodGet)
|
||||
r.HandleFunc("/system/scale-function/{name:["+NameExpression+"]+}",
|
||||
hm.InstrumentHandler(handlers.ScaleFunction, "/system/scale-function")).Methods(http.MethodPost)
|
||||
|
||||
hm.InstrumentHandler(handlers.ReplicaUpdater, "/system/scale-function")).Methods(http.MethodPost)
|
||||
r.HandleFunc("/system/info",
|
||||
hm.InstrumentHandler(handlers.InfoHandler, "")).Methods(http.MethodGet)
|
||||
hm.InstrumentHandler(handlers.Info, "")).Methods(http.MethodGet)
|
||||
|
||||
r.HandleFunc("/system/secrets",
|
||||
hm.InstrumentHandler(handlers.SecretHandler, "")).Methods(http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete)
|
||||
r.HandleFunc("/system/logs",
|
||||
hm.InstrumentHandler(handlers.LogHandler, "")).Methods(http.MethodGet)
|
||||
hm.InstrumentHandler(handlers.Secrets, "")).Methods(http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete)
|
||||
|
||||
r.HandleFunc("/system/namespaces", hm.InstrumentHandler(handlers.ListNamespaceHandler, "")).Methods(http.MethodGet)
|
||||
r.HandleFunc("/system/logs",
|
||||
hm.InstrumentHandler(handlers.Logs, "")).Methods(http.MethodGet)
|
||||
|
||||
r.HandleFunc("/system/namespaces", hm.InstrumentHandler(handlers.ListNamespaces, "")).Methods(http.MethodGet)
|
||||
|
||||
proxyHandler := handlers.FunctionProxy
|
||||
|
||||
@ -84,8 +85,8 @@ func Serve(handlers *types.FaaSHandlers, config *types.FaaSConfig) {
|
||||
r.HandleFunc("/function/{name:["+NameExpression+"]+}/", proxyHandler)
|
||||
r.HandleFunc("/function/{name:["+NameExpression+"]+}/{params:.*}", proxyHandler)
|
||||
|
||||
if handlers.HealthHandler != nil {
|
||||
r.HandleFunc("/healthz", handlers.HealthHandler).Methods(http.MethodGet)
|
||||
if handlers.Health != nil {
|
||||
r.HandleFunc("/healthz", handlers.Health).Methods(http.MethodGet)
|
||||
}
|
||||
|
||||
r.HandleFunc("/metrics", promhttp.Handler().ServeHTTP)
|
||||
|
38
vendor/github.com/openfaas/faas-provider/types/config.go
generated
vendored
38
vendor/github.com/openfaas/faas-provider/types/config.go
generated
vendored
@ -12,27 +12,37 @@ const (
|
||||
|
||||
// FaaSHandlers provide handlers for OpenFaaS
|
||||
type FaaSHandlers struct {
|
||||
ListNamespaces http.HandlerFunc
|
||||
|
||||
// FunctionProxy provides the function invocation proxy logic. Use proxy.NewHandlerFunc to
|
||||
// use the standard OpenFaaS proxy implementation or provide completely custom proxy logic.
|
||||
FunctionProxy http.HandlerFunc
|
||||
|
||||
FunctionReader http.HandlerFunc
|
||||
DeployHandler http.HandlerFunc
|
||||
// FunctionLister lists deployed functions within a namespace
|
||||
FunctionLister http.HandlerFunc
|
||||
|
||||
DeleteHandler http.HandlerFunc
|
||||
ReplicaReader http.HandlerFunc
|
||||
ReplicaUpdater http.HandlerFunc
|
||||
SecretHandler http.HandlerFunc
|
||||
// LogHandler provides streaming json logs of functions
|
||||
LogHandler http.HandlerFunc
|
||||
// DeployFunction deploys a function which doesn't exist
|
||||
DeployFunction http.HandlerFunc
|
||||
|
||||
// UpdateHandler an existing function/service
|
||||
UpdateHandler http.HandlerFunc
|
||||
// HealthHandler defines the default health endpoint bound to "/healthz
|
||||
// UpdateFunction updates an existing function
|
||||
UpdateFunction http.HandlerFunc
|
||||
|
||||
DeleteFunction http.HandlerFunc
|
||||
|
||||
FunctionStatus http.HandlerFunc
|
||||
|
||||
ScaleFunction http.HandlerFunc
|
||||
|
||||
Secrets http.HandlerFunc
|
||||
|
||||
// Logs provides streaming json logs of functions
|
||||
Logs http.HandlerFunc
|
||||
|
||||
// Health defines the default health endpoint bound to "/healthz
|
||||
// If the handler is not set, then the "/healthz" path will not be configured
|
||||
HealthHandler http.HandlerFunc
|
||||
InfoHandler http.HandlerFunc
|
||||
ListNamespaceHandler http.HandlerFunc
|
||||
Health http.HandlerFunc
|
||||
|
||||
Info http.HandlerFunc
|
||||
}
|
||||
|
||||
// FaaSConfig set config for HTTP handlers
|
||||
|
Reference in New Issue
Block a user