fission_imported

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuildStatusPending   = "pending"
	BuildStatusRunning   = "running"
	BuildStatusSucceeded = "succeeded"
	BuildStatusFailed    = "failed"
	BuildStatusNone      = "none"
)
View Source
const (
	AllowedFunctionsPerContainerSingle   = "single"
	AllowedFunctionsPerContainerInfinite = "infinite"
)
View Source
const (
	ExecutorTypePoolmgr   = "poolmgr"
	ExecutorTypeNewdeploy = "newdeploy"
)
View Source
const (
	SharedVolumeUserfunc   = "userfunc"
	SharedVolumePackages   = "packages"
	SharedVolumeSecrets    = "secrets"
	SharedVolumeConfigmaps = "configmaps"
)
View Source
const (
	MessageQueueTypeNats = "nats-streaming"
	MessageQueueTypeASQ  = "azure-storage-queue"
)
View Source
const (
	ErrorInternal = iota

	ErrorNotAuthorized
	ErrorNotFound
	ErrorNameExists
	ErrorInvalidArgument
	ErrorNoSpace
	ErrorNotImplmented
	ErrorChecksumFail
	ErrorSizeLimitExceeded
)
View Source
const (
	ArchiveLiteralSizeLimit int64 = 256 * 1024
)
View Source
const EXECUTOR_INSTANCEID_LABEL string = "executorInstanceId"
View Source
const (
	// FunctionReferenceFunctionName means that the function
	// reference is simply by function name.
	FunctionReferenceTypeFunctionName = "name"
)
View Source
const POOLMGR_INSTANCEID_LABEL string = "poolmgrInstanceId"
View Source
const (
	StrategyTypeExecution = "execution"
)

Variables

This section is empty.

Functions

func GetCrdClient

func GetCrdClient(config *rest.Config) (*rest.RESTClient, error)

GetCrdClient gets a CRD client config

func GetKubernetesClient

func GetKubernetesClient() (*rest.Config, *kubernetes.Clientset, *apiextensionsclient.Clientset, error)

Get a kubernetes client using the kubeconfig file at the environment var $KUBECONFIG, or an in-cluster config if that's undefined.

Types

type AllowedFunctionsPerContainer

type AllowedFunctionsPerContainer string

type Archive

type Archive struct {
	// Type defines how the package is specified: literal or URL.
	Type ArchiveType `json:"type,omitempty"`

	// Literal contents of the package. Can be used for
	// encoding packages below TODO (256KB?) size.
	Literal []byte `json:"literal,omitempty"`

	// URL references a package.
	URL string `json:"url,omitempty"`

	// Checksum ensures the integrity of packages
	// refereced by URL. Ignored for literals.
	Checksum Checksum `json:"checksum,omitempty"`
}

Package contains or references a collection of source or binary files.

type ArchiveType

type ArchiveType string

ArchiveType is either literal or URL, indicating whether the package is specified in the Archive struct or externally.

const (
	// ArchiveTypeLiteral means the package contents are specified in the Literal field of
	// resource itself.
	ArchiveTypeLiteral ArchiveType = "literal"

	// ArchiveTypeUrl means the package contents are at the specified URL.
	ArchiveTypeUrl ArchiveType = "url"
)

type BuildStatus

type BuildStatus string

type Builder

type Builder struct {
	// Image for containing the language runtime.
	Image string `json:"image,omitempty"`

	// (Optional) Default build command to run for this build environment.
	Command string `json:"command,omitempty"`

	// Container allows the modification of the deployed builder
	// container using the Kubernetes Container spec. Fission overrides
	// the following fields:
	// - Name
	// - Image; set to the Builder.Image
	// - Command; set to the Builder.Command
	// - TerminationMessagePath
	// - ImagePullPolicy
	// - ReadinessProbe
	// (optional)
	Container *apiv1.Container `json:"container,omitempty"`
}

type Checksum

type Checksum struct {
	Type ChecksumType `json:"type,omitempty"`
	Sum  string       `json:"sum,omitempty"`
}

Checksum of package contents when the contents are stored outside the Package struct. Type is the checksum algorithm; "sha256" is the only currently supported one. Sum is hex encoded.

type ChecksumType

type ChecksumType string

ChecksumType specifies the checksum algorithm, such as sha256, used for a checksum.

const (
	ChecksumTypeSHA256 ChecksumType = "sha256"
)

type ConfigMapReference

type ConfigMapReference struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

type EnvironmentReference

type EnvironmentReference struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

type EnvironmentSpec

type EnvironmentSpec struct {
	// Environment API version
	Version int `json:"version"`

	// Runtime container image etc.; required
	Runtime Runtime `json:"runtime"`

	// Optional
	Builder Builder `json:"builder"`

	// Optional, but strongly encouraged. Used to populate
	// links from UI, CLI, etc.
	DocumentationURL string `json:"documentationurl,omitempty"`

	// Optional, defaults to 'AllowedFunctionsPerContainerSingle'
	AllowedFunctionsPerContainer AllowedFunctionsPerContainer `json:"allowedFunctionsPerContainer,omitempty"`

	// Optional, defaults to 'false'
	AllowAccessToExternalNetwork bool `json:"allowAccessToExternalNetwork,omitempty"`

	// Request and limit resources for the environment
	Resources apiv1.ResourceRequirements `json:"resources"`

	// The initial pool size for environment
	Poolsize int `json:"poolsize,omitempty"`

	// The grace time for pod to perform connection draining before termination. The unit is in seconds.
	// Optional, defaults to 360 seconds
	TerminationGracePeriod int64
}

type Error

type Error struct {
	Code    errorCode `json:"code"`
	Message string    `json:"message"`
}

Errors returned by the Fission API.

type ExecutionStrategy

type ExecutionStrategy struct {
	ExecutorType     ExecutorType
	MinScale         int
	MaxScale         int
	TargetCPUPercent int
}

ExecutionStrategy specifies low-level parameters for function execution,

such as the number of instances.

MinScale affects the cold start behaviour for a function. If MinScale is 0 then the
deployment is created on first invocation of function and is good for requests of
asynchronous nature. If MinScale is greater than 0 then MinScale number of pods are
created at the time of creation of function. This ensures faster response during first
invocation at the cost of consuming resources.

MaxScale is the maximum number of pods that function will scale to based on TargetCPUPercent
and resources allocated to the function pod.

type ExecutorType

type ExecutorType string

ExecutorType is the primary executor for an environment

type FissionClient

type FissionClient interface {
	Functions(ns string) FunctionInterface
}

type Function

type Function struct {
	metav1.TypeMeta `json:",inline"`
	Metadata        metav1.ObjectMeta `json:"metadata"`
	Spec            FunctionSpec      `json:"spec"`
}

Functions.

func (*Function) DeepCopy

func (in *Function) DeepCopy() *Function

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Function.

func (*Function) DeepCopyInto

func (in *Function) DeepCopyInto(out *Function)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Function) DeepCopyObject

func (in *Function) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Function) GetObjectKind

func (f *Function) GetObjectKind() schema.ObjectKind

func (*Function) GetObjectMeta

func (f *Function) GetObjectMeta() metav1.Object

func (*Function) Validate

func (f *Function) Validate() error

type FunctionInterface

type FunctionInterface interface {
	Create(*Function) (*Function, error)
	Get(name string) (*Function, error)
	Update(*Function) (*Function, error)
	Delete(name string, options *metav1.DeleteOptions) error
	List(opts metav1.ListOptions) (*FunctionList, error)
	Watch(opts metav1.ListOptions) (watch.Interface, error)
}

func MakeFunctionInterface

func MakeFunctionInterface(crdClient *rest.RESTClient, namespace string) FunctionInterface

type FunctionList

type FunctionList struct {
	metav1.TypeMeta `json:",inline"`
	Metadata        metav1.ListMeta `json:"metadata"`

	Items []Function `json:"items"`
}

func (*FunctionList) DeepCopy

func (in *FunctionList) DeepCopy() *FunctionList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionList.

func (*FunctionList) DeepCopyInto

func (in *FunctionList) DeepCopyInto(out *FunctionList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*FunctionList) DeepCopyObject

func (in *FunctionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*FunctionList) GetObjectKind

func (fl *FunctionList) GetObjectKind() schema.ObjectKind

func (*FunctionList) Validate

func (fl *FunctionList) Validate() error

type FunctionLoadRequest

type FunctionLoadRequest struct {
	// FilePath is an absolute filesystem path to the
	// function. What exactly is stored here is
	// env-specific. Optional.
	FilePath string `json:"filepath"`

	// FunctionName has an environment-specific meaning;
	// usually, it defines a function within a module
	// containing multiple functions. Optional; default is
	// environment-specific.
	FunctionName string `json:"functionName"`

	// URL to expose this function at. Optional; defaults
	// to "/".
	URL string `json:"url"`

	// Metatdata
	FunctionMetadata *metav1.ObjectMeta
}

Fission-Environment interface. The following types are not exposed in the Fission API, but rather used by Fission to talk to environments.

type FunctionPackageRef

type FunctionPackageRef struct {
	PackageRef PackageRef `json:"packageref"`

	// FunctionName specifies a specific function within the package. This allows
	// functions to share packages, by having different functions within the same
	// package.
	//
	// Fission itself does not interpret this path. It is passed verbatim to
	// build and runtime environments.
	//
	// This is optional: if unspecified, the environment has a default name.
	FunctionName string `json:"functionName,omitempty"`
}

type FunctionReference

type FunctionReference struct {
	// Type indicates whether this function reference is by name or selector. For now,
	// the only supported reference type is by name.  Future reference types:
	//   * Function by label or annotation
	//   * Branch or tag of a versioned function
	//   * A "rolling upgrade" from one version of a function to another
	Type FunctionReferenceType `json:"type"`

	// Name of the function.
	Name string `json:"name"`
}

type FunctionReferenceType

type FunctionReferenceType string

type FunctionSpec

type FunctionSpec struct {
	// Environment is the build and runtime environment that this function is
	// associated with. An Environment with this name should exist, otherwise the
	// function cannot be invoked.
	Environment EnvironmentReference `json:"environment"`

	// Reference to a package containing deployment and optionally the source
	Package FunctionPackageRef `json:"package"`

	Secrets    []SecretReference    `json:"secrets"`
	ConfigMaps []ConfigMapReference `json:"configmaps"`

	// cpu and memory resources as per K8S standards
	Resources apiv1.ResourceRequirements `json:"resources"`

	// InvokeStrategy is a set of controls which affect how function executes
	InvokeStrategy InvokeStrategy
}

FunctionSpec describes the contents of the function.

type HTTPTriggerSpec

type HTTPTriggerSpec struct {
	Host              string            `json:"host"`
	RelativeURL       string            `json:"relativeurl"`
	Method            string            `json:"method"`
	FunctionReference FunctionReference `json:"functionref"`
}

type InvokeStrategy

type InvokeStrategy struct {
	ExecutionStrategy ExecutionStrategy
	StrategyType      StrategyType
}

InvokeStrategy is a set of controls over how the function executes.

It affects the performance and resource usage of the function.

An InvokeStategy is of one of two types: ExecutionStrategy, which controls low-level
parameters such as which ExecutorType to use, when to autoscale, minimum and maximum
number of running instances, etc. A higher-level AbstractInvokeStrategy will also be
supported; this strategy would specify the target request rate of the function,
the target latency statistics, and the target cost (in terms of compute resources).

type KubernetesWatchTriggerSpec

type KubernetesWatchTriggerSpec struct {
	Namespace         string            `json:"namespace"`
	Type              string            `json:"type"`
	LabelSelector     map[string]string `json:"labelselector"`
	FunctionReference FunctionReference `json:"functionref"`
}

type MessageQueueTriggerSpec

type MessageQueueTriggerSpec struct {
	FunctionReference FunctionReference `json:"functionref"`
	MessageQueueType  MessageQueueType  `json:"messageQueueType"`
	Topic             string            `json:"topic"`
	ResponseTopic     string            `json:"respTopic,omitempty"`
	ContentType       string            `json:"contentType"`
}

MessageQueueTriggerSpec defines a binding from a topic in a message queue to a function.

type MessageQueueType

type MessageQueueType string

type PackageRef

type PackageRef struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`

	// Including resource version in the reference forces the function to be updated on
	// package update, making it possible to cache the function based on its metadata.
	ResourceVersion string `json:"resourceversion,omitempty"`
}

type PackageSpec

type PackageSpec struct {
	Environment  EnvironmentReference `json:"environment"`
	Source       Archive              `json:"source,omitempty"`
	Deployment   Archive              `json:"deployment,omitempty"`
	BuildCommand string               `json:"buildcmd,omitempty"`
}

type PackageStatus

type PackageStatus struct {
	BuildStatus BuildStatus `json:"buildstatus,omitempty"`
	BuildLog    string      `json:"buildlog,omitempty"` // output of the build (errors etc)
}

type Runtime

type Runtime struct {
	// Image for containing the language runtime.
	Image string `json:"image"`

	// LoadEndpointPort defines the port on which the
	// server listens for function load
	// requests. Optional; default 8888.
	LoadEndpointPort int32 `json:"loadendpointport"`

	// LoadEndpointPath defines the relative URL on which
	// the server listens for function load
	// requests. Optional; default "/specialize".
	LoadEndpointPath string `json:"loadendpointpath"`

	// FunctionEndpointPort defines the port on which the
	// server listens for function requests. Optional;
	// default 8888.
	FunctionEndpointPort int32 `json:"functionendpointport"`

	// Container allows the modification of the deployed runtime
	// container using the Kubernetes Container spec. Fission overrides
	// the following fields:
	// - Name
	// - Image; set to the Runtime.Image
	// - TerminationMessagePath
	// - ImagePullPolicy
	// (optional)
	Container *apiv1.Container `json:"container,omitempty"`
}

type SecretReference

type SecretReference struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

type StrategyType

type StrategyType string

StrategyType is the strategy to be used for function execution

type TimeTriggerSpec

type TimeTriggerSpec struct {
	Cron              string `json:"cron"`
	FunctionReference `json:"functionref"`
}

TimeTrigger invokes the specific function at a time or times specified by a cron string.

Jump to

Keyboard shortcuts

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