mirror of
https://github.com/openfaas/faas.git
synced 2025-06-23 23:33:25 +00:00
Migrate to latest faas-provider version
Adds CRUD for namespaces and moves namespace for delete/ scale to the body from the query string. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
43
gateway/vendor/github.com/openfaas/faas-provider/types/config.go
generated
vendored
43
gateway/vendor/github.com/openfaas/faas-provider/types/config.go
generated
vendored
@ -12,27 +12,42 @@ const (
|
||||
|
||||
// FaaSHandlers provide handlers for OpenFaaS
|
||||
type FaaSHandlers struct {
|
||||
// ListNamespace lists namespaces which are annotated for OpenFaaS
|
||||
ListNamespaces http.HandlerFunc
|
||||
|
||||
// MutateNamespace mutates a namespace to be annotated for OpenFaaS
|
||||
// each namespace must contain an annotation of "openfaas=1"
|
||||
MutateNamespace 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
|
||||
|
21
gateway/vendor/github.com/openfaas/faas-provider/types/read_config.go
generated
vendored
21
gateway/vendor/github.com/openfaas/faas-provider/types/read_config.go
generated
vendored
@ -1,6 +1,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
@ -55,6 +56,26 @@ func ParseIntOrDurationValue(val string, fallback time.Duration) time.Duration {
|
||||
return duration
|
||||
}
|
||||
|
||||
// ParseIntOrDurationValue interprets a string representing an int or duration and returns
|
||||
// an int as the number of seconds. An error is returned if val can not be parsed as int or duration.
|
||||
func ParseIntOrDuration(val string) (int, error) {
|
||||
i, err := strconv.ParseInt(val, 10, 0)
|
||||
if err == nil {
|
||||
return int(i), nil
|
||||
}
|
||||
|
||||
if err != nil && errors.Is(err, strconv.ErrRange) {
|
||||
return int(i), err
|
||||
}
|
||||
|
||||
d, err := time.ParseDuration(val)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return int(d.Seconds()), nil
|
||||
}
|
||||
|
||||
// ParseBoolValue parses the the boolean in val or, if there is an error, returns the
|
||||
// specified default value
|
||||
func ParseBoolValue(val string, fallback bool) bool {
|
||||
|
12
gateway/vendor/github.com/openfaas/faas-provider/types/requests.go
generated
vendored
12
gateway/vendor/github.com/openfaas/faas-provider/types/requests.go
generated
vendored
@ -3,15 +3,17 @@
|
||||
|
||||
package types
|
||||
|
||||
// ScaleServiceRequest scales the service to the requested replcia count.
|
||||
// ScaleServiceRequest scales the service to the requested replica count.
|
||||
type ScaleServiceRequest struct {
|
||||
ServiceName string `json:"serviceName"`
|
||||
Replicas uint64 `json:"replicas"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteFunctionRequest delete a deployed function
|
||||
type DeleteFunctionRequest struct {
|
||||
FunctionName string `json:"functionName"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// ProviderInfo provides information about the configured provider
|
||||
@ -27,3 +29,11 @@ type VersionInfo struct {
|
||||
SHA string `json:"sha"`
|
||||
Release string `json:"release"`
|
||||
}
|
||||
|
||||
// FunctionNamespace is the namespace for a function
|
||||
type FunctionNamespace struct {
|
||||
Name string `json:"name"`
|
||||
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user