functionconfig

package
v0.0.0-...-f7ae98d Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIngressesFromTriggers

func GetIngressesFromTriggers(triggers map[string]Trigger) map[string]Ingress

GetIngressesFromTriggers returns all ingresses from a map of triggers

func GetTriggersByKind

func GetTriggersByKind(triggers map[string]Trigger, kind string) map[string]Trigger

GetTriggersByKind returns a map of triggers by their kind

func ParseHandler

func ParseHandler(handler string) (string, string, error)

Types

type Build

type Build struct {
	Path                string                 `json:"path,omitempty"`
	FunctionSourceCode  string                 `json:"functionSourceCode,omitempty"`
	FunctionConfigPath  string                 `json:"functionConfigPath,omitempty"`
	TempDir             string                 `json:"tempDir,omitempty"`
	Registry            string                 `json:"registry,omitempty"`
	Image               string                 `json:"image,omitempty"`
	NoBaseImagesPull    bool                   `json:"noBaseImagesPull,omitempty"`
	NoCache             bool                   `json:"noCache,omitempty"`
	NoCleanup           bool                   `json:"noCleanup,omitempty"`
	BaseImage           string                 `json:"baseImage,omitempty"`
	Commands            []string               `json:"commands,omitempty"`
	Directives          map[string][]Directive `json:"directives,omitempty"`
	ScriptPaths         []string               `json:"scriptPaths,omitempty"`
	AddedObjectPaths    map[string]string      `json:"addedPaths,omitempty"`
	Dependencies        []string               `json:"dependencies,omitempty"`
	OnbuildImage        string                 `json:"onbuildImage,omitempty"`
	Offline             bool                   `json:"offline,omitempty"`
	RuntimeAttributes   map[string]interface{} `json:"runtimeAttributes,omitempty"`
	CodeEntryType       string                 `json:"codeEntryType,omitempty"`
	CodeEntryAttributes map[string]interface{} `json:"codeEntryAttributes,omitempty"`
	Timestamp           int64                  `json:"timestamp,omitempty"`
	Mode                BuildMode              `json:"mode,omitempty"`
}

Build holds all configuration parameters related to building a function

type BuildMode

type BuildMode string
const (
	NeverBuild  BuildMode = "neverBuild"
	AlwaysBuild BuildMode = "alwaysBuild"
)

type Checkpoint

type Checkpoint *string

Checkpoint is a partition checkpoint

type Config

type Config struct {
	Meta Meta `json:"metadata,omitempty"`
	Spec Spec `json:"spec,omitempty"`
}

Config holds the configuration of a function - meta and spec

func NewConfig

func NewConfig() *Config

NewConfig creates a new configuration structure

type ConfigWithStatus

type ConfigWithStatus struct {
	Config
	Status Status `json:"status,omitempty"`
}

ConfigWithStatus holds the config and status of a function

type DataBinding

type DataBinding struct {
	Name       string                 `json:"name,omitempty"`
	Class      string                 `json:"class"`
	Kind       string                 `json:"kind"`
	URL        string                 `json:"url"`
	Path       string                 `json:"path,omitempty"`
	Query      string                 `json:"query,omitempty"`
	Secret     string                 `json:"secret,omitempty"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

DataBinding holds configuration for a databinding

type Directive

type Directive struct {
	Kind  string `json:"kind,omitempty"`
	Value string `json:"value,omitempty"`
}

Directive is injected into the image file (e.g. Dockerfile) generated during build

type FunctionState

type FunctionState string
const (
	FunctionStateWaitingForBuild                 FunctionState = "waitingForBuild"
	FunctionStateBuilding                        FunctionState = "building"
	FunctionStateWaitingForResourceConfiguration FunctionState = "waitingForResourceConfiguration"
	FunctionStateConfiguringResources            FunctionState = "configuringResources"
	FunctionStateReady                           FunctionState = "ready"
	FunctionStateError                           FunctionState = "error"
)

type Ingress

type Ingress struct {
	Host  string   `json:"host,omitempty"`
	Paths []string `json:"paths,omitempty"`
}

Ingress holds configuration for an ingress - an entity that can route HTTP requests to the function

type LoggerSink

type LoggerSink struct {
	Level string `json:"level,omitempty"`
	Sink  string `json:"sink,omitempty"`
}

LoggerSink overrides the default platform configuration for function loggers

type Meta

type Meta struct {
	Name        string            `json:"name,omitempty"`
	Namespace   string            `json:"namespace,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

Meta identifies a function

func (*Meta) GetUniqueID

func (m *Meta) GetUniqueID() string

type Partition

type Partition struct {
	ID         string     `json:"id"`
	Checkpoint Checkpoint `json:"checkpoint,omitempty"`
}

Partition is a partition information

type Platform

type Platform struct {
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

Platform holds platform specific attributes

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(parentLogger logger.Logger) (*Reader, error)

func (*Reader) Read

func (r *Reader) Read(reader io.Reader, configType string, config *Config) error

type Spec

type Spec struct {
	Description             string                  `json:"description,omitempty"`
	Disabled                bool                    `json:"disable,omitempty"`
	Publish                 bool                    `json:"publish,omitempty"`
	Handler                 string                  `json:"handler,omitempty"`
	Runtime                 string                  `json:"runtime,omitempty"`
	Env                     []v1.EnvVar             `json:"env,omitempty"`
	Resources               v1.ResourceRequirements `json:"resources,omitempty"`
	Image                   string                  `json:"image,omitempty"`
	ImageHash               string                  `json:"imageHash,omitempty"`
	Replicas                int                     `json:"replicas,omitempty"`
	MinReplicas             int                     `json:"minReplicas,omitempty"`
	MaxReplicas             int                     `json:"maxReplicas,omitempty"`
	TargetCPU               int                     `json:"targetCPU,omitempty"`
	DataBindings            map[string]DataBinding  `json:"dataBindings,omitempty"`
	Triggers                map[string]Trigger      `json:"triggers,omitempty"`
	Volumes                 []Volume                `json:"volumes,omitempty"`
	Version                 int                     `json:"version,omitempty"`
	Alias                   string                  `json:"alias,omitempty"`
	Build                   Build                   `json:"build,omitempty"`
	RunRegistry             string                  `json:"runRegistry,omitempty"`
	RuntimeAttributes       map[string]interface{}  `json:"runtimeAttributes,omitempty"`
	LoggerSinks             []LoggerSink            `json:"loggerSinks,omitempty"`
	DealerURI               string                  `json:"dealerURI,omitempty"`
	Platform                Platform                `json:"platform,omitempty"`
	ReadinessTimeoutSeconds int                     `json:"readinessTimeoutSeconds,omitempty"`
	Avatar                  string                  `json:"avatar,omitempty"`
}

Spec holds all parameters related to a function's configuration

func (*Spec) DeepCopyInto

func (s *Spec) DeepCopyInto(out *Spec)

to appease k8s

func (*Spec) GetHTTPPort

func (s *Spec) GetHTTPPort() int

func (*Spec) GetRuntimeNameAndVersion

func (s *Spec) GetRuntimeNameAndVersion() (string, string)

type Status

type Status struct {
	State    FunctionState            `json:"state,omitempty"`
	Message  string                   `json:"message,omitempty"`
	Logs     []map[string]interface{} `json:"logs,omitempty"`
	HTTPPort int                      `json:"httpPort,omitempty"`
}

Status holds the status of the function

func (*Status) DeepCopyInto

func (s *Status) DeepCopyInto(out *Status)

to appease k8s

type Trigger

type Trigger struct {
	Class                                 string            `json:"class"`
	Kind                                  string            `json:"kind"`
	Disabled                              bool              `json:"disabled,omitempty"`
	MaxWorkers                            int               `json:"maxWorkers,omitempty"`
	URL                                   string            `json:"url,omitempty"`
	Paths                                 []string          `json:"paths,omitempty"`
	Username                              string            `json:"username,omitempty"`
	Password                              string            `json:"password,omitempty"`
	Secret                                string            `json:"secret,omitempty"`
	Partitions                            []Partition       `json:"partitions,omitempty"`
	Annotations                           map[string]string `json:"annotations,omitempty"`
	WorkerAvailabilityTimeoutMilliseconds int               `json:"workerAvailabilityTimeoutMilliseconds,omitempty"`
	WorkerAllocatorName                   string            `json:"workerAllocatorName,omitempty"`

	// Dealer Information
	TotalTasks        int `json:"total_tasks,omitempty"`
	MaxTaskAllocation int `json:"max_task_allocation,omitempty"`

	// General attributes
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

Trigger holds configuration for a trigger

type Volume

type Volume struct {
	Volume      v1.Volume      `json:"volume,omitempty"`
	VolumeMount v1.VolumeMount `json:"volumeMount,omitempty"`
}

VolumeAndMount stores simple volume and mount

Jump to

Keyboard shortcuts

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