Function Specifications

Learn about Function Specifications.

This document describes the specifications of the Function CRD.

Function.spec

NameTypeDescriptionRequired
imagestringImage upload path, e.g. demorepo/demofunction:v1true
buildobjectBuilder specification for the functionfalse
imageCredentialsobjectCredentials for accessing the image repository, refer to v1.LocalObjectReferencefalse
servingobjectServing specification for the functionfalse
versionstringFunction version, e.g. v1.0.0false
workloadRuntimestringWorkloadRuntime for Function. Know values: OCIContainer and WasmEdge.Default: OCIContainerfalse

Function.spec.build

↩ Parent

NameTypeDescriptionRequired
srcRepoobjectThe configuration of the source code repositorytrue
builderstringName of the Builderfalse
builderCredentialsobjectCredentials for accessing the image repository, refer to v1.LocalObjectReferencefalse
builderMaxAgestringThe maximum time of finished builders to retain.false
dockerfilestringPath to the Dockerfile instructing Shipwright when using the Dockerfile to build imagesfalse
envmap[string]stringEnvironment variables passed to the buildpacks builderfalse
failedBuildsHistoryLimitintegerThe number of failed builders to retain. Default is 1.false
shipwrightobjectSpecification of the Shipwright enginefalse
successfulBuildsHistoryLimitintegerThe number of successful finished builders to retain. Default is 0.false
timeoutstringThe maximum time for the builder to build the imagefalse

Function.spec.build.srcRepo

↩ Parent

NameTypeDescriptionRequired
bundleContainerobjectBundleContainer describes the source code bundle container to pullfalse
credentialsobjectRepository access credentials, refer to v1.LocalObjectReferencefalse
revisionstringReferencable instances in the repository, such as commit ID and branch name.false
sourceSubPathstringThe directory of the function in the repository, e.g. functions/function-a/false
urlstringSource code repository addressfalse

Function.spec.build.srcRepo.bundleContainer

↩ Parent

NameTypeDescriptionRequired
imagestringThe bundleContainer image nametrue

Function.spec.build.shipwright

↩ Parent

NameTypeDescriptionRequired
params[]objectParameters for the build strategyfalse
strategyobjectStrategy references the BuildStrategy to use to build the imagefalse
timeoutstringThe maximum amount of time the shipwright Build should take to executefalse

Function.spec.serving

↩ Parent

NameTypeDescriptionRequired
annotationsmap[string]stringAnnotations that will be added to the workloadfalse
bindingsmap[string]objectDapr bindings that the function needs to create and use.false
hooksobjectHooks that will be executed before or after the function executionfalse
labelsmap[string]stringLabels that will be added to the workloadfalse
outputs[]objectThe outputs which the function will send data tofalse
paramsmap[string]stringParameters required by the function, will be passed to the function as environment variablesfalse
pubsubmap[string]objectDapr pubsub that the function needs to create and usefalse
scaleOptionsobjectConfiguration of auto scaling.false
statesmap[string]objectDapr state store that the function needs to create and usefalse
templateobjectTemplate is a pod template which allows modifying operator generated pod template.false
timeoutstringTimeout defines the maximum amount of time the Serving should take to execute before the Serving is runningfalse
tracingobjectConfiguration of tracingfalse
triggersobjectTriggers used to trigger the function. Refer to Function Trigger.true
workloadTypestringThe type of workload used to run the function, known values are: Deployment, StatefulSet and Jobfalse

Function.spec.serving.hooks

↩ Parent

NameTypeDescriptionRequired
policystringThere are two kind of hooks, global hooks and private hooks, the global hooks define in the config file of OpenFunction Controller, the private hooks define in the Function. Policy is the relationship between the global hooks and the private hooks of the function. Known values are:
  Append: All hooks will be executed, the private pre hooks will execute after the global pre hooks , and the private post hooks will execute before the global post hooks. this is the default policy.
  Override: Only execute the private hooks.
false
post[]stringThe hooks will be executed after the function executionfalse
pre[]stringThe hooks will be executed before the function executionfalse

Function.spec.serving.outputs[index]

↩ Parent

NameTypeDescriptionRequired
daprobjectDapr output, refer to a exist component or a component defined in bindings or pubsubfalse

Function.spec.serving.outputs[index].dapr

↩ Parent

NameTypeDescriptionRequired
namestringThe name of the dapr componenttrue
metadatamap[string]stringMetadata passed to Daprfalse
operationstringOperation field tells the Dapr component which operation it should perform, refer to Dapr docsfalse
topicstringWhen the type is pubsub, you need to set the topicfalse
typestringType of Dapr component, such as: bindings.kafka, pubsub.rocketmqfalse

Function.spec.serving.scaleOptions

↩ Parent

NameTypeDescriptionRequired
kedaobjectConfiguration about keda autoscalingfalse
knativemap[string]stringKnative autiscaling annotations. Refer to Knative autoscaling.false
maxReplicasintegerMinimum number of replicas which will scale the resource down to. By default, it scales to 0.false
minReplicasintegerMaximum number of replicas which will scale the resource up to.false

Function.spec.serving.scaleOptions.keda

↩ Parent

NameTypeDescriptionRequired
scaledJobobjectScale options for jobfalse
scaledObjectobjectScale options for deployment and statefulsetfalse
triggers[]objectEvent sources that trigger dynamic scaling of workloads. Refer to kedav1alpha1.ScaleTriggers.false

Function.spec.serving.scaleOptions.keda.scaledJob

↩ Parent

NameTypeDescriptionRequired
failedJobsHistoryLimitintegerHow many failed jobs should be kept. It defaults to 100.false
pollingIntervalintegerThe 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.false
restartPolicystringRestart policy for all containers within the pod. Value options are OnFailure or Never. It defaults to Never.false
scalingStrategyobjectSelect a scaling strategy. Value options are default, custom, or accurate. The default value is default. Refer to kedav1alpha1.ScalingStrategyfalse
successfulJobsHistoryLimitintegerHow many completed jobs should be kept. It defaults to 100.false

Function.spec.serving.scaleOptions.keda.scaledObject

↩ Parent

NameTypeDescriptionRequired
advancedobjectThis 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.false
cooldownPeriodintegerThe 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.false
pollingIntervalintegerThe 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.false

Function.spec.serving.states[key]

↩ Parent

NameTypeDescriptionRequired
specobjectDapr state stroe component spec. Refer to Dapr docs.false

Function.spec.serving.tracing

↩ Parent

NameTypeDescriptionRequired
baggagemap[string]stringBaggage is contextual information that passed between spans. It is a key-value store that resides alongside span context in a trace, making values available to any span created within that trace.true
enabledbooleanWether to enable tracingtrue
providerobjectThe tracing implementation used to create and send spantrue
tagsmap[string]stringThe tag that needs to be added to the spansfalse

Function.spec.serving.tracing.provider

↩ Parent

NameTypeDescriptionRequired
namestringTracing provider name, known values are skywalking and opentelemetrytrue
exporterobjectService to collect span for opentelemetryfalse
oapServerstringThe skywalking server urlfalse

Function.spec.serving.tracing.provider.exporter

↩ Parent

NameTypeDescriptionRequired
endpointstringThe exporter urltrue
namestringThe exporter name, known values are otlp, jaeger, and zipkintrue
compressionstringThe compression type to use on OTLP trace requests. Options include gzip. By default no compression will be used.false
headersstringKey-value pairs separated by commas to pass as request headers on OTLP trace requests.false
protocolstringThe transport protocol to use on OTLP trace requests. Options include grpc and http/protobuf. Default is grpc.false
timeoutstringThe maximum waiting time, in milliseconds, allowed to send each OTLP trace batch. Default is 10000.false

Function.spec.serving.triggers

↩ Parent

NameTypeDescriptionRequired
dapr[]objectList of dapr triggers, refer to dapr bindings or pusub componentsfalse
httpobjectThe http triggerfalse
inputs[]objectA list of components that the function can get data fromfalse

Function.spec.serving.triggers.dapr[index]

↩ Parent

NameTypeDescriptionRequired
namestringThe dapr component nametrue
topicstringWhen the component type is pubsub, you need to set the topicfalse
typestringType of Dapr component, such as: bindings.kafka, pubsub.rocketmqfalse

Function.spec.serving.triggers.http

↩ Parent

NameTypeDescriptionRequired
portintegerThe port the function is listening on, e.g. 8080false
routeobjectRoute defines how traffic from the Gateway listener is routed to a function.false

Function.spec.serving.triggers.http.route

↩ Parent

NameTypeDescriptionRequired
gatewayRefobjectGatewayRef references the Gateway resources that a Route wantsfalse
hostnames[]stringHostnames defines a set of hostname that should match against the HTTP Host header to select a HTTPRoute to process the request.false
rules[]objectRules are a list of HTTP matchers, filters and actions. Refer to HTTPRouteRule.false

Function.spec.serving.triggers.http.route.gatewayRef

↩ Parent

NameTypeDescriptionRequired
namestringThe name of the gatewaytrue
namespacestringThe namespace of the gatewaytrue

Function.spec.serving.triggers.inputs[index]

↩ Parent

NameTypeDescriptionRequired
daprobjectA dapr component that function can get data from. Now just support dapr state storetrue

Function.spec.serving.triggers.inputs[index].dapr

↩ Parent

NameTypeDescriptionRequired
namestringThe dapr component name, maybe a exist component or a component defined in statetrue
typestringThe dapr component type, such as state.redisfalse