Docs: Docs: Add a doc for cron-task Signed-off-by: Xiangbo Ma <maxiangboo@cmbchina.com> (#568)

Signed-off-by: fourierr <maxiangboo@qq.com>
This commit is contained in:
Xiangbo Ma 2022-04-03 22:08:44 +08:00 committed by GitHub
parent a8c17a5806
commit eef5261403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 437 additions and 250 deletions

View File

@ -0,0 +1,186 @@
---
title: Cron Task
---
Describes cron jobs that run code or a script to completion.
## How-to
```yaml
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 * * * *"
```
## Attributes
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|----------------------------|--------------------------------------------------------------------------------------------------|-----------------------------------|----------|---------|
| cmd | Commands to run in the container | []string | false | |
| env | Define arguments by using environment variables | [[]env](#env) | false | |
| schedule | Specify the schedule in [Cron format](https://en.wikipedia.org/wiki/Cron) | string | true | |
| suspend | Suspend subsequent executions | bool | false | false |
| concurrencyPolicy | Specifies how to treat concurrent executions of a Job | string | false | Allow |
| successfulJobsHistoryLimit | The number of successful finished jobs to retain | int | false | 3 |
| failedJobsHistoryLimit | The number of failed finished jobs to retain | int | false | 1 |
| count | Specify number of tasks to run in parallel | int | true | 1 |
| restart | Define the job restart policy, the value can only be Never or OnFailure. By default, it's Never. | string | true | Never |
| image | Which image would you like to use for your service | string | true | |
| cpu | Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) | string | false | |
| memory | Specifies the attributes of the memory resource required for the container. | string | false | |
| volumes | Declare volumes and volumeMounts | [[]volumes](#volumes) | false | |
| livenessProbe | Instructions for assessing whether the container is alive. | [livenessProbe](#livenessProbe) | false | |
| readinessProbe | Instructions for assessing whether the container is in a suitable state to serve traffic. | [readinessProbe](#readinessProbe) | false | |
| labels | Specify the labels in the workload | []string | false | |
| annotations | Specify the annotations in the workload | []string | false | |
| imagePullPolicy | Specify image pull policy for your service | string | false | |
| imagePullSecrets | Specify image pull secrets for your service | []string | false | |
### readinessProbe
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
| httpGet | Instructions for assessing container health by executing an HTTP GET request. Either this attribute | [httpGet](#httpGet) | false | |
| | 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. | | | |
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
| | both the exec attribute and the httpGet attribute. | | | |
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
| | not ready (readiness probe). | | | |
#### tcpSocket
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
#### httpGet
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
##### httpHeaders
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ----- | ----------- | ------ | -------- | ------- |
| name | | string | true | |
| value | | string | true | |
#### exec
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
| | 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
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
| httpGet | Instructions for assessing container health by executing an HTTP GET request. Either this attribute | [httpGet](#httpGet) | false | |
| | 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. | | | |
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
| | both the exec attribute and the httpGet attribute. | | | |
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
| | not ready (readiness probe). | | | |
#### tcpSocket
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
#### httpGet
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
##### httpHeaders
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ----- | ----------- | ------ | -------- | ------- |
| name | | string | true | |
| value | | string | true | |
#### exec
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
| | 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
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| --------- | ------------------------------------------------------------------- | ------ | -------- | ------- |
| name | | string | true | |
| mountPath | | string | true | |
| type | Specify volume type, options: "pvc","configMap","secret","emptyDir" | string | true | |
#### env
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| --------- | --------------------------------------------------------- | ----------------------- | -------- | ------- |
| name | Environment variable name | string | true | |
| value | The value of the environment variable | string | false | |
| valueFrom | Specifies a source the value of this var should come from | [valueFrom](#valueFrom) | false | |
#### valueFrom
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ------------ | ------------------------------------------------ | ----------------------------- | -------- | ------- |
| secretKeyRef | Selects a key of a secret in the pod's namespace | [secretKeyRef](#secretKeyRef) | true | |
#### secretKeyRef
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ---- | ---------------------------------------------------------------- | ------ | -------- | ------- |
| name | The name of the secret in the pod's namespace to select from | string | true | |
| key | The key of the secret to select from. Must be a valid secret key | string | true | |

View File

@ -1,250 +1,251 @@
const { Component } = require("react");
module.exports = {
docs: [
{
type: "category",
label: "Getting Started",
collapsed: false,
items: [
"getting-started/introduction",
"getting-started/core-concept",
"getting-started/architecture",
"install",
"quick-start",
],
},
{
type: "category",
label: "Tutorials",
collapsed: false,
items: [
"tutorials/webservice",
"tutorials/helm",
"tutorials/consume-cloud-services",
"tutorials/k8s-object",
"tutorials/jenkins",
"tutorials/trigger",
"case-studies/gitops",
"tutorials/workflows",
// "case-studies/jenkins-cicd",
// "case-studies/canary-blue-green",
],
},
{
type: "category",
label: "How-to Guides",
collapsed: true,
items: [
// TODO:
{
type: "category",
label: "VelaUX",
collapsed: false,
items: [
{
"Manage applications": [
"how-to/dashboard/application/create-application",
"how-to/dashboard/application/bind-new-environment",
"how-to/dashboard/application/deploy-application",
"how-to/dashboard/application/get-application-instance",
"tutorials/scaler",
"how-to/dashboard/application/get-application-log",
"how-to/dashboard/application/get-application-endpoint",
"how-to/dashboard/application/view-application-resource",
"how-to/dashboard/application/get-application-revision",
"how-to/dashboard/application/recycle-environment",
"how-to/dashboard/application/delete-application",
],
},
{
"Manage workflows": ["how-to/dashboard/workflow/overview"],
},
{
"Manage traits": ["how-to/dashboard/trait/overview"],
},
{
"Manage triggers": ["how-to/dashboard/trigger/overview"],
},
// {
// "Manage environment": ["how-to/dashboard/environment/overview"],
// },
{
"Manage target": ["how-to/dashboard/target/overview"],
},
// {
// "Manage cluster": [
// "how-to/dashboard/cluster/overview",
// "how-to/dashboard/cluster/connect-cluster",
// "how-to/dashboard/cluster/detach-cluster",
// "how-to/dashboard/cluster/set-cluster-dashboard",
// "how-to/dashboard/cluster/edit-cluster",
// ],
// },
// {
// "Manage addon": ["how-to/dashboard/addon/overview"],
// },
],
},
{
type: "category",
label: "CLI",
collapsed: true,
items: [
"end-user/quick-start-cli",
"end-user/traits/ingress",
{
"Cloud Resources": [
"end-user/components/cloud-services/provision-and-consume-cloud-services",
"end-user/components/cloud-services/provision-and-initiate-database",
"end-user/components/cloud-services/secure-your-database-connection",
"end-user/components/cloud-services/provision-an-RDS-instance-with-more-than-one-database",
],
},
"end-user/traits/rollout",
"end-user/policies/health",
"case-studies/multi-cluster",
"end-user/workflow/component-dependency-parameter",
"end-user/workflow/webhook-notification",
"end-user/version-control",
"how-to/cli/addon/addon",
],
},
],
},
{
type: "category",
label: "Extension",
collapsed: true,
items: [
{
type: "category",
label: "Learning OAM",
collapsed: false,
items: [
"platform-engineers/oam/oam-model",
"platform-engineers/oam/x-definition",
],
},
{
"Learning CUE": [
"platform-engineers/cue/basic",
"platform-engineers/cue/definition-edit",
"platform-engineers/cue/advanced",
],
},
{
"Custom Addons": [
"platform-engineers/addon/intro",
"platform-engineers/addon/terraform",
],
},
"platform-engineers/components/custom-component",
{
"Cloud Resources": [
"platform-engineers/addon/terraform",
"platform-engineers/components/component-terraform",
],
},
{
type: "category",
label: "Traits System",
items: [
"platform-engineers/traits/customize-trait",
"platform-engineers/traits/patch-trait",
"platform-engineers/traits/status",
"platform-engineers/traits/advanced",
],
},
{
"Workflow System": [
"platform-engineers/workflow/workflow",
"platform-engineers/workflow/cue-actions",
"platform-engineers/workflow/working-mechanism",
],
},
{
"System Operation": [
"platform-engineers/system-operation/bootstrap-parameters",
"platform-engineers/system-operation/managing-clusters",
"platform-engineers/system-operation/observability",
"platform-engineers/system-operation/performance-finetuning",
"platform-engineers/system-operation/velaql",
],
},
"platform-engineers/debug/dry-run",
"platform-engineers/x-def-version",
],
},
{
type: "category",
label: "References",
items: [
"cli/vela",
{
type: "category",
label: "Built-in Addons",
items: [
"reference/addons/overview",
"reference/addons/velaux",
"reference/addons/terraform",
"reference/addons/ai"
],
},
"end-user/components/cloud-services/cloud-resources-list",
{
type: "category",
label: "Built-in Component Type",
items: [
"end-user/components/helm",
"end-user/components/cue/webservice",
"end-user/components/cue/worker",
"end-user/components/cue/task",
"end-user/components/kustomize",
"end-user/components/cue/raw",
"end-user/components/more",
],
},
{
type: "category",
label: "Built-in Trait Type",
items: [
"end-user/traits/scaler",
"end-user/traits/ingress",
"end-user/traits/storage",
"end-user/traits/rollout",
"end-user/traits/annotations-and-labels",
"end-user/traits/service-binding",
"end-user/traits/sidecar",
"end-user/traits/autoscaler",
"end-user/traits/kustomize-patch",
"end-user/traits/more",
],
},
{
type: "category",
label: "Built-in Policy Type",
items: ["end-user/policies/envbinding"],
},
"end-user/workflow/built-in-workflow-defs",
"end-user/service-account-integration",
"reference/ui-schema",
"reference/user-improvement-plan",
{
label: "VelaUX API Doc",
type: "link",
href: "https://kubevela.stoplight.io/docs/kubevela/b3A6NDI5NzQxMzM-detail-definition",
},
],
},
{
type: "category",
label: "Roadmap",
items: ["roadmap/README"],
},
{
type: "doc",
id: "developers/references/devex/faq",
},
],
};
const { Component } = require("react");
module.exports = {
docs: [
{
type: "category",
label: "Getting Started",
collapsed: false,
items: [
"getting-started/introduction",
"getting-started/core-concept",
"getting-started/architecture",
"install",
"quick-start",
],
},
{
type: "category",
label: "Tutorials",
collapsed: false,
items: [
"tutorials/webservice",
"tutorials/helm",
"tutorials/consume-cloud-services",
"tutorials/k8s-object",
"tutorials/jenkins",
"tutorials/trigger",
"case-studies/gitops",
"tutorials/workflows",
// "case-studies/jenkins-cicd",
// "case-studies/canary-blue-green",
],
},
{
type: "category",
label: "How-to Guides",
collapsed: true,
items: [
// TODO:
{
type: "category",
label: "VelaUX",
collapsed: false,
items: [
{
"Manage applications": [
"how-to/dashboard/application/create-application",
"how-to/dashboard/application/bind-new-environment",
"how-to/dashboard/application/deploy-application",
"how-to/dashboard/application/get-application-instance",
"tutorials/scaler",
"how-to/dashboard/application/get-application-log",
"how-to/dashboard/application/get-application-endpoint",
"how-to/dashboard/application/view-application-resource",
"how-to/dashboard/application/get-application-revision",
"how-to/dashboard/application/recycle-environment",
"how-to/dashboard/application/delete-application",
],
},
{
"Manage workflows": ["how-to/dashboard/workflow/overview"],
},
{
"Manage traits": ["how-to/dashboard/trait/overview"],
},
{
"Manage triggers": ["how-to/dashboard/trigger/overview"],
},
// {
// "Manage environment": ["how-to/dashboard/environment/overview"],
// },
{
"Manage target": ["how-to/dashboard/target/overview"],
},
// {
// "Manage cluster": [
// "how-to/dashboard/cluster/overview",
// "how-to/dashboard/cluster/connect-cluster",
// "how-to/dashboard/cluster/detach-cluster",
// "how-to/dashboard/cluster/set-cluster-dashboard",
// "how-to/dashboard/cluster/edit-cluster",
// ],
// },
// {
// "Manage addon": ["how-to/dashboard/addon/overview"],
// },
],
},
{
type: "category",
label: "CLI",
collapsed: true,
items: [
"end-user/quick-start-cli",
"end-user/traits/ingress",
{
"Cloud Resources": [
"end-user/components/cloud-services/provision-and-consume-cloud-services",
"end-user/components/cloud-services/provision-and-initiate-database",
"end-user/components/cloud-services/secure-your-database-connection",
"end-user/components/cloud-services/provision-an-RDS-instance-with-more-than-one-database",
],
},
"end-user/traits/rollout",
"end-user/policies/health",
"case-studies/multi-cluster",
"end-user/workflow/component-dependency-parameter",
"end-user/workflow/webhook-notification",
"end-user/version-control",
"how-to/cli/addon/addon",
],
},
],
},
{
type: "category",
label: "Extension",
collapsed: true,
items: [
{
type: "category",
label: "Learning OAM",
collapsed: false,
items: [
"platform-engineers/oam/oam-model",
"platform-engineers/oam/x-definition",
],
},
{
"Learning CUE": [
"platform-engineers/cue/basic",
"platform-engineers/cue/definition-edit",
"platform-engineers/cue/advanced",
],
},
{
"Custom Addons": [
"platform-engineers/addon/intro",
"platform-engineers/addon/terraform",
],
},
"platform-engineers/components/custom-component",
{
"Cloud Resources": [
"platform-engineers/addon/terraform",
"platform-engineers/components/component-terraform",
],
},
{
type: "category",
label: "Traits System",
items: [
"platform-engineers/traits/customize-trait",
"platform-engineers/traits/patch-trait",
"platform-engineers/traits/status",
"platform-engineers/traits/advanced",
],
},
{
"Workflow System": [
"platform-engineers/workflow/workflow",
"platform-engineers/workflow/cue-actions",
"platform-engineers/workflow/working-mechanism",
],
},
{
"System Operation": [
"platform-engineers/system-operation/bootstrap-parameters",
"platform-engineers/system-operation/managing-clusters",
"platform-engineers/system-operation/observability",
"platform-engineers/system-operation/performance-finetuning",
"platform-engineers/system-operation/velaql",
],
},
"platform-engineers/debug/dry-run",
"platform-engineers/x-def-version",
],
},
{
type: "category",
label: "References",
items: [
"cli/vela",
{
type: "category",
label: "Built-in Addons",
items: [
"reference/addons/overview",
"reference/addons/velaux",
"reference/addons/terraform",
"reference/addons/ai"
],
},
"end-user/components/cloud-services/cloud-resources-list",
{
type: "category",
label: "Built-in Component Type",
items: [
"end-user/components/helm",
"end-user/components/cue/webservice",
"end-user/components/cue/worker",
"end-user/components/cue/task",
"end-user/components/cue/cron-task",
"end-user/components/kustomize",
"end-user/components/cue/raw",
"end-user/components/more",
],
},
{
type: "category",
label: "Built-in Trait Type",
items: [
"end-user/traits/scaler",
"end-user/traits/ingress",
"end-user/traits/storage",
"end-user/traits/rollout",
"end-user/traits/annotations-and-labels",
"end-user/traits/service-binding",
"end-user/traits/sidecar",
"end-user/traits/autoscaler",
"end-user/traits/kustomize-patch",
"end-user/traits/more",
],
},
{
type: "category",
label: "Built-in Policy Type",
items: ["end-user/policies/envbinding"],
},
"end-user/workflow/built-in-workflow-defs",
"end-user/service-account-integration",
"reference/ui-schema",
"reference/user-improvement-plan",
{
label: "VelaUX API Doc",
type: "link",
href: "https://kubevela.stoplight.io/docs/kubevela/b3A6NDI5NzQxMzM-detail-definition",
},
],
},
{
type: "category",
label: "Roadmap",
items: ["roadmap/README"],
},
{
type: "doc",
id: "developers/references/devex/faq",
},
],
};