v1alpha1

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the serverless v1alpha1 API group +kubebuilder:object:generate=true +groupName=serverless.tass.io

Index

Constants

This section is empty.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "serverless.tass.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type Comparison added in v0.1.13

type Comparison string

Comparison is used to compare with the flow result Comparison can be string, int or bool TODO: Validation needed

type Condition

type Condition struct {
	// Name is the name of a Condition, it's unique in a Condition group
	Name string `json:"name"`
	// Type is the data type that Tass workflow condition support
	// It also implicitly shows the result type of the flow
	// Valid values are:
	// - string: The condition type is string
	// - int: The condition type is int
	// - bool: The condition type is boolean
	Type ConditionType `json:"type"`
	// Operator defines the illegal operation in workflow condition statement
	// Valid values are:
	// - eq: The result is equal to the target
	// - ne: The result is not equal to the target
	// - lt: The result is less than the target
	// - le: The result is less than or equal to the target
	// - gt: The result is greater than the target
	// - ge: The result is greater than or equal to the target.
	Operator OperatorType `json:"operator"`
	// Target shows the specific data that the flow result uses to compare with
	// The result of the flow can be a simple type like string, bool or int
	// But it can also be a complex object contains some fileds
	// Whatever the result is, the Flow runtime will wrap the result to a JSON object
	// to unifiy the transmission process.
	// For example, the result of the user code is a string type, let's say "tass",
	// and then it will be wrapped as a JSON object {"$": "tass"} as the result of the Flow.
	//
	// If the result of user code is not a simple type, it can be much more complex
	// For example, the Flow result can be {"$":{"name": "tass","type": "faas"}}
	// So in this case, if we want to use the "type" property
	// to compare with Comparison, the Target value should be "$.type"
	//
	// If users don't specify the Target field,or the Target value is just "$",
	// it means the user code result is just a simple type
	// Otherwise, the user must provide a Target value to claim the property to use
	// One more example to show how to get the key in Flow result
	// Let's say the result is {"$":{"name":"tass","info":{"type":"fn","timeout":60}}}
	// We want the "timeout" key, so the Target value is "$.info.timeout"
	Target string `json:"target,omitempty"`
	// Comparison is used to compare with the flow result
	// Comparison can be a realistic value, like "cash", "5", "true"
	// it can also be a property of the flow result, like "$.b"
	Comparison Comparison `json:"comparison"`
	// Destination defines the downstream Flows based on the condition result
	Destination Destination `json:"destination"`
}

Condition is the control logic of the flow A sample of Condition ```yaml condition:

 name: root
 type: int
 operator: gt
 target: $.a
 comparison: 50
 destination:
	 isTrue:  # ...
	 isFalse: # ...

``` It is same as:

if $.a >= 50 {
	 goto isTrue logic
} else {
	 goto isFalse logic
}

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

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

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

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

type ConditionType

type ConditionType string

ConditionType is the data type that Tass workflow condition support +kubebuilder:validation:Enum=string;int;bool

const (
	// String means the condition type is string
	String ConditionType = "string"
	// Int means the condition type is int
	Int ConditionType = "int"
	// Bool means the condition type is boolean
	Bool ConditionType = "bool"
)

type Destination

type Destination struct {
	// IsTrue defines the downstream Flows if the condition is satisfied
	// +optional
	IsTrue Next `json:"isTrue,omitempty"`
	// IsFalse defines the downstream Flows if the condition is not satisfied
	// +optional
	IsFalse Next `json:"isFalse,omitempty"`
}

Destination defines the downstream Flows based on the condition result When a Flow finishes its task, the result of the Flow goes to the downstream Flows After passing a Condition, the Flows where result goes is determinated by Destination field The result can go to the downstream Flows directly, or it needs a new round of Conditions, or both. Here is a sample of Destination: ```yaml destination:

 isTrue:
 	 flows:
 	 - flow-a       # this is a Flow Name
	 - flow-b
 isFalse:
 	 conditions:
   - condition-a  # this is a Condition name

func (*Destination) DeepCopy

func (in *Destination) DeepCopy() *Destination

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

func (*Destination) DeepCopyInto

func (in *Destination) DeepCopyInto(out *Destination)

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

type Environment

type Environment string

Environment defines the language environments that tass supports +kubebuilder:validation:Enum=Golang;Python;JavaScript

const (
	// Golang means the language environment is Golang
	Golang Environment = "Golang"
	// Python means the language environment is Python
	Python Environment = "Python"
	// JavaScript means the language environment is JavaScript
	JavaScript Environment = "JavaScript"
)

type Flow

type Flow struct {
	// Name is the name of the flow which is unique in a workflow.
	// A function may be called multiple times in different places in a workflow.
	// So we need a Flow name to clear the logic.
	Name string `json:"name"`
	// Function is the function name which has been defined in Tass
	Function string `json:"function"`
	// Outputs specify where the result of this flow should go
	// +optional
	Outputs []string `json:"outputs"`
	// Statement shows the flow control logic type
	// Valid values are:
	// - direct: The result of the flow go to downstream directly;
	// - switch: The result of the flow go to downstream based on the switch condition;
	Statement Statement `json:"statement"`
	// Role is the role of the Flow
	// Valid values are:
	// - start: The role of the Flow is "start" which means it is the entrance of workflow instance
	// - end: The role of the Flow is "end" which means it is the exit point of workflow instance
	// - orphan: The role of the Flow is "orphan" which is a special case that
	// the workflow instance has only one function
	// If no value is specified, it means this is an intermediate Flow instance
	// +optional
	Role Role `json:"role,omitempty"`

	// Conditions are the control logic group of the flow
	// The first element of the Conditions is the root control logic
	// Only worked when the Statement is 'Switch'
	// +optional
	Conditions []*Condition `json:"conditions,omitempty"`
}

Flow defines the logic of a Function in a workflow

func (*Flow) DeepCopy

func (in *Flow) DeepCopy() *Flow

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

func (*Flow) DeepCopyInto

func (in *Flow) DeepCopyInto(out *Flow)

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

type Function

type Function struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   FunctionSpec   `json:"spec,omitempty"`
	Status FunctionStatus `json:"status,omitempty"`
}

Function is the Schema for the functions API

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.

type FunctionList

type FunctionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Function `json:"items"`
}

FunctionList contains a list of Function

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.

type FunctionSpec

type FunctionSpec struct {
	// Environment represents the language environment of the code segments
	// The scheduler wil then launch the corresponding language environment
	Environment Environment `json:"environment"`
	// Resource claims the resource provisioning for Function process
	// It now contains cpu and memory
	Resource Resource `json:"resource"`
}

FunctionSpec defines the desired state of Function

func (*FunctionSpec) DeepCopy

func (in *FunctionSpec) DeepCopy() *FunctionSpec

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

func (*FunctionSpec) DeepCopyInto

func (in *FunctionSpec) DeepCopyInto(out *FunctionSpec)

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

type FunctionStatus

type FunctionStatus struct {
}

FunctionStatus defines the observed state of Function

func (*FunctionStatus) DeepCopy

func (in *FunctionStatus) DeepCopy() *FunctionStatus

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

func (*FunctionStatus) DeepCopyInto

func (in *FunctionStatus) DeepCopyInto(out *FunctionStatus)

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

type Instance

type Instance struct {
	// Status describes metadata a Pod has
	// +optional
	Status *InstanceStatus `json:"status,omitempty"`
	// ProcessRuntimes is a list of ProcessRuntime
	// +optional
	ProcessRuntimes ProcessRuntimes `json:"processRuntimes,omitempty"`
}

Instance records some runtime info of a Pod Specificly, it contains info about Function in the Pod and Pod metadata

func (*Instance) DeepCopy

func (in *Instance) DeepCopy() *Instance

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

func (*Instance) DeepCopyInto

func (in *Instance) DeepCopyInto(out *Instance)

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

type InstanceStatus

type InstanceStatus struct {
	// IP address of the host to which the pod is assigned. Empty if not yet scheduled.
	HostIP *string `json:"hostIP,omitempty"`
	// IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.
	PodIP *string `json:"podIP,omitempty"`
}

InstanceStatus describes metadata a Pod has

func (*InstanceStatus) DeepCopy

func (in *InstanceStatus) DeepCopy() *InstanceStatus

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

func (*InstanceStatus) DeepCopyInto

func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus)

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

type Instances

type Instances map[string]Instance

Instances is a Pod List that WorkflowRuntime manages When the Deployment created or updated, Instances should be updated The key is the name of the Pod, for example "sample-c65c4f67-skbml"

func (Instances) DeepCopy

func (in Instances) DeepCopy() Instances

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

func (Instances) DeepCopyInto

func (in Instances) DeepCopyInto(out *Instances)

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

type Next

type Next struct {
	// Flows lists the Flows where the result of the current Flow goes
	// +optional
	Flows []string `json:"flows,omitempty"`
	// Condition lists the Condition where the result of the current Flow goes
	// It means that the result needs more control logic check
	// +optional
	Conditions []string `json:"conditions,omitempty"`
}

Next shows the next Condition or Flows the data goes

func (*Next) DeepCopy

func (in *Next) DeepCopy() *Next

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

func (*Next) DeepCopyInto

func (in *Next) DeepCopyInto(out *Next)

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

type OperatorType

type OperatorType string

OperatorType defines the illegal operation in workflow condition statement +kubebuilder:validation:Enum=eq;ne;lt;le;gt;ge

const (
	// Eq means the result is equal to the target
	Eq OperatorType = "eq"
	// Ne means the result is not equal to the target
	Ne OperatorType = "ne"
	// Lt means the result is less than the target, bool not accept
	Lt OperatorType = "lt"
	// Le means the result is less than or equal to the target, bool not accept
	Le OperatorType = "le"
	// Gt means the result is greater than the target, bool not accept
	Gt OperatorType = "gt"
	// Ge means the result is greater than or equal to the target, bool not accept
	Ge OperatorType = "ge"
)

type ProcessRuntime

type ProcessRuntime struct {
	// Number is the number of the processes running the same Function
	Number int `json:"number"`
}

ProcessRuntime records the process runtime info

func (*ProcessRuntime) DeepCopy

func (in *ProcessRuntime) DeepCopy() *ProcessRuntime

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

func (*ProcessRuntime) DeepCopyInto

func (in *ProcessRuntime) DeepCopyInto(out *ProcessRuntime)

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

type ProcessRuntimes

type ProcessRuntimes map[string]ProcessRuntime

ProcessRuntimes is a list of ProcessRuntime The key is the name of the Function which is running in the Pod

func (ProcessRuntimes) DeepCopy

func (in ProcessRuntimes) DeepCopy() ProcessRuntimes

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

func (ProcessRuntimes) DeepCopyInto

func (in ProcessRuntimes) DeepCopyInto(out *ProcessRuntimes)

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

type Resource

type Resource struct {
	// CPU, in cores. (500m = .5 cores)
	ResourceCPU string `json:"cpu"`
	// Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
	ResourceMemory string `json:"memory"`
}

Resource claims the resource provisioning for Function process

func (*Resource) DeepCopy

func (in *Resource) DeepCopy() *Resource

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

func (*Resource) DeepCopyInto

func (in *Resource) DeepCopyInto(out *Resource)

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

type Role

type Role string

Role is the role of the Flow +kubebuilder:validation:Enum=start;end;orphan

const (
	// Start means the role of the Flow is "start" which means it is the entrance of workflow instance
	Start Role = "start"
	// End means the role of the Flow is "end" which means it is the exit point of workflow instance
	End Role = "end"
	// Orphan means the role of the Flow is "orphan" which is a special case that
	// the workflow instance has only one function
	Orphan Role = "orphan"
)

type Statement

type Statement string

Statement shows the flow control logic type +kubebuilder:validation:Enum=direct;switch

const (
	// Direct is the result of the flow go to downstream directly
	Direct Statement = "direct"
	// Switch is the result of the flow go to downstream based on the switch condition;
	Switch Statement = "switch"
)

type WfrtStatus added in v0.1.9

type WfrtStatus struct {
	// Instances is a Pod List that WorkflowRuntime Manages
	// +optional
	Instances Instances `json:"instances,omitempty"`
}

WfrtStatus defines the observed state of WorkflowRuntime Now put this field into Spec to patch the status

func (*WfrtStatus) DeepCopy added in v0.1.9

func (in *WfrtStatus) DeepCopy() *WfrtStatus

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

func (*WfrtStatus) DeepCopyInto added in v0.1.9

func (in *WfrtStatus) DeepCopyInto(out *WfrtStatus)

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

type Workflow

type Workflow struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   WorkflowSpec   `json:"spec,omitempty"`
	Status WorkflowStatus `json:"status,omitempty"`
}

Workflow is the Schema for the workflows API

func (*Workflow) DeepCopy

func (in *Workflow) DeepCopy() *Workflow

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

func (*Workflow) DeepCopyInto

func (in *Workflow) DeepCopyInto(out *Workflow)

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

func (*Workflow) DeepCopyObject

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

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

type WorkflowList

type WorkflowList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Workflow `json:"items"`
}

WorkflowList contains a list of Workflow

func (*WorkflowList) DeepCopy

func (in *WorkflowList) DeepCopy() *WorkflowList

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

func (*WorkflowList) DeepCopyInto

func (in *WorkflowList) DeepCopyInto(out *WorkflowList)

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

func (*WorkflowList) DeepCopyObject

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

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

type WorkflowRuntime

type WorkflowRuntime struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec *WorkflowRuntimeSpec `json:"spec,omitempty"`
	// +optional
	Status WorkflowRuntimeStatus `json:"status,omitempty"`
}

WorkflowRuntime is the Schema for the workflowruntimes API

func (*WorkflowRuntime) DeepCopy

func (in *WorkflowRuntime) DeepCopy() *WorkflowRuntime

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

func (*WorkflowRuntime) DeepCopyInto

func (in *WorkflowRuntime) DeepCopyInto(out *WorkflowRuntime)

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

func (*WorkflowRuntime) DeepCopyObject

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

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

type WorkflowRuntimeList

type WorkflowRuntimeList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []WorkflowRuntime `json:"items"`
}

WorkflowRuntimeList contains a list of WorkflowRuntime

func (*WorkflowRuntimeList) DeepCopy

func (in *WorkflowRuntimeList) DeepCopy() *WorkflowRuntimeList

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

func (*WorkflowRuntimeList) DeepCopyInto

func (in *WorkflowRuntimeList) DeepCopyInto(out *WorkflowRuntimeList)

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

func (*WorkflowRuntimeList) DeepCopyObject

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

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

type WorkflowRuntimeSpec

type WorkflowRuntimeSpec struct {

	// Replicas defines the replication of the workflow runtime
	// Specificly, it determines the replication of Pods in its Deployment
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// FIXME: Here we add status in Spec, logically put them into Status are resonable
	// However, we don't find a solution of patching the Status by client side
	// so we put all the status in Spec temporarily, maybe fix it future
	// +optional
	Status WfrtStatus `json:"status,omitempty"`
}

WorkflowRuntimeSpec defines the desired state of WorkflowRuntime

func (*WorkflowRuntimeSpec) DeepCopy

func (in *WorkflowRuntimeSpec) DeepCopy() *WorkflowRuntimeSpec

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

func (*WorkflowRuntimeSpec) DeepCopyInto

func (in *WorkflowRuntimeSpec) DeepCopyInto(out *WorkflowRuntimeSpec)

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

type WorkflowRuntimeStatus

type WorkflowRuntimeStatus struct {
}

WorkflowRuntimeStatus defines the observed state of WorkflowRuntime

func (*WorkflowRuntimeStatus) DeepCopy

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

func (*WorkflowRuntimeStatus) DeepCopyInto

func (in *WorkflowRuntimeStatus) DeepCopyInto(out *WorkflowRuntimeStatus)

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

type WorkflowSpec

type WorkflowSpec struct {

	// Env is the environment variables for the Workflow
	// It is defined by users
	// +optional
	Env map[string]string `json:"env,omitempty"`

	// Spec is a list of Flows
	Spec []Flow `json:"spec"`
}

WorkflowSpec defines the desired state of Workflow

func (*WorkflowSpec) DeepCopy

func (in *WorkflowSpec) DeepCopy() *WorkflowSpec

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

func (*WorkflowSpec) DeepCopyInto

func (in *WorkflowSpec) DeepCopyInto(out *WorkflowSpec)

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

type WorkflowStatus

type WorkflowStatus struct {
}

WorkflowStatus defines the observed state of Workflow

func (*WorkflowStatus) DeepCopy

func (in *WorkflowStatus) DeepCopy() *WorkflowStatus

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

func (*WorkflowStatus) DeepCopyInto

func (in *WorkflowStatus) DeepCopyInto(out *WorkflowStatus)

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

Jump to

Keyboard shortcuts

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