mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-04 21:32:39 +08:00
Updated List endpoint to take in an optional WorkflowTemplateUID.
- If present, code will try to filter the CronWorkflows by the label "onepanel.io/workflow-template-uid" - If not present, all CronWorkflows are returned as normal.
This commit is contained in:
@@ -224,8 +224,9 @@ func (m *UpdateCronWorkflowRequest) GetCronWorkflow() *CronWorkflow {
|
||||
|
||||
type ListCronWorkflowRequest struct {
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,4,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
|
||||
Page int32 `protobuf:"varint,5,opt,name=page,proto3" json:"page,omitempty"`
|
||||
WorkflowTemplateUid string `protobuf:"bytes,2,opt,name=workflow_template_uid,json=workflowTemplateUid,proto3" json:"workflow_template_uid,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
|
||||
Page int32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@@ -263,6 +264,13 @@ func (m *ListCronWorkflowRequest) GetNamespace() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListCronWorkflowRequest) GetWorkflowTemplateUid() string {
|
||||
if m != nil {
|
||||
return m.WorkflowTemplateUid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListCronWorkflowRequest) GetPageSize() int32 {
|
||||
if m != nil {
|
||||
return m.PageSize
|
||||
@@ -464,51 +472,54 @@ func init() {
|
||||
func init() { proto.RegisterFile("cron_workflow.proto", fileDescriptor_989cccaad551a50c) }
|
||||
|
||||
var fileDescriptor_989cccaad551a50c = []byte{
|
||||
// 704 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00,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0x9f, 0x19, 0x98, 0xeb, 0x77, 0xea, 0xe5, 0xde, 0xe8, 0xcb, 0xbd, 0x05, 0x39, 0x49,
|
||||
0xdf, 0x62, 0x23, 0xf4, 0xba, 0x67, 0xd2, 0x8b, 0x23, 0x4d, 0xb1, 0x36, 0x9e, 0x09, 0x1e, 0xe3,
|
||||
0xe4, 0x9d, 0x5e, 0x4c, 0x4c, 0x98, 0x95, 0xa1, 0xf4, 0x91, 0x37, 0x34, 0x54, 0xce, 0xe9, 0x86,
|
||||
0xe4, 0x01, 0x14, 0xa8, 0xe0, 0x34, 0x0c, 0x02, 0xe4, 0xb4, 0x73, 0x20, 0x3c, 0x46, 0x3b, 0x9a,
|
||||
0x2e, 0xef, 0xa4, 0x05, 0xf2, 0x18, 0x16, 0xa4, 0x72, 0x03, 0xc5, 0x78, 0x6b, 0x07, 0xdd, 0x86,
|
||||
0xc7, 0x38, 0x1e, 0x22, 0x15, 0xbc, 0x21, 0xcd, 0x99, 0xb2, 0x51, 0xc9, 0x38, 0xe3, 0x64, 0xb2,
|
||||
0x05, 0x96, 0x0c, 0x29, 0x45, 0x29, 0x9b, 0xa1, 0xb7, 0x27, 0xea, 0xf2, 0x15, 0x93, 0x4a, 0x04,
|
||||
0x9d, 0x7d, 0xd6, 0x66, 0xca, 0x9c, 0xd5, 0xe9, 0xb8, 0x64, 0x06, 0xd9, 0x80, 0x62, 0xd3, 0x65,
|
||||
0x1e, 0x36, 0x52, 0x6b, 0x73, 0x7a, 0xed, 0x18, 0x95, 0xec, 0x40, 0xa1, 0xdb, 0x2d, 0x76, 0x3f,
|
||||
0x20, 0x0d, 0xa3, 0xee, 0x63, 0xe6, 0xf5, 0x95, 0x2d, 0xea, 0xd3, 0x3d, 0x1a, 0x56, 0x9d, 0xf4,
|
||||
0x82, 0xf5, 0xdf, 0x59, 0x98, 0xef, 0x3f, 0x9c, 0x43, 0x0c, 0x4e, 0x18, 0x45, 0xf2, 0xd5, 0x00,
|
||||
0x92, 0x2e, 0x67, 0xb2, 0x9c, 0xdc, 0x9b, 0x31, 0x75, 0x6e, 0xa5, 0xef, 0x95, 0xfd, 0xfc, 0xd3,
|
||||
0x9f, 0xbf, 0xdf, 0xa7, 0x36, 0xed, 0xfb, 0x51, 0xa7, 0x94, 0xb5, 0x93, 0xb5, 0x3a, 0x2a, 0x77,
|
||||
0xad, 0xf6, 0xb1, 0x57, 0x07, 0xe7, 0xb5, 0x81, 0x1e, 0xfb, 0x74, 0xa0, 0xba, 0xc8, 0x37, 0x03,
|
||||
0x48, 0xba, 0xc8, 0x13, 0x90, 0xb1, 0xd5, 0x3f, 0x0a, 0x64, 0x47, 0x83, 0x6c, 0xd9, 0xd5, 0x09,
|
||||
0x41, 0x62, 0xe5, 0x7c, 0x88, 0xa7, 0x03, 0xb7, 0x87, 0x5a, 0x26, 0x59, 0xd2, 0x5e, 0xa3, 0x1b,
|
||||
0xe9, 0x28, 0x90, 0x0d, 0x0d, 0xb2, 0x4a, 0xfe, 0x13, 0x84, 0x7c, 0x36, 0xa0, 0x90, 0xaa, 0x7f,
|
||||
0x52, 0xd2, 0x06, 0x63, 0x3a, 0x90, 0xb5, 0x3c, 0x52, 0xed, 0x75, 0x0d, 0x7b, 0x55, 0xb3, 0xac,
|
||||
0x90, 0xca, 0x84, 0x2c, 0x92, 0xfc, 0x30, 0xe0, 0xee, 0xc8, 0x67, 0x88, 0xdc, 0xd3, 0x5e, 0x97,
|
||||
0x3d, 0x51, 0x56, 0xb1, 0x1a, 0xbf, 0x8b, 0xd5, 0xee, 0xbb, 0x58, 0xdd, 0x8d, 0xde, 0x45, 0xfb,
|
||||
0x85, 0xc6, 0x78, 0xb6, 0xf2, 0x64, 0x52, 0x8c, 0x24, 0x27, 0x35, 0xd5, 0x75, 0xab, 0xcf, 0xe8,
|
||||
0x2d, 0x1f, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x68, 0x13, 0xb5, 0xa6, 0xb2, 0x07, 0x00, 0x00,
|
||||
// 740 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xdd, 0x4e, 0xdb, 0x48,
|
||||
0x14, 0xc7, 0x65, 0x42, 0x20, 0x39, 0xcb, 0xee, 0x2a, 0xc3, 0x12, 0x8c, 0x89, 0x10, 0xeb, 0x9b,
|
||||
0x45, 0xab, 0x55, 0xbc, 0xb0, 0x5a, 0xe8, 0x87, 0x8a, 0xda, 0x02, 0x6a, 0x85, 0xb8, 0x40, 0x06,
|
||||
0x84, 0xd4, 0x1b, 0xe4, 0x8c, 0x4f, 0xd2, 0x51, 0x9d, 0x19, 0xd7, 0x33, 0x86, 0x06, 0xc4, 0x4d,
|
||||
0x55, 0xf5, 0xa6, 0xea, 0x55, 0xd5, 0x9b, 0xf6, 0x35, 0xfa, 0x0e, 0x7d, 0x80, 0xbe, 0x42, 0x1f,
|
||||
0xa4, 0xf2, 0xc4, 0x09, 0x49, 0x9c, 0xa0, 0x14, 0x71, 0x65, 0x9f, 0xf9, 0x9f, 0x99, 0xf3, 0x9b,
|
||||
0xaf, 0xff, 0xc0, 0x2c, 0x8d, 0x04, 0x3f, 0x39, 0x13, 0xd1, 0x8b, 0x7a, 0x20, 0xce, 0xaa, 0x61,
|
||||
0x24, 0x94, 0x20, 0x39, 0x2f, 0x64, 0x56, 0xa5, 0x21, 0x44, 0x23, 0x40, 0xc7, 0x0b, 0x99, 0xe3,
|
||||
0x71, 0x2e, 0x94, 0xa7, 0x98, 0xe0, 0xb2, 0x9d, 0x62, 0x2d, 0xa6, 0xaa, 0x8e, 0x6a, 0x71, 0xdd,
|
||||
0xc1, 0x66, 0xa8, 0x5a, 0xa9, 0x38, 0xdf, 0x19, 0xef, 0x44, 0x61, 0x33, 0x0c, 0x3c, 0x85, 0xa9,
|
||||
0xf0, 0x5b, 0x7f, 0x21, 0x6b, 0xa6, 0x89, 0x2a, 0x62, 0xb4, 0x1d, 0xd9, 0xf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f0, 0x95, 0xe8, 0xcf, 0xeb,
|
||||
0x02, 0xe4, 0xae, 0x00, 0x92, 0x12, 0xc9, 0x57, 0xa6, 0x54, 0xed, 0x80, 0x2c, 0x01, 0x28, 0xa1,
|
||||
0xbc, 0x60, 0x4b, 0x57, 0xcf, 0x6b, 0xa9, 0xa7, 0xc5, 0xfe, 0x94, 0x83, 0x99, 0xde, 0x4a, 0xdd,
|
||||
0x0d, 0x33, 0x7a, 0x36, 0xcc, 0x82, 0x82, 0xa4, 0xcf, 0xd1, 0x8f, 0x83, 0xce, 0x46, 0x76, 0xe3,
|
||||
0x44, 0x53, 0xac, 0x89, 0xe7, 0x82, 0xb7, 0x71, 0x8a, 0x6e, 0x37, 0x26, 0x26, 0x4c, 0xcb, 0x58,
|
||||
0x86, 0xc8, 0x7d, 0x0d, 0x55, 0x70, 0x3b, 0x21, 0xf9, 0x07, 0x4a, 0x54, 0x70, 0x1a, 0x47, 0x11,
|
||||
0x72, 0xda, 0xda, 0x17, 0x01, 0xa3, 0x2d, 0x4d, 0x57, 0x74, 0xb3, 0x02, 0xb9, 0x03, 0xf3, 0x52,
|
||||
0x79, 0x91, 0x62, 0xbc, 0xb1, 0x8d, 0x9e, 0x1f, 0x30, 0x8e, 0x07, 0x48, 0x05, 0xf7, 0xa5, 0x39,
|
||||
0xb5, 0x6c, 0xac, 0xe4, 0xdc, 0x51, 0x32, 0xd9, 0x04, 0x4b, 0xc6, 0x94, 0xa2, 0x94, 0xf5, 0x38,
|
||||
0xd8, 0x15, 0x35, 0xf9, 0x94, 0x49, 0x25, 0xa2, 0xd6, 0x1e, 0x6b, 0x32, 0x65, 0x4e, 0xeb, 0xe5,
|
||||
0xb8, 0x26, 0x83, 0xac, 0x43, 0xb9, 0xee, 0xb1, 0x00, 0xfd, 0x4c, 0xdf, 0x82, 0xee, 0x3b, 0x42,
|
||||
0x25, 0xdb, 0x50, 0xea, 0x1c, 0xaa, 0x9d, 0x57, 0x48, 0xe3, 0xc4, 0xb2, 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x6a, 0xe7, 0x41, 0xae, 0xee, 0x24,
|
||||
0x0f, 0xb2, 0xfd, 0x48, 0x4f, 0xe5, 0xfe, 0xdf, 0x77, 0xc7, 0xc7, 0xd3, 0xeb, 0xea, 0xa8, 0x4e,
|
||||
0xb5, 0xda, 0x94, 0x1e, 0xf2, 0xbf, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x74, 0x56, 0x62, 0x2e,
|
||||
0x2b, 0x08, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@@ -338,6 +338,97 @@ func local_request_CronWorkflowService_ListCronWorkflows_0(ctx context.Context,
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_CronWorkflowService_ListCronWorkflows_1 = &utilities.DoubleArray{Encoding: map[string]int{"namespace": 0, "workflow_template_uid": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
|
||||
)
|
||||
|
||||
func request_CronWorkflowService_ListCronWorkflows_1(ctx context.Context, marshaler runtime.Marshaler, client CronWorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListCronWorkflowRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["namespace"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
|
||||
}
|
||||
|
||||
protoReq.Namespace, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["workflow_template_uid"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "workflow_template_uid")
|
||||
}
|
||||
|
||||
protoReq.WorkflowTemplateUid, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "workflow_template_uid", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CronWorkflowService_ListCronWorkflows_1); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ListCronWorkflows(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_CronWorkflowService_ListCronWorkflows_1(ctx context.Context, marshaler runtime.Marshaler, server CronWorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListCronWorkflowRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["namespace"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
|
||||
}
|
||||
|
||||
protoReq.Namespace, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["workflow_template_uid"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "workflow_template_uid")
|
||||
}
|
||||
|
||||
protoReq.WorkflowTemplateUid, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "workflow_template_uid", err)
|
||||
}
|
||||
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_CronWorkflowService_ListCronWorkflows_1); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ListCronWorkflows(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_CronWorkflowService_TerminateCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, client CronWorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq TerminateCronWorkflowRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -499,6 +590,26 @@ func RegisterCronWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_CronWorkflowService_ListCronWorkflows_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_CronWorkflowService_ListCronWorkflows_1(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_CronWorkflowService_ListCronWorkflows_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("DELETE", pattern_CronWorkflowService_TerminateCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -640,6 +751,26 @@ func RegisterCronWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_CronWorkflowService_ListCronWorkflows_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_CronWorkflowService_ListCronWorkflows_1(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_CronWorkflowService_ListCronWorkflows_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("DELETE", pattern_CronWorkflowService_TerminateCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -672,6 +803,8 @@ var (
|
||||
|
||||
pattern_CronWorkflowService_ListCronWorkflows_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "cron_workflows"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_CronWorkflowService_ListCronWorkflows_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "cron_workflows", "workflow_template_uid"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_CronWorkflowService_TerminateCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "cron_workflows", "name", "terminate"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
@@ -684,5 +817,7 @@ var (
|
||||
|
||||
forward_CronWorkflowService_ListCronWorkflows_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_CronWorkflowService_ListCronWorkflows_1 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_CronWorkflowService_TerminateCronWorkflow_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
@@ -32,6 +32,9 @@ service CronWorkflowService {
|
||||
rpc ListCronWorkflows(ListCronWorkflowRequest) returns (ListCronWorkflowsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/apis/v1beta1/{namespace}/cron_workflows"
|
||||
additional_bindings {
|
||||
get: "/apis/v1beta1/{namespace}/cron_workflows/{workflow_template_uid}"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,8 +69,9 @@ message UpdateCronWorkflowRequest {
|
||||
|
||||
message ListCronWorkflowRequest {
|
||||
string namespace = 1;
|
||||
int32 pageSize = 4;
|
||||
int32 page = 5;
|
||||
string workflow_template_uid = 2;
|
||||
int32 pageSize = 3;
|
||||
int32 page = 4;
|
||||
}
|
||||
|
||||
message ListCronWorkflowsResponse {
|
||||
|
@@ -2,10 +2,8 @@ package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
|
||||
argojson "github.com/argoproj/pkg/json"
|
||||
"github.com/google/uuid"
|
||||
"github.com/onepanelio/core/pkg/util"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -135,7 +133,7 @@ func (c *Client) CreateCronWorkflow(namespace string, cronWorkflow *CronWorkflow
|
||||
|
||||
for _, wf := range workflows {
|
||||
argoCronWorkflow.Spec.WorkflowSpec = wf.Spec
|
||||
argoCreatedCronWorkflow, err := c.createCronWorkflow(namespace, workflowTemplate.ID, &argoCronWorkflow, opts)
|
||||
argoCreatedCronWorkflow, err := c.createCronWorkflow(namespace, workflowTemplate.UID, &argoCronWorkflow, opts)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
@@ -184,8 +182,12 @@ func (c *Client) GetCronWorkflow(namespace, name string) (cronWorkflow *CronWork
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) ListCronWorkflows(namespace string) (cronWorkflows []*CronWorkflow, err error) {
|
||||
cronWorkflowList, err := c.ArgoprojV1alpha1().CronWorkflows(namespace).List(ListOptions{})
|
||||
func (c *Client) ListCronWorkflows(namespace, workflowTemplateUID string) (cronWorkflows []*CronWorkflow, err error) {
|
||||
listOptions := ListOptions{}
|
||||
if workflowTemplateUID != "" {
|
||||
listOptions.LabelSelector = "onepanel.io/workflow-template-uid=" + workflowTemplateUID
|
||||
}
|
||||
cronWorkflowList, err := c.ArgoprojV1alpha1().CronWorkflows(namespace).List(listOptions)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
@@ -292,35 +294,35 @@ func (c *Client) updateCronWorkflow(namespace string, name string, cwf *wfv1.Cro
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) createCronWorkflow(namespace string, workflowTemplateId uint64, cwf *wfv1.CronWorkflow, opts *WorkflowExecutionOptions) (createdCronWorkflow *wfv1.CronWorkflow, err error) {
|
||||
uidRaw, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uid := uidRaw.String()
|
||||
|
||||
tx, err := c.DB.Begin()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
rows, err := sb.Insert("cron_workflows_templates").
|
||||
SetMap(sq.Eq{
|
||||
"uid": uid,
|
||||
"namespace": namespace,
|
||||
"workflow_template_id": workflowTemplateId,
|
||||
}).RunWith(tx).Query()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = rows.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = tx.Commit(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
func (c *Client) createCronWorkflow(namespace string, workflowTemplateUid string, cwf *wfv1.CronWorkflow, opts *WorkflowExecutionOptions) (createdCronWorkflow *wfv1.CronWorkflow, err error) {
|
||||
//uidRaw, err := uuid.NewRandom()
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//uid := uidRaw.String()
|
||||
//
|
||||
//tx, err := c.DB.Begin()
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//defer tx.Rollback()
|
||||
//
|
||||
//rows, err := sb.Insert("cron_workflows_templates").
|
||||
// SetMap(sq.Eq{
|
||||
// "uid": uid,
|
||||
// "namespace": namespace,
|
||||
// "workflow_template_id": workflowTemplateId,
|
||||
// }).RunWith(tx).Query()
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//err = rows.Close()
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//if err = tx.Commit(); err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
|
||||
if opts == nil {
|
||||
opts = &WorkflowExecutionOptions{}
|
||||
@@ -366,6 +368,11 @@ func (c *Client) createCronWorkflow(namespace string, workflowTemplateId uint64,
|
||||
//if err = c.injectAutomatedFields(namespace, cwf.Spec.WorkflowSpec, opts); err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//todo move earlier
|
||||
var cwfLabels map[string]string
|
||||
cwfLabels = make(map[string]string)
|
||||
cwfLabels["workflowTemplateUid"] = workflowTemplateUid
|
||||
//cwf.Labels
|
||||
|
||||
createdCronWorkflow, err = c.ArgoprojV1alpha1().CronWorkflows(namespace).Create(cwf)
|
||||
if err != nil {
|
||||
|
@@ -156,7 +156,7 @@ func (c *CronWorkflowServer) ListCronWorkflows(ctx context.Context, req *api.Lis
|
||||
req.PageSize = 15
|
||||
}
|
||||
|
||||
cronWorkflows, err := client.ListCronWorkflows(req.Namespace)
|
||||
cronWorkflows, err := client.ListCronWorkflows(req.Namespace, req.WorkflowTemplateUid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user