types

package
v0.0.0-...-0677a28 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBoolValue

func ParseBoolValue(val string, fallback bool) bool

ParseBoolValue parses the the boolean in val or, if there is an error, returns the specified default value

func ParseIntOrDurationValue

func ParseIntOrDurationValue(val string, fallback time.Duration) time.Duration

ParseIntOrDurationValue parses the the duration in val or, if there is an error, returns the specified default value

func ParseIntValue

func ParseIntValue(val string, fallback int) int

ParseIntValue parses the the int in val or, if there is an error, returns the specified default value

func ParseString

func ParseString(val string, fallback string) string

ParseString verifies the string in val is not empty. When empty, it returns the specified default value

Types

type FaaSConfig

type FaaSConfig struct {
	// TCPPort is the public port for the API.
	TCPPort *int
	// HTTP timeout for reading a request from clients.
	ReadTimeout time.Duration
	// HTTP timeout for writing a response from functions.
	WriteTimeout time.Duration
	// EnableHealth enables/disables the default health endpoint bound to "/healthz".
	//
	// Deprecated: basic auth is enabled automatcally by setting the HealthHandler in the FaaSHandlers
	// struct.  This value is not longer read or used.
	EnableHealth bool
	// EnableBasicAuth enforces basic auth on the API. If set, reads secrets from file-system
	// location specificed in `SecretMountPath`.
	EnableBasicAuth bool
	// SecretMountPath specifies where to read secrets from for embedded basic auth.
	SecretMountPath string
	// MaxIdleConns with a default value of 1024, can be used for tuning HTTP proxy performance.
	MaxIdleConns int
	// MaxIdleConnsPerHost with a default value of 1024, can be used for tuning HTTP proxy performance.
	MaxIdleConnsPerHost int
}

FaaSConfig set config for HTTP handlers

func (*FaaSConfig) GetMaxIdleConns

func (c *FaaSConfig) GetMaxIdleConns() int

GetMaxIdleConns is a helper to safely return the configured MaxIdleConns or the default value of 1024

func (*FaaSConfig) GetMaxIdleConnsPerHost

func (c *FaaSConfig) GetMaxIdleConnsPerHost() int

GetMaxIdleConns is a helper to safely return the configured MaxIdleConns or the default value which should then match the MaxIdleConns

func (*FaaSConfig) GetReadTimeout

func (c *FaaSConfig) GetReadTimeout() time.Duration

GetReadTimeout is a helper to safely return the configured ReadTimeout or the default value of 10s

type FaaSHandlers

type FaaSHandlers struct {
	// 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

	DeleteHandler  http.HandlerFunc
	ReplicaReader  http.HandlerFunc
	ReplicaUpdater http.HandlerFunc
	SecretHandler  http.HandlerFunc
	// LogHandler provides streaming json logs of functions
	LogHandler http.HandlerFunc

	// UpdateHandler an existing function/service
	UpdateHandler http.HandlerFunc
	// HealthHandler 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
}

FaaSHandlers provide handlers for OpenFaaS

type FunctionDeployment

type FunctionDeployment struct {

	// Service corresponds to a Service
	Service string `json:"service"`

	// Image corresponds to a Docker image
	Image string `json:"image"`

	// Network is specific to Docker Swarm - default overlay network is: func_functions
	Network string `json:"network"`

	// EnvProcess corresponds to the fprocess variable for your container watchdog.
	EnvProcess string `json:"envProcess"`

	// EnvVars provides overrides for functions.
	EnvVars map[string]string `json:"envVars"`

	// RegistryAuth is the registry authentication (optional)
	// in the same encoded format as Docker native credentials
	// (see ~/.docker/config.json)
	RegistryAuth string `json:"registryAuth,omitempty"`

	// Constraints are specific to back-end orchestration platform
	Constraints []string `json:"constraints"`

	// Secrets list of secrets to be made available to function
	Secrets []string `json:"secrets"`

	// Labels are metadata for functions which may be used by the
	// back-end for making scheduling or routing decisions
	Labels *map[string]string `json:"labels"`

	// Annotations are metadata for functions which may be used by the
	// back-end for management, orchestration, events and build tasks
	Annotations *map[string]string `json:"annotations"`

	// Limits for function
	Limits *FunctionResources `json:"limits"`

	// Requests of resources requested by function
	Requests *FunctionResources `json:"requests"`

	// ReadOnlyRootFilesystem removes write-access from the root filesystem
	// mount-point.
	ReadOnlyRootFilesystem bool `json:"readOnlyRootFilesystem"`

	// Namespace for the function to be deployed into
	Namespace string `json:"namespace,omitempty"`
}

FunctionDeployment represents a request to create or update a Function.

type FunctionResources

type FunctionResources struct {
	Memory string `json:"memory"`
	CPU    string `json:"cpu"`
}

FunctionResources Memory and CPU

type FunctionStatus

type FunctionStatus struct {

	// Name corresponds to a Service
	Name string `json:"name"`

	// Image corresponds to a Docker image
	Image string `json:"image"`

	// InvocationCount count of invocations
	InvocationCount float64 `json:"invocationCount"`

	// Replicas desired within the cluster
	Replicas uint64 `json:"replicas"`

	// EnvProcess is the process to pass to the watchdog, if in use
	EnvProcess string `json:"envProcess"`

	// AvailableReplicas is the count of replicas ready to receive
	// invocations as reported by the backend
	AvailableReplicas uint64 `json:"availableReplicas"`

	// Labels are metadata for functions which may be used by the
	// backend for making scheduling or routing decisions
	Labels *map[string]string `json:"labels"`

	// Annotations are metadata for functions which may be used by the
	// backend for management, orchestration, events and build tasks
	Annotations *map[string]string `json:"annotations"`

	// Namespace where the function can be accessed
	Namespace string `json:"namespace,omitempty"`
}

FunctionStatus exported for system/functions endpoint

type HasEnv

type HasEnv interface {
	Getenv(key string) string
}

HasEnv provides interface for os.Getenv

type InfoRequest

type InfoRequest struct {
	Provider      string          `json:"provider"`
	Version       ProviderVersion `json:"version"`
	Orchestration string          `json:"orchestration"`
}

InfoRequest provides information about the underlying provider

type OsEnv

type OsEnv struct {
}

OsEnv implements interface to wrap os.Getenv

func (OsEnv) Getenv

func (OsEnv) Getenv(key string) string

Getenv wraps os.Getenv

type ProviderVersion

type ProviderVersion struct {
	SHA     string `json:"sha"`
	Release string `json:"release"`
}

ProviderVersion provides the commit sha and release version number of the underlying provider

type ReadConfig

type ReadConfig struct {
}

ReadConfig constitutes config from env variables

func (ReadConfig) Read

func (ReadConfig) Read(hasEnv HasEnv) (*FaaSConfig, error)

Read fetches config from environmental variables.

type ScaleServiceRequest

type ScaleServiceRequest struct {
	ServiceName string `json:"serviceName"`
	Replicas    uint64 `json:"replicas"`
}

type Secret

type Secret struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace,omitempty"`
	Value     string `json:"value,omitempty"`
}

Secret for underlying orchestrator

Jump to

Keyboard shortcuts

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