首页 / API 文档 / 运维中心 / 深度巡检 / 创建深度巡检任务

创建深度巡检任务

请求信息

请求行

POST /apis/testing.alauda.io/v1alpha1/namespaces/{namespace}/functiontests

创建一个深度巡检任务。

请求行参数

名称 类型 是否必填项 描述
namespace string 命名空间。对象名称和身份验证范围,例如团队和项目。

请求参数

名称 类型 是否必填项 描述
dryRun string 当该参数出现时,表示不应该持久化修改。一个无效的或无法识别的 dryRun 指令将导致错误响应,并且不会进一步处理请求。 有效值为:All,将处理所有的试运行阶段。
fieldManager string fieldManager 是与正在进行这些更改的参与者或实体相关联的名称。值必须少于 128 字符,且仅包含可打印字符,参见 https://golang.org/pkg/unicode/#IsPrint。
pretty string 如果为 true,则会将返回结果输出成适合打印的格式。

请求体

Content-Type application/json, application/yaml

请求体示例

深度巡检任务是 functiontests API 的结构。

{
   "apiVersion": "testing.alauda.io/v1alpha1",
   "kind": "FunctionTest",
   "metadata": {
     "annotations": {
       "cpaas.io/display-name": "check example"
     },
     "name": "check-example",
     "namespace": "cpaas-system"
   },
   "spec": {
     "environment": {
       "businessCluster": "global"
     },
     "failedJobHistoryLimit": 2,
     "functions": [
       "*"
     ],
     "schedule": "1 * * * *",
     "successfulJobHistoryLimit": 1,
     "suspend": false,
     "type": "check"
   }
 }

请求体说明

名称 类型 是否必填项 描述
apiVersion string 查看公共参数
kind string 查看公共参数
metadata object 查看公共参数
spec object FunctionTestSpec 定义了深度巡检的期望状态。
字段路径:spec
spec.environment object 检测对象的环境。
字段路径:spec.environment
environment.businessCluster string 目标企业集群的名称。
字段路径:spec.environment.businessCluster
spec.failedJobHistoryLimit integer (int32) 保留的未完成的定时任务个数。默认为 1。
字段路径:spec.failedJobHistoryLimit
spec.functions array 指定的计划测试的功能。
字段路径:spec.functions
spec.functions[] string
字段路径:spec.functions[]
spec.schedule string 定时任务格式中的调度安排。参见 https://en.wikipedia.org/wiki/Cron
字段路径:spec.schedule
spec.successfulJobHistoryLimit integer (int32) 保留的成功完成的任务记录的个数。默认为 3。
字段路径:spec.successfulJobHistoryLimit
spec.suspend boolean 此标志用于通知控制器挂起后续执行记录,不适用于已经准备好开始的执行记录。默认为 false。
字段路径:spec.suspend
spec.type string 指定巡检项的类型,check 或 test。
字段路径:spec.type

返回信息

Content-Type application/json, application/yaml

状态码: 201

Created

返回体示例

深度巡检任务是 functiontests API 的结构。

{
   "apiVersion": "testing.alauda.io/v1alpha1",
   "kind": "FunctionTest",
   "metadata": {
     "annotations": {
       "cpaas.io/display-name": "check example"
     },
     "creationTimestamp": "2021-06-08T10:02:11Z",
     "generation": 8,
     "name": "check-example",
     "namespace": "cpaas-system",
     "resourceVersion": "48604602",
     "selfLink": "/apis/testing.alauda.io/v1alpha1/namespaces/cpaas-system/functiontests/check-example",
     "uid": "e6bc4a4f-c050-451d-9375-1a3de04c6f58"
   },
   "spec": {
     "environment": {
       "businessCluster": "global"
     },
     "failedJobHistoryLimit": 2,
     "functions": [
       "*"
     ],
     "schedule": "1 * * * *",
     "successfulJobHistoryLimit": 1,
     "suspend": false,
     "type": "check"
   },
   "status": {
     "estimatedCpu": 300,
     "estimatedMemory": 300,
     "estimatedTime": 71,
     "lastScheduleResult": "failed",
     "lastScheduleTime": "2021-06-16T09:00:23Z"
   }
 }

返回体说明

名称 类型 描述
apiVersion string 查看公共参数
kind string 查看公共参数
metadata object 查看公共参数
spec object FunctionTestSpec 定义了深度巡检的期望状态。
字段路径:spec
spec.environment object 检测对象的环境。
字段路径:spec.environment
environment.businessCluster string 目标企业集群的名称。
字段路径:spec.environment.businessCluster
spec.failedJobHistoryLimit integer (int32) 保留的未完成的定时任务个数。默认为 1。
字段路径:spec.failedJobHistoryLimit
spec.functions array 指定的计划测试的功能。
字段路径:spec.functions
spec.functions[] string
字段路径:spec.functions[]
spec.schedule string 定时任务格式中的调度安排。参见 https://en.wikipedia.org/wiki/Cron
字段路径:spec.schedule
spec.successfulJobHistoryLimit integer (int32) 保留的成功完成的任务记录的个数。默认为 3。
字段路径:spec.successfulJobHistoryLimit
spec.suspend boolean 此标志用于通知控制器挂起后续执行记录,不适用于已经准备好开始的执行记录。默认为 false。
字段路径:spec.suspend
spec.type string 指定巡检项的类型,check 或 test。
字段路径:spec.type
status object FunctionTestStatus 定义了深度巡检任务被观察到的状态。
字段路径:status
status.active array 指向当前正在运行的定时任务的指针列表。
字段路径:status.active
status.active[] object ObjectReference 包含了您查看和修改被引用对象所需要的信息。不鼓励这种类型的新用法,因为在嵌入 api 时很难描述它的用法。 1. 被忽略的领域。它包括许多通常不被重视的领域。例如,ResourceVersion 和 FieldPath 在实际使用中都很少有效。 2. 无效的使用帮助。不可能为个别用法添加特定的使用帮助。在大多数嵌入式用法中,都有一些特殊的限制,比如“必须只引用类型 A 和 B”或“UID 没有权限”或“名称必须被限制”。当这些被嵌入时,就不能很好地描述了。 3. 不一致的验证。由于用法不同,验证规则也因用法不同而不同,这使得用户很难预测将会发生什么。 4. 这些字段既不精确又过于精确。Kind 并不是到 URL 的精确映射。这可能在解释过程中产生歧义,并需要 REST 映射。在大多数情况下,依赖于组,资源元组和实际结构的版本是无关的。 5. 我们不能轻易改变它。由于该类型嵌入在许多位置,因此对该类型的更新将影响许多模式。不要让新 API 嵌入它们不能控制的未指定的 API 类型。与其使用这种类型,不如创建一个本地提供和使用的类型,它非常关注您的引用。例如,用来做注册信息和进入许可的 ServiceReferences: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
字段路径:status.active[]
active[].apiVersion string 引用的 API 版本。
字段路径:status.active[].apiVersion
active[].fieldPath string 如果引用的是对象的一部分而不是整个对象,这个字符串应该包含一个有效的 JSON/Go 字段访问声明,比如:desiredState.manifest.containers[2]。
字段路径:status.active[].fieldPath
active[].kind string 引用的类型。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
字段路径:status.active[].kind
active[].name string 引用对象的名称。更多信息: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
字段路径:status.active[].name
active[].namespace string 引用的命名空间。更多信息:https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
字段路径:status.active[].namespace
active[].resourceVersion string 此引用所引用的资源版本。更多信息:https://git.k8s.io/community/contributors/devel/api-conventions.md # concurrency-control-and-consistency
字段路径:status.active[].resourceVersion
active[].uid string 引用的 UID。更多信息:https://kubernetes.io/docs/concepts/overview/working-with-objects/names/ #uids
字段路径:status.active[].uid
status.estimatedCpu integer (int64) 巡检任务运行时占用的 cpu 时间,单位是 m。
字段路径:status.estimatedCpu
status.estimatedMemory integer (int64) 巡检任务运行时占用的存储空间,单位是 Mi。
字段路径:status.estimatedMemory
status.estimatedTime integer (int64) 巡检任务预估运行时间。
字段路径:status.estimatedTime
status.lastScheduleResult string 定时任务最后一次调度的结果信息。
字段路径:status.lastScheduleResult
status.lastScheduleTime string (date-time) 定时任务最后一次调度成功的时间。
字段路径:status.lastScheduleTime

其他状态码

状态码: 200

OK

状态码: 202

Accepted

状态码: 401

Unauthorized