Update to latest faas-provider

The scale and delete endpoints no-longer accept namespace
via the query string, but through the body.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2023-07-07 09:48:27 +01:00
parent f394b4a2f1
commit c83b649301
41 changed files with 927 additions and 325 deletions

View File

@ -80,10 +80,10 @@ func Serve(handlers *types.FaaSHandlers, config *types.FaaSConfig) {
// Only register the mutate namespace handler if it is defined
if handlers.MutateNamespace != nil {
r.HandleFunc("/system/namespace/{namespace:["+NameExpression+"]+}",
r.HandleFunc("/system/namespace/{name:["+NameExpression+"]*}",
hm.InstrumentHandler(handlers.MutateNamespace, "")).Methods(http.MethodPost, http.MethodDelete, http.MethodPut, http.MethodGet)
} else {
r.HandleFunc("/system/namespace/{namespace:["+NameExpression+"]+}",
r.HandleFunc("/system/namespace/{name:["+NameExpression+"]*}",
hm.InstrumentHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Feature not implemented in this version of OpenFaaS", http.StatusNotImplemented)
}), "")).Methods(http.MethodGet)

View File

@ -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
@ -28,10 +30,9 @@ type VersionInfo struct {
Release string `json:"release"`
}
// FunctionNamespace is required for use with the /system/namespace/NAME endpoint
// for deletions, just pass the namespace field.
// FunctionNamespace is the namespace for a function
type FunctionNamespace struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Annotations map[string]string `json:"annotations,omitempty"`
Labels map[string]string `json:"labels,omitempty"`