ascend-aperator-apis
介绍
ascend-aperator-apis旨在为用户提供AscendJob API,及其Clientsets, Listers、Informers。使用户能轻松对AscendJob进行CRUD操作。
接口说明
-
创建clientsets
NewForConfig(c *rest.Config)(*Clientset, error)Parameters Input/Output Parameter Type Description c Input *rest.Config 客户端配置文件,由k8s提供的接口生成。包括cluster host、证书等信息 - Output *clientsets Client集合,包括AscendJob client和discovery client - Output error 错误信息 -
创建AscendJob
Create(ctx context.Context, job *v1.AscendJob, opts metav1.CreateOptions)(*v1.AscendJob, error)Parameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 job Input *v1.AscendJob AscendJob对象指针 opts Input metav1.CreateOptions 创建选项 - Output *v1.AscendJob AscendJob对象指针 - Output error 错误信息 -
获取AscendJob
Get(ctx context.Context, name string, opts metav1.GetOptions)(*v1.AscendJob, error)Parameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 name Input string AscendJob名称 opts Input metav1.GetOptions 获取选项 - Output *v1.AscendJob AscendJob对象指针 - Output error 错误信息 -
列举AscendJob
List(ctx context.Context, opts metav1.ListOptions)(*v1.AscendJobList, error)Parameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 opts Input metav1.ListOptions 列举选项 - Output *v1.AscendJob AscendJobList对象指针 - Output error 错误信息 -
观察AscendJob
Watch((ctx context.Context, opts metav1.ListOptions)(watch.Interface, error)Parameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 opts Input metav1.ListOptions 列举选项 - Output watch.Interface watch类接口 - Output error 错误信息 -
更新AscendJob
Update(ctx context.Context, job *v1.AscendJob, opts metav1.UpdateOptions)(*v1.AscendJob, error)Parameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 job Input *v1.AscendJob AscendJob对象指针 opts Input metav1.UpdateOptions 更新选项 - Output *v1.AscendJob AscendJob对象指针 - Output error 错误信息 -
更新AscendJob状态
UpdateStatus(ctx context.Context, job *v1.AscendJob, opts metav1.UpdateOptions)(*v1.AscendJob, error)Parameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 job Input *v1.AscendJob AscendJob对象指针 opts Input metav1.UpdateOptions 更新选项 - Output *v1.AscendJob AscendJob对象指针 - Output error 错误信息 -
补丁AscendJob
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.AscendJob, error)Parameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 name Input string AscendJob名称 pt Input types.PatchType patch类型 data Input []byte patch信息 subresources Input ...string 子信息 - Output *v1.AscendJob AscendJob对象指针 - Output error 错误信息 -
删除AscendJob
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) errorParameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 name Input string AscendJob名称 opts Input metav1.DeleteOptions 删除选项 - Output error 错误信息 -
批量删除AscendJob
DeleteCollection(ctx context.Context,opts metav1.DeleteOptions, listOpts metav1.ListOptions) errorParameters Input/Output Parameter Type Description ctx Input context.Context 上下文,协程控制 opts Input metav1.DeleteOptions 删除选项 listOpts Input metav1.ListOptions 列举选项 - Output error 错误信息 -
创建informerFactory
NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) sharedInformerFactoryParameters Input/Output Parameter Type Description client Input versioned.Interface client类接口 defaultResync Input time.Duration 默认的重新同步时间 - Output sharedInformerFactory informer类接口 -
创建informer
sharedInformerFactory.Batch().V1().Jobs().Informer()