Version: v1.2

后端服务

后端服务(Worker)描述在后端运行的长时间运行、可扩展、容器化的服务。它不对外暴露访问端口。

如何使用

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: app-worker
  5. spec:
  6. components:
  7. - name: myworker
  8. type: worker
  9. properties:
  10. image: "busybox"
  11. cmd:
  12. - sleep
  13. - "1000"

属性说明

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 servicestringfalse
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
volumesDeclare volumes and volumeMounts[]volumesfalse
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

readinessProbe

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
execInstructions for assessing container health by executing a command. Either this attribute or theexecfalse
httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive
with both the httpGet attribute and the tcpSocket attribute.
httpGetInstructions for assessing container health by executing an HTTP GET request. Either this attributehttpGetfalse
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.
tcpSocketInstructions for assessing container health by probing a TCP socket. Either this attribute or thetcpSocketfalse
exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with
both the exec attribute and the httpGet attribute.
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) orinttrue3
not ready (readiness probe).
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[]stringtrue
the command is a separate array element. Commands exiting 0 are considered to be successful probes,
whilst all other exit codes are considered failures.

livenessProbe

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
execInstructions for assessing container health by executing a command. Either this attribute or theexecfalse
httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive
with both the httpGet attribute and the tcpSocket attribute.
httpGetInstructions for assessing container health by executing an HTTP GET request. Either this attributehttpGetfalse
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.
tcpSocketInstructions for assessing container health by probing a TCP socket. Either this attribute or thetcpSocketfalse
exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with
both the exec attribute and the httpGet attribute.
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) orinttrue3
not ready (readiness probe).

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[]stringtrue
the command is a separate array element. Commands exiting 0 are considered to be successful probes,
whilst all other exit codes are considered failures.

volumes

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
namestringtrue
mountPathstringtrue
typeSpecify volume type, options: “pvc”,”configMap”,”secret”,”emptyDir”stringtrue

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 namespacesecretKeyReftrue

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