From ceca965df337f81951e7e3880fe9b96e50fbedf0 Mon Sep 17 00:00:00 2001 From: yannic rieger Date: Wed, 11 Mar 2026 11:11:18 +0100 Subject: [PATCH 1/3] api: add stop workload rpc --- api/platformd/workload/v1alpha2/api.pb.go | 139 +++++++++++++++--- api/platformd/workload/v1alpha2/api.proto | 8 + .../workload/v1alpha2/api_grpc.pb.go | 38 +++++ 3 files changed, 164 insertions(+), 21 deletions(-) diff --git a/api/platformd/workload/v1alpha2/api.pb.go b/api/platformd/workload/v1alpha2/api.pb.go index 3cfbc865..ce1cb727 100644 --- a/api/platformd/workload/v1alpha2/api.pb.go +++ b/api/platformd/workload/v1alpha2/api.pb.go @@ -128,6 +128,87 @@ func (x *WorkloadStatusResponse) GetStatus() *WorkloadStatus { return nil } +type WorkloadStopRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *WorkloadStopRequest) Reset() { + *x = WorkloadStopRequest{} + mi := &file_platformd_workload_v1alpha2_api_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WorkloadStopRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkloadStopRequest) ProtoMessage() {} + +func (x *WorkloadStopRequest) ProtoReflect() protoreflect.Message { + mi := &file_platformd_workload_v1alpha2_api_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkloadStopRequest.ProtoReflect.Descriptor instead. +func (*WorkloadStopRequest) Descriptor() ([]byte, []int) { + return file_platformd_workload_v1alpha2_api_proto_rawDescGZIP(), []int{2} +} + +func (x *WorkloadStopRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type WorkloadStopResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *WorkloadStopResponse) Reset() { + *x = WorkloadStopResponse{} + mi := &file_platformd_workload_v1alpha2_api_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WorkloadStopResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkloadStopResponse) ProtoMessage() {} + +func (x *WorkloadStopResponse) ProtoReflect() protoreflect.Message { + mi := &file_platformd_workload_v1alpha2_api_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkloadStopResponse.ProtoReflect.Descriptor instead. +func (*WorkloadStopResponse) Descriptor() ([]byte, []int) { + return file_platformd_workload_v1alpha2_api_proto_rawDescGZIP(), []int{3} +} + var File_platformd_workload_v1alpha2_api_proto protoreflect.FileDescriptor var file_platformd_workload_v1alpha2_api_proto_rawDesc = []byte{ @@ -146,20 +227,32 @@ var file_platformd_workload_v1alpha2_api_proto_rawDesc = []byte{ 0x32, 0x2b, 0x2e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x8c, 0x01, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, - 0x61, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x79, 0x0a, 0x0e, 0x57, 0x6f, 0x72, - 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x2e, 0x70, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, - 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x33, 0x2e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2e, 0x77, 0x6f, 0x72, 0x6b, - 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x57, 0x6f, - 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x2f, 0x65, - 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6c, 0x61, 0x74, - 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x25, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, + 0x64, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x16, 0x0a, 0x14, + 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x81, 0x02, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, + 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x79, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, + 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x2e, 0x70, 0x6c, 0x61, + 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, + 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, + 0x2e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, + 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x57, 0x6f, 0x72, + 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x6c, + 0x6f, 0x61, 0x64, 0x12, 0x30, 0x2e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2e, + 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, + 0x64, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x32, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x6f, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x63, 0x68, 0x75, 0x6e, + 0x6b, 0x73, 0x2f, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x64, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, + 0x61, 0x64, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -174,18 +267,22 @@ func file_platformd_workload_v1alpha2_api_proto_rawDescGZIP() []byte { return file_platformd_workload_v1alpha2_api_proto_rawDescData } -var file_platformd_workload_v1alpha2_api_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_platformd_workload_v1alpha2_api_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_platformd_workload_v1alpha2_api_proto_goTypes = []any{ (*WorkloadStatusRequest)(nil), // 0: platformd.workload.v1alpha2.WorkloadStatusRequest (*WorkloadStatusResponse)(nil), // 1: platformd.workload.v1alpha2.WorkloadStatusResponse - (*WorkloadStatus)(nil), // 2: platformd.workload.v1alpha2.WorkloadStatus + (*WorkloadStopRequest)(nil), // 2: platformd.workload.v1alpha2.WorkloadStopRequest + (*WorkloadStopResponse)(nil), // 3: platformd.workload.v1alpha2.WorkloadStopResponse + (*WorkloadStatus)(nil), // 4: platformd.workload.v1alpha2.WorkloadStatus } var file_platformd_workload_v1alpha2_api_proto_depIdxs = []int32{ - 2, // 0: platformd.workload.v1alpha2.WorkloadStatusResponse.status:type_name -> platformd.workload.v1alpha2.WorkloadStatus + 4, // 0: platformd.workload.v1alpha2.WorkloadStatusResponse.status:type_name -> platformd.workload.v1alpha2.WorkloadStatus 0, // 1: platformd.workload.v1alpha2.WorkloadService.WorkloadStatus:input_type -> platformd.workload.v1alpha2.WorkloadStatusRequest - 1, // 2: platformd.workload.v1alpha2.WorkloadService.WorkloadStatus:output_type -> platformd.workload.v1alpha2.WorkloadStatusResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type + 2, // 2: platformd.workload.v1alpha2.WorkloadService.StopWorkload:input_type -> platformd.workload.v1alpha2.WorkloadStopRequest + 1, // 3: platformd.workload.v1alpha2.WorkloadService.WorkloadStatus:output_type -> platformd.workload.v1alpha2.WorkloadStatusResponse + 3, // 4: platformd.workload.v1alpha2.WorkloadService.StopWorkload:output_type -> platformd.workload.v1alpha2.WorkloadStopResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name @@ -203,7 +300,7 @@ func file_platformd_workload_v1alpha2_api_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_platformd_workload_v1alpha2_api_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/api/platformd/workload/v1alpha2/api.proto b/api/platformd/workload/v1alpha2/api.proto index d6a10a42..29a30223 100644 --- a/api/platformd/workload/v1alpha2/api.proto +++ b/api/platformd/workload/v1alpha2/api.proto @@ -27,6 +27,7 @@ option go_package = "github.com/spacechunks/explorer/api/platformd/workload/v1al service WorkloadService { rpc WorkloadStatus(WorkloadStatusRequest) returns (WorkloadStatusResponse); + rpc StopWorkload(WorkloadStopRequest) returns (WorkloadStopResponse); } message WorkloadStatusRequest { @@ -35,4 +36,11 @@ message WorkloadStatusRequest { message WorkloadStatusResponse { platformd.workload.v1alpha2.WorkloadStatus status = 1; +} + +message WorkloadStopRequest { + string id = 1; +} + +message WorkloadStopResponse { } \ No newline at end of file diff --git a/api/platformd/workload/v1alpha2/api_grpc.pb.go b/api/platformd/workload/v1alpha2/api_grpc.pb.go index 9785f426..925aed04 100644 --- a/api/platformd/workload/v1alpha2/api_grpc.pb.go +++ b/api/platformd/workload/v1alpha2/api_grpc.pb.go @@ -38,6 +38,7 @@ const _ = grpc.SupportPackageIsVersion9 const ( WorkloadService_WorkloadStatus_FullMethodName = "/platformd.workload.v1alpha2.WorkloadService/WorkloadStatus" + WorkloadService_StopWorkload_FullMethodName = "/platformd.workload.v1alpha2.WorkloadService/StopWorkload" ) // WorkloadServiceClient is the client API for WorkloadService service. @@ -45,6 +46,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type WorkloadServiceClient interface { WorkloadStatus(ctx context.Context, in *WorkloadStatusRequest, opts ...grpc.CallOption) (*WorkloadStatusResponse, error) + StopWorkload(ctx context.Context, in *WorkloadStopRequest, opts ...grpc.CallOption) (*WorkloadStopResponse, error) } type workloadServiceClient struct { @@ -65,11 +67,22 @@ func (c *workloadServiceClient) WorkloadStatus(ctx context.Context, in *Workload return out, nil } +func (c *workloadServiceClient) StopWorkload(ctx context.Context, in *WorkloadStopRequest, opts ...grpc.CallOption) (*WorkloadStopResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(WorkloadStopResponse) + err := c.cc.Invoke(ctx, WorkloadService_StopWorkload_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // WorkloadServiceServer is the server API for WorkloadService service. // All implementations must embed UnimplementedWorkloadServiceServer // for forward compatibility. type WorkloadServiceServer interface { WorkloadStatus(context.Context, *WorkloadStatusRequest) (*WorkloadStatusResponse, error) + StopWorkload(context.Context, *WorkloadStopRequest) (*WorkloadStopResponse, error) mustEmbedUnimplementedWorkloadServiceServer() } @@ -83,6 +96,9 @@ type UnimplementedWorkloadServiceServer struct{} func (UnimplementedWorkloadServiceServer) WorkloadStatus(context.Context, *WorkloadStatusRequest) (*WorkloadStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WorkloadStatus not implemented") } +func (UnimplementedWorkloadServiceServer) StopWorkload(context.Context, *WorkloadStopRequest) (*WorkloadStopResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopWorkload not implemented") +} func (UnimplementedWorkloadServiceServer) mustEmbedUnimplementedWorkloadServiceServer() {} func (UnimplementedWorkloadServiceServer) testEmbeddedByValue() {} @@ -122,6 +138,24 @@ func _WorkloadService_WorkloadStatus_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _WorkloadService_StopWorkload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(WorkloadStopRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WorkloadServiceServer).StopWorkload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WorkloadService_StopWorkload_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WorkloadServiceServer).StopWorkload(ctx, req.(*WorkloadStopRequest)) + } + return interceptor(ctx, in, info, handler) +} + // WorkloadService_ServiceDesc is the grpc.ServiceDesc for WorkloadService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -133,6 +167,10 @@ var WorkloadService_ServiceDesc = grpc.ServiceDesc{ MethodName: "WorkloadStatus", Handler: _WorkloadService_WorkloadStatus_Handler, }, + { + MethodName: "StopWorkload", + Handler: _WorkloadService_StopWorkload_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "platformd/workload/v1alpha2/api.proto", From b42f3268a47437291351fa4a8cde73b6efcf3046 Mon Sep 17 00:00:00 2001 From: yannic rieger Date: Wed, 11 Mar 2026 11:13:37 +0100 Subject: [PATCH 2/3] implement stop workload --- platformd/reconciler.go | 2 +- platformd/server.go | 2 +- platformd/workload/server.go | 33 ++++++++++++++++++++++++++++++--- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/platformd/reconciler.go b/platformd/reconciler.go index 47bd0273..ce975588 100644 --- a/platformd/reconciler.go +++ b/platformd/reconciler.go @@ -256,7 +256,7 @@ func (r *reconciler) handleInstanceCreation(ctx context.Context, instance *insta if st := r.store.Get(id); st != nil && st.WorkloadStatus != nil && st.WorkloadStatus.State != status.WorkloadStateCreating { - r.logger.InfoContext(ctx, "skip") + r.logger.InfoContext(ctx, "skip", "instance_id", id) return nil } diff --git a/platformd/server.go b/platformd/server.go index 5147ec1a..c9a0becc 100644 --- a/platformd/server.go +++ b/platformd/server.go @@ -140,7 +140,7 @@ func (s *Server) Run(ctx context.Context, cfg Config) error { ) proxyServer = proxy.NewServer(proxySvc) - wlServer = workload.NewServer(statusStore) + wlServer = workload.NewServer(statusStore, wlSvc) checkServer = checkpoint.NewServer(checkSvc) reconciler = newReconciler(s.logger, reconcilerConfig{ MaxAttempts: cfg.MaxAttempts, diff --git a/platformd/workload/server.go b/platformd/workload/server.go index 1631e2e1..5b129eb7 100644 --- a/platformd/workload/server.go +++ b/platformd/workload/server.go @@ -28,12 +28,14 @@ import ( type Server struct { workloadv1alpha2.UnimplementedWorkloadServiceServer - store status.Store + store status.Store + service Service } -func NewServer(store status.Store) *Server { +func NewServer(store status.Store, service Service) *Server { return &Server{ - store: store, + store: store, + service: service, } } @@ -56,3 +58,28 @@ func (s *Server) WorkloadStatus( Status: transport, }, nil } + +// TODO: tests + +func (s *Server) StopWorkload( + ctx context.Context, + req *workloadv1alpha2.WorkloadStopRequest, +) (*workloadv1alpha2.WorkloadStopResponse, error) { + id := req.GetId() + + if id == "" { + return nil, fmt.Errorf("workload id required") + } + + if err := s.service.RemoveWorkload(ctx, id); err != nil { + return nil, fmt.Errorf("remove workload: %w", err) + } + + s.store.Update(id, status.Status{ + WorkloadStatus: &status.WorkloadStatus{ + State: status.WorkloadStateDeleted, + }, + }) + + return &workloadv1alpha2.WorkloadStopResponse{}, nil +} From e313caa7e1dc0907b2b9b90ced55382820d6234d Mon Sep 17 00:00:00 2001 From: yannic rieger Date: Wed, 11 Mar 2026 11:17:26 +0100 Subject: [PATCH 3/3] regenerate mocks --- .../mock/v1alpha2_workload_service_client.go | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/internal/mock/v1alpha2_workload_service_client.go b/internal/mock/v1alpha2_workload_service_client.go index 2e24fb06..a0a995b0 100644 --- a/internal/mock/v1alpha2_workload_service_client.go +++ b/internal/mock/v1alpha2_workload_service_client.go @@ -23,6 +23,80 @@ func (_m *MockV1alpha2WorkloadServiceClient) EXPECT() *MockV1alpha2WorkloadServi return &MockV1alpha2WorkloadServiceClient_Expecter{mock: &_m.Mock} } +// StopWorkload provides a mock function with given fields: ctx, in, opts +func (_m *MockV1alpha2WorkloadServiceClient) StopWorkload(ctx context.Context, in *v1alpha2.WorkloadStopRequest, opts ...grpc.CallOption) (*v1alpha2.WorkloadStopResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for StopWorkload") + } + + var r0 *v1alpha2.WorkloadStopResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v1alpha2.WorkloadStopRequest, ...grpc.CallOption) (*v1alpha2.WorkloadStopResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v1alpha2.WorkloadStopRequest, ...grpc.CallOption) *v1alpha2.WorkloadStopResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1alpha2.WorkloadStopResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v1alpha2.WorkloadStopRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockV1alpha2WorkloadServiceClient_StopWorkload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopWorkload' +type MockV1alpha2WorkloadServiceClient_StopWorkload_Call struct { + *mock.Call +} + +// StopWorkload is a helper method to define mock.On call +// - ctx context.Context +// - in *v1alpha2.WorkloadStopRequest +// - opts ...grpc.CallOption +func (_e *MockV1alpha2WorkloadServiceClient_Expecter) StopWorkload(ctx interface{}, in interface{}, opts ...interface{}) *MockV1alpha2WorkloadServiceClient_StopWorkload_Call { + return &MockV1alpha2WorkloadServiceClient_StopWorkload_Call{Call: _e.mock.On("StopWorkload", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockV1alpha2WorkloadServiceClient_StopWorkload_Call) Run(run func(ctx context.Context, in *v1alpha2.WorkloadStopRequest, opts ...grpc.CallOption)) *MockV1alpha2WorkloadServiceClient_StopWorkload_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v1alpha2.WorkloadStopRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockV1alpha2WorkloadServiceClient_StopWorkload_Call) Return(_a0 *v1alpha2.WorkloadStopResponse, _a1 error) *MockV1alpha2WorkloadServiceClient_StopWorkload_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockV1alpha2WorkloadServiceClient_StopWorkload_Call) RunAndReturn(run func(context.Context, *v1alpha2.WorkloadStopRequest, ...grpc.CallOption) (*v1alpha2.WorkloadStopResponse, error)) *MockV1alpha2WorkloadServiceClient_StopWorkload_Call { + _c.Call.Return(run) + return _c +} + // WorkloadStatus provides a mock function with given fields: ctx, in, opts func (_m *MockV1alpha2WorkloadServiceClient) WorkloadStatus(ctx context.Context, in *v1alpha2.WorkloadStatusRequest, opts ...grpc.CallOption) (*v1alpha2.WorkloadStatusResponse, error) { _va := make([]interface{}, len(opts))