handlers

package
v0.0.0-...-917999f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//OrchestrationIdentifier identifier string for provider orchestration
	OrchestrationIdentifier = "kubernetes"
	//ProviderName name of the provider
	ProviderName = "faas-netes-ce"
)
View Source
const MaxFunctions = 15

MaxFunctions licensed for OpenFaaS CE is 15 a license for OpenFaaS Standard is required to increase this limit.

View Source
const MaxReplicas = 5

MaxReplicas licensed for OpenFaaS CE is 5/5 a license for OpenFaaS Standard is required to increase this limit.

Variables

This section is empty.

Functions

func ListNamespaces

func ListNamespaces(defaultNamespace string, clientset kubernetes.Interface) []string

ListNamespaces lists all namespaces annotated with openfaas true

func MakeDeleteHandler

func MakeDeleteHandler(defaultNamespace string, clientset *kubernetes.Clientset) http.HandlerFunc

MakeDeleteHandler delete a function

func MakeDeployHandler

func MakeDeployHandler(functionNamespace string, factory k8s.FunctionFactory, functionList *k8s.FunctionList) http.HandlerFunc

MakeDeployHandler creates a handler to create new functions in the cluster

func MakeFunctionReader

func MakeFunctionReader(defaultNamespace string, deploymentLister v1.DeploymentLister) http.HandlerFunc

MakeFunctionReader handler for reading functions deployed in the cluster as deployments.

func MakeHealthHandler

func MakeHealthHandler() http.HandlerFunc

MakeHealthHandler returns 200/OK when healthy

func MakeInfoHandler

func MakeInfoHandler(version, sha string) http.HandlerFunc

MakeInfoHandler creates handler for /system/info endpoint

func MakeNamespacesLister

func MakeNamespacesLister(defaultNamespace string, clientset kubernetes.Interface) http.HandlerFunc

MakeNamespacesLister builds a list of namespaces with an "openfaas" tag, or the default name

func MakeReplicaReader

func MakeReplicaReader(defaultNamespace string, lister v1.DeploymentLister) http.HandlerFunc

MakeReplicaReader reads the amount of replicas for a deployment

func MakeReplicaUpdater

func MakeReplicaUpdater(defaultNamespace string, clientset *kubernetes.Clientset) http.HandlerFunc

MakeReplicaUpdater updates desired count of replicas

func MakeSecretHandler

func MakeSecretHandler(defaultNamespace string, kube kubernetes.Interface) http.HandlerFunc

MakeSecretHandler makes a handler for Create/List/Delete/Update of secrets in the Kubernetes API

func MakeUpdateHandler

func MakeUpdateHandler(defaultNamespace string, factory k8s.FunctionFactory) http.HandlerFunc

MakeUpdateHandler update specified function

func ProcessErrorReasons

func ProcessErrorReasons(err error) (int, metav1.StatusReason)

ProcessErrorReasons maps k8serrors.ReasonForError to http status codes

func RegisterEventHandlers

func RegisterEventHandlers(deploymentInformer v1apps.DeploymentInformer, kubeClient *kubernetes.Clientset, namespace string)

func ValidateDeployRequest

func ValidateDeployRequest(request *types.FunctionDeployment) error

ValidateDeployRequest validates that the service name is valid for Kubernetes

Types

type NamespaceResolver

type NamespaceResolver func(r *http.Request) (namespace string, err error)

NamespaceResolver is a method that determines the requested namespace corresponding to an HTTP request. It then validates that OpenFaaS is permitted to operate in that the namespace.

func NewNamespaceResolver

func NewNamespaceResolver(defaultNamespace string, kube kubernetes.Interface) NamespaceResolver

NewNamespaceResolver returns a generic namespace resolver that will inspect both the GET query parameters and the request body. It looks for the query param or json key "namespace".

type SecretsHandler

type SecretsHandler struct {
	Secrets         k8s.SecretsClient
	LookupNamespace NamespaceResolver
}

SecretsHandler enabling to create openfaas secrets across namespaces

func (SecretsHandler) ServeHTTP

func (h SecretsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL