Function Specifications

Learn about Function Specifications.

This document describes the specifications of the Function CRD.

Function

FieldDescription
apiVersion stringcore.openfunction.io/v1alpha2
kind stringFunction
metadata v1.ObjectMeta(Optional) Refer to v1.ObjectMeta
spec FunctionSpecRefer to FunctionSpec
status FunctionStatusRefer to FunctionStatus

FunctionSpec

Belong to Function.

FieldDescription
version string(Optional) Function version, e.g. v1.0.0
image stringImage upload path, e.g. demorepo/demofunction:v1
imageCredentials v1.LocalObjectReference(Optional) Credentials for accessing the image repository, refer to v1.LocalObjectReference
port int32(Optional) The port the function is listening on, e.g. 8080
build BuildImpl(Optional) Builder specification for the function, see BuildImpl
serving ServingImpl(Optional) Serving specification for the function, see ServingImpl

BuildImpl

Belong to FunctionSpec.

FieldDescription
builder stringName of the Builder
builderCredentials v1.LocalObjectReference(Optional) Credentials for accessing the image repository, refer to v1.LocalObjectReference
shipwright ShipwrightEngine(Optional) Specification of the Shipwright engine, refer to ShipwrightEngine
params map[string]string(Optional) Parameters passed to Shipwright
env map[string]string(Optional) Parameters passed to the buildpacks builder
srcRepo GitRepoThe configuration of the source code repository, refer to GitRepo
dockerfile string(Optional) Path to the Dockerfile instructing Shipwright when using the Dockerfile to build images

ShipwrightEngine

Belong to BuildImpl.

FieldDescription
strategy Strategy(Optional) Index of image build strategy, refer to Strategy
timeout v1.Duration(Optional) Build timeout, refer to v1.Duration

Strategy

Belong to ShipwrightEngine.

FieldDescription
name stringName of the strategy
kind string(Optional) Kind of the build strategy, which defaults to “BuildStrategy” or optional “ClusterBuildStrategy”

GitRepo

Belong to BuildImpl.

FieldDescription
url stringSource code repository address
revision string(Optional) Referenceable instances in the repository, such as commit ID and branch name.
sourceSubPath string(Optional) The directory of the function in the repository, e.g. functions/function-a/
credentials v1.LocalObjectReference(Optional) Repository access credentials, refer to v1.LocalObjectReference

ServingImpl

Belong to FunctionSpec.

FieldDescription
runtime stringType of load runtime, optional: Knative, OpenFuncAsync
params map[string]string(Optional) Parameters passed to the workloads
openFuncAsync OpenFuncAsyncRuntime(Optional) Used to define the configuration of OpenFuncAsync when the runtime is OpenFuncAsync, see OpenFuncAsyncRuntime
template v1.PodSpec(Optional) Template for the definition of Pods in the workloads, refer to v1.PodSpec

OpenFuncAsyncRuntime

Belong to ServingImpl.

FieldDescription
dapr Dapr(Optional) Definition of Dapr components, see Dapr
keda Keda(Optional) Definition of Keda, see Keda

Dapr

Belong to OpenFuncAsyncRuntime.

FieldDescription
annotations map[string]string(Optional) Annotations for Dapr components, see Dapr documentation
components map[string]componentsv1alpha1.ComponentSpec(Optional) Dapr Components Spec map, with key being component’s name and value being componentsv1alpha1.ComponentSpec
inputs []DaprIO(Optional) The definition of the inputs of the function, see DaprIO
outputs []DaprIO(Optional) The definition of the outputs of the function, see DaprIO

DaprIO

Belong to Dapr.

FieldDescription
name stringName of the input and output of the function. Consistent with the name of DaprComponent means associated
component stringIndicates the name of components
type stringType of Dapr component, optional: bindings, pubsub
topic string(Optional) When the type is pubsub, you need to set the topic
operation string(Optional) Operation field tells the Dapr component which operation it should perform, refer to Dapr docs
params map[string]string(Optional) Parameters passed to Dapr

Keda

Belong to OpenFuncAsyncRuntime.

FieldDescription
scaledObject KedaScaledObjectDefinition of KEDA scalable objects (Deployments), refer to KedaScaledObject
scaledJob KedaScaledJobDefinition of KEDA scalable jobs, refer to KedaScaledJob

KedaScaledObject

Belong to Keda.

FieldDescription
workloadType stringHow to run the function, known values are Deployment or StatefulSet, which defaults to Deployment.
pollingInterval int32(Optional) The pollingInterval is in seconds. This is the interval in which KEDA checks the triggers for the queue length or the stream lag. It defaults to 30 seconds.
cooldownPeriod int32(Optional) The cooldownPeriod is in seconds, and it is the period of time to wait after the last trigger activated before scaling back down to 0. It defaults to 300 seconds.
minReplicaCount int32(Optional) Minimum number of replicas which KEDA will scale the resource down to. By default, it scales to 0.
maxReplicaCount int32(Optional) This setting is passed to the HPA definition that KEDA will create for a given resource.
advanced kedav1alpha1.AdvancedConfig(Optional) This property specifies whether the target resource (for example, Deployment and StatefulSet) should be scaled back to original replicas count after the ScaledObject is deleted. Default behavior is to keep the replica count at the same number as it is in the moment of ScaledObject deletion. Refer to kedav1alpha1.AdvancedConfig.
triggers []kedav1alpha1.ScaleTriggersEvent sources that trigger dynamic scaling of workloads. Refer to kedav1alpha1.ScaleTriggers.

KedaScaledJob

Belong to Keda.

FieldDescription
restartPolicy v1.RestartPolicyRestart policy for all containers within the pod. Value options are OnFailure or Never. It defaults to Never.
pollingInterval int32(Optional) The pollingInterval is in seconds. This is the interval in which KEDA checks the triggers for the queue length or the stream lag. It defaults to 30 seconds.
successfulJobsHistoryLimit int32(Optional) How many completed jobs should be kept. It defaults to 100.
failedJobsHistoryLimit int32(Optional) How many failed jobs should be kept. It defaults to 100.
maxReplicaCount int32(Optional) The max number of pods that is created within a single polling period.
scalingStrategy kedav1alpha1.ScalingStrategy(Optional) Select a scaling strategy. Value options are default, custom, or accurate. The default value is default. Refer to kedav1alpha1.ScalingStrategy.
triggers []kedav1alpha1.ScaleTriggersEvent sources that trigger dynamic scaling of workloads, refer to kedav1alpha1.ScaleTriggers.