Skip to main content
Version: v1.4

Built-in Component Type

This documentation will walk through the built-in component types.

Webservice

Description

Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers.

Properties

NameDescriptionTypeRequiredDefault
cmdCommands to run in the container[]stringfalse
envDefine arguments by using environment variables[]envfalse
volumeMountsvolumeMountsfalse
labelsSpecify the labels in the workloadmap[string]stringfalse
annotationsSpecify the annotations in the workloadmap[string]stringfalse
imageWhich image would you like to use for your servicestringtrue
portsWhich ports do you want customer traffic sent to[]portsfalse
imagePullPolicySpecify image pull policy for your service. Should be "Always","Never" or "IfNotPresent".stringfalse
cpuNumber of CPU units for the service, like 0.5 (0.5 CPU core), 1 (1 CPU core)stringfalse
memorySpecifies the attributes of the memory resource required for the container.stringfalse
livenessProbeInstructions for assessing whether the container is alive.livenessProbefalse
readinessProbeInstructions for assessing whether the container is in a suitable state to serve traffic.readinessProbefalse
imagePullSecretsSpecify image pull secrets for your service[]stringfalse
hostAliasesSpecify the hostAliases to add[]hostAliasestrue

readinessProbe

NameDescriptionTypeRequiredDefault
execInstructions for assessing container health by executing a command. Either this attribute or the httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the httpGet attribute and the tcpSocket attribute.execfalse
httpGetInstructions for assessing container health by executing an HTTP GET request. Either this attribute or the exec attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the tcpSocket attribute.httpGetfalse
tcpSocketInstructions for assessing container health by probing a TCP socket. Either this attribute or the exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the httpGet attribute.tcpSocketfalse
initialDelaySecondsNumber of seconds after the container is started before the first probe is initiated.inttrue0
periodSecondsHow often, in seconds, to execute the probe.inttrue10
timeoutSecondsNumber of seconds after which the probe times out.inttrue1
successThresholdMinimum consecutive successes for the probe to be considered successful after having failed.inttrue1
failureThresholdNumber of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).inttrue3
tcpSocket
NameDescriptionTypeRequiredDefault
portThe TCP socket within the container that should be probed to assess container health.inttrue
httpGet
NameDescriptionTypeRequiredDefault
pathThe endpoint, relative to the port, to which the HTTP GET request should be directed.stringtrue
portThe TCP socket within the container to which the HTTP GET request should be directed.inttrue
httpHeaders[]httpHeadersfalse
httpHeaders
NameDescriptionTypeRequiredDefault
namestringtrue
valuestringtrue
exec
NameDescriptionTypeRequiredDefault
commandA command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures.[]stringtrue
hostAliases
NameDescriptionTypeRequiredDefault
ipstringtrue
hostnames[]stringtrue

livenessProbe

NameDescriptionTypeRequiredDefault
hostAliasesSpecify the hostAliases to add[]hostAliasestrue
execInstructions for assessing container health by executing a command. Either this attribute or the httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the httpGet attribute and the tcpSocket attribute.execfalse
httpGetInstructions for assessing container health by executing an HTTP GET request. Either this attribute or the exec attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the tcpSocket attribute.httpGetfalse
tcpSocketInstructions for assessing container health by probing a TCP socket. Either this attribute or the exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the httpGet attribute.tcpSocketfalse
initialDelaySecondsNumber of seconds after the container is started before the first probe is initiated.inttrue0
periodSecondsHow often, in seconds, to execute the probe.inttrue10
timeoutSecondsNumber of seconds after which the probe times out.inttrue1
successThresholdMinimum consecutive successes for the probe to be considered successful after having failed.inttrue1
failureThresholdNumber of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).inttrue3

ports

NameDescriptionTypeRequiredDefault
nameName of the portstringfalse
portNumber of port to expose on the pod's IP addressinttrue
protocolProtocol for port. Must be UDP, TCP, or SCTPstringtrueTCP
exposeSpecify if the port should be exposedbooltruefalse

volumeMounts

NameDescriptionTypeRequiredDefault
pvcMount PVC type volume[]pvcfalse
configMapMount ConfigMap type volume[]configMapfalse
secretMount Secret type volume[]secretfalse
emptyDirMount EmptyDir type volume[]emptyDirfalse
hostPathMount HostPath type volume[]hostPathfalse
hostPath
NameDescriptionTypeRequiredDefault
pathstringtrue
namestringtrue
mountPathstringtrue
emptyDir
NameDescriptionTypeRequiredDefault
namestringtrue
mountPathstringtrue
mediumstringtrueempty
secret
NameDescriptionTypeRequiredDefault
namestringtrue
mountPathstringtrue
defaultModeinttrue420
items[]itemsfalse
secretNamestringtrue
items
NameDescriptionTypeRequiredDefault
pathstringtrue
keystringtrue
modeinttrue511
configMap
NameDescriptionTypeRequiredDefault
namestringtrue
mountPathstringtrue
defaultModeinttrue420
cmNamestringtrue
items[]itemsfalse
items
NameDescriptionTypeRequiredDefault
pathstringtrue
keystringtrue
modeinttrue511
pvc
NameDescriptionTypeRequiredDefault
namestringtrue
mountPathstringtrue
claimNameThe name of the PVCstringtrue

env

NameDescriptionTypeRequiredDefault
nameEnvironment variable namestringtrue
valueThe value of the environment variablestringfalse
valueFromSpecifies a source the value of this var should come fromvalueFromfalse
valueFrom
NameDescriptionTypeRequiredDefault
secretKeyRefSelects a key of a secret in the pod's namespacesecretKeyReffalse
configMapKeyRefSelects a key of a config map in the pod's namespaceconfigMapKeyReffalse
configMapKeyRef
NameDescriptionTypeRequiredDefault
nameThe name of the config map in the pod's namespace to select fromstringtrue
keyThe key of the config map to select from. Must be a valid secret keystringtrue
secretKeyRef
NameDescriptionTypeRequiredDefault
nameThe name of the secret in the pod's namespace to select fromstringtrue
keyThe key of the secret to select from. Must be a valid secret keystringtrue

Examples

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: website
spec:
components:
- name: frontend
type: webservice
properties:
image: oamdev/testapp:v1
cmd: ["node", "server.js"]
port: 8080
cpu: "0.1"
env:
- name: FOO
value: bar
- name: FOO
valueFrom:
secretKeyRef:
name: bar
key: bar

Worker

Describes long-running, scalable, containerized services that running at backend. They do NOT have network endpoint to receive external network traffic.

Parameters

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
cmdCommands to run in the container[]stringfalse
envDefine arguments by using environment variables[]envfalse
imageWhich image would you like to use for your servicestringtrue
imagePullPolicySpecify image pull policy for your service. Should be "Always","Never" or "IfNotPresent".stringfalse
cpuNumber of CPU units for the service, like 0.5 (0.5 CPU core), 1 (1 CPU core)stringfalse
memorySpecifies the attributes of the memory resource required for the container.stringfalse
volumeMountsvolumeMountsfalse
livenessProbeInstructions for assessing whether the container is alive.livenessProbefalse
readinessProbeInstructions for assessing whether the container is in a suitable state to serve traffic.readinessProbefalse
imagePullSecretsSpecify image pull secrets for your service[]stringfalse

Examples

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app-worker
spec:
components:
- name: myworker
type: worker
properties:
image: "busybox"
cmd:
- sleep
- "1000"

Task

Describes jobs that run code or a script to completion.

Parameters

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
cmdCommands to run in the container[]stringfalse
envDefine arguments by using environment variables[]envfalse
countSpecify number of tasks to run in parallelinttrue1
restartDefine the job restart policy, the value can only be Never or OnFailure. By default, it's Never.stringtrueNever
imageWhich image would you like to use for your servicestringtrue
cpuNumber of CPU units for the service, like 0.5 (0.5 CPU core), 1 (1 CPU core)stringfalse
memorySpecifies the attributes of the memory resource required for the container.stringfalse
volumeMountsvolumeMountsfalse
livenessProbeInstructions for assessing whether the container is alive.livenessProbefalse
readinessProbeInstructions for assessing whether the container is in a suitable state to serve traffic.readinessProbefalse
labelsSpecify the labels in the workload[]stringfalse
annotationsSpecify the annotations in the workload[]stringfalse
imagePullPolicySpecify image pull policy for your servicestringfalse
imagePullSecretsSpecify image pull secrets for your service[]stringfalse

Examples

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app-worker
spec:
components:
- name: mytask
type: task
properties:
image: perl
count: 10
cmd: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]

Cron Task

Describes cron jobs that run code or a script to completion.

Parameters

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
cmdCommands to run in the container[]stringfalse
envDefine arguments by using environment variables[]envfalse
scheduleSpecify the schedule in Cron formatstringtrue
suspendSuspend subsequent executionsboolfalsefalse
concurrencyPolicySpecifies how to treat concurrent executions of a JobstringfalseAllow
successfulJobsHistoryLimitThe number of successful finished jobs to retainintfalse3
failedJobsHistoryLimitThe number of failed finished jobs to retainintfalse1
countSpecify number of tasks to run in parallelinttrue1
restartDefine the job restart policy, the value can only be Never or OnFailure. By default, it's Never.stringtrueNever
imageWhich image would you like to use for your servicestringtrue
cpuNumber of CPU units for the service, like 0.5 (0.5 CPU core), 1 (1 CPU core)stringfalse
memorySpecifies the attributes of the memory resource required for the container.stringfalse
volumeMountsvolumeMountsfalse
livenessProbeInstructions for assessing whether the container is alive.livenessProbefalse
readinessProbeInstructions for assessing whether the container is in a suitable state to serve traffic.readinessProbefalse
labelsSpecify the labels in the workload[]stringfalse
annotationsSpecify the annotations in the workload[]stringfalse
imagePullPolicySpecify image pull policy for your servicestringfalse
imagePullSecretsSpecify image pull secrets for your service[]stringfalse

Examples

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: cron-worker
spec:
components:
- name: mytask
type: cron-task
properties:
image: perl
count: 10
cmd: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
schedule: "*/1 * * * *"

k8s-objects

参数说明

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
objectsKubernetes resource manifest[]K8s-Objecttrue

k8s-object

A kubernetes plane manifest.

Examples

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app-raw
spec:
components:
- name: myjob
type: k8s-objects
properties:
objects:
- apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
template:
spec:
containers:
- name: pi
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
backoffLimit: 4