diff --git a/cmd/argocd/commands/app.go b/cmd/argocd/commands/app.go index c4935c7c479c1..2459f22130e1e 100644 --- a/cmd/argocd/commands/app.go +++ b/cmd/argocd/commands/app.go @@ -58,6 +58,7 @@ func NewApplicationCommand(clientOpts *argocdclient.ClientOptions) *cobra.Comman command.AddCommand(NewApplicationDeleteCommand(clientOpts)) command.AddCommand(NewApplicationWaitCommand(clientOpts)) command.AddCommand(NewApplicationManifestsCommand(clientOpts)) + command.AddCommand(NewApplicationTerminateOpCommand(clientOpts)) return command } @@ -1122,3 +1123,25 @@ func NewApplicationManifestsCommand(clientOpts *argocdclient.ClientOptions) *cob command.Flags().StringVar(&revision, "revision", "", "Show manifests at a specific revision") return command } + +// NewApplicationTerminateOpCommand returns a new instance of an `argocd app terminate-op` command +func NewApplicationTerminateOpCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { + var command = &cobra.Command{ + Use: "terminate-op APPNAME", + Short: "Terminate running operation of an application", + Run: func(c *cobra.Command, args []string) { + if len(args) != 1 { + c.HelpFunc()(c, args) + os.Exit(1) + } + appName := args[0] + conn, appIf := argocdclient.NewClientOrDie(clientOpts).NewApplicationClientOrDie() + defer util.Close(conn) + ctx := context.Background() + _, err := appIf.TerminateOperation(ctx, &application.OperationTerminateRequest{Name: &appName}) + errors.CheckError(err) + fmt.Printf("Application '%s' operation terminating\n", appName) + }, + } + return command +} diff --git a/controller/appcontroller.go b/controller/appcontroller.go index c01436da3e101..128995659abc5 100644 --- a/controller/appcontroller.go +++ b/controller/appcontroller.go @@ -327,21 +327,20 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli } else { state.Message = fmt.Sprintf("%v", r) } - ctrl.setOperationState(app, state, app.Operation) + ctrl.setOperationState(app, state) } }() - if isOperationRunning(app) { - // If we get here, we are about process an operation but we notice it is already Running. - // We need to detect if the controller crashed before completing the operation, or if the - // the app object we pulled off the informer is simply stale and doesn't reflect the fact - // that the operation is completed. We don't want to perform the operation again. To detect - // this, always retrieve the latest version to ensure it is not stale. + if isOperationInProgress(app) { + // If we get here, we are about process an operation but we notice it is already in progress. + // We need to detect if the app object we pulled off the informer is stale and doesn't + // reflect the fact that the operation is completed. We don't want to perform the operation + // again. To detect this, always retrieve the latest version to ensure it is not stale. freshApp, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(ctrl.namespace).Get(app.ObjectMeta.Name, metav1.GetOptions{}) if err != nil { log.Errorf("Failed to retrieve latest application state: %v", err) return } - if !isOperationRunning(freshApp) { + if !isOperationInProgress(freshApp) { log.Infof("Skipping operation on stale application state (%s)", app.ObjectMeta.Name) return } @@ -350,11 +349,27 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli log.Infof("Resuming in-progress operation. app: %s, phase: %s, message: %s", app.ObjectMeta.Name, state.Phase, state.Message) } else { state = &appv1.OperationState{Phase: appv1.OperationRunning, Operation: *app.Operation, StartedAt: metav1.Now()} - ctrl.setOperationState(app, state, app.Operation) + ctrl.setOperationState(app, state) log.Infof("Initialized new operation. app: %s, operation: %v", app.ObjectMeta.Name, *app.Operation) } ctrl.appStateManager.SyncAppState(app, state) - ctrl.setOperationState(app, state, app.Operation) + + if state.Phase == appv1.OperationRunning { + // It's possible for an app to be terminated while we were operating on it. We do not want + // to clobber the Terminated state with Running. Get the latest app state to check for this. + freshApp, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(ctrl.namespace).Get(app.ObjectMeta.Name, metav1.GetOptions{}) + if err == nil { + if freshApp.Status.OperationState != nil && freshApp.Status.OperationState.Phase == appv1.OperationTerminating { + state.Phase = appv1.OperationTerminating + state.Message = "operation is terminating" + // after this, we will get requeued to the workqueue, but next time the + // SyncAppState will operate in a Terminating phase, allowing the worker to perform + // cleanup (e.g. delete jobs, workflows, etc...) + } + } + } + + ctrl.setOperationState(app, state) if state.Phase.Completed() { // if we just completed an operation, force a refresh so that UI will report up-to-date // sync/health information @@ -362,39 +377,36 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli } } -func (ctrl *ApplicationController) setOperationState(app *appv1.Application, state *appv1.OperationState, operation *appv1.Operation) { +func (ctrl *ApplicationController) setOperationState(app *appv1.Application, state *appv1.OperationState) { retryUntilSucceed(func() error { - var inProgressOpValue *appv1.Operation if state.Phase == "" { // expose any bugs where we neglect to set phase panic("no phase was set") } - if !state.Phase.Completed() { - // If operation is still running, we populate the app.operation field, which prevents - // any other operation from running at the same time. Otherwise, it is cleared by setting - // it to nil which indicates no operation is in progress. - inProgressOpValue = operation - } else { - nowTime := metav1.Now() - state.FinishedAt = &nowTime + if state.Phase.Completed() { + now := metav1.Now() + state.FinishedAt = &now } - - if reflect.DeepEqual(app.Operation, inProgressOpValue) && reflect.DeepEqual(app.Status.OperationState, state) { - log.Infof("No operation updates necessary to '%s'. Skipping patch", app.Name) - return nil - } - - patch, err := json.Marshal(map[string]interface{}{ + patch := map[string]interface{}{ "status": map[string]interface{}{ "operationState": state, }, - "operation": inProgressOpValue, - }) + } + if state.Phase.Completed() { + // If operation is completed, clear the operation field to indicate no operation is + // in progress. + patch["operation"] = nil + } + if reflect.DeepEqual(app.Status.OperationState, state) { + log.Infof("No operation updates necessary to '%s'. Skipping patch", app.Name) + return nil + } + patchJSON, err := json.Marshal(patch) if err != nil { return err } appClient := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(ctrl.namespace) - _, err = appClient.Patch(app.Name, types.MergePatchType, patch) + _, err = appClient.Patch(app.Name, types.MergePatchType, patchJSON) if err != nil { return err } @@ -679,6 +691,6 @@ func newApplicationInformer( return informer } -func isOperationRunning(app *appv1.Application) bool { +func isOperationInProgress(app *appv1.Application) bool { return app.Status.OperationState != nil && !app.Status.OperationState.Phase.Completed() } diff --git a/controller/sync.go b/controller/sync.go index 0a1b26338c77a..a7fba43d92097 100644 --- a/controller/sync.go +++ b/controller/sync.go @@ -14,6 +14,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/discovery" "k8s.io/client-go/dynamic" "k8s.io/client-go/rest" @@ -153,7 +154,12 @@ func (s *ksonnetAppStateManager) SyncAppState(app *appv1.Application, state *app log: log.WithFields(log.Fields{"application": app.Name}), } - syncCtx.sync() + if state.Phase == appv1.OperationTerminating { + syncCtx.terminate() + } else { + syncCtx.sync() + } + if !syncOp.DryRun && syncCtx.opState.Phase.Successful() { err := s.persistDeploymentInfo(app, manifestInfo.Revision, manifestInfo.Params, nil) if err != nil { @@ -561,7 +567,8 @@ func (sc *syncContext) runHook(hook *unstructured.Unstructured, hookType appv1.H } else { liveObj = existing } - return sc.updateHookStatus(liveObj, hookType), nil + hookStatus := newHookStatus(liveObj, hookType) + return sc.updateHookStatus(hookStatus), nil } // isHookType tells whether or not the supplied object is a hook of the specified type @@ -648,10 +655,7 @@ func (sc *syncContext) getHookStatus(hookObj *unstructured.Unstructured, hookTyp return nil } -// updateHookStatus updates the status of a hook. Returns whether or not the hook was changed or not -func (sc *syncContext) updateHookStatus(hook *unstructured.Unstructured, hookType appv1.HookType) bool { - sc.lock.Lock() - defer sc.lock.Unlock() +func newHookStatus(hook *unstructured.Unstructured, hookType appv1.HookType) appv1.HookStatus { hookStatus := appv1.HookStatus{ Name: hook.GetName(), Kind: hook.GetKind(), @@ -714,17 +718,23 @@ func (sc *syncContext) updateHookStatus(hook *unstructured.Unstructured, hookTyp hookStatus.Status = appv1.OperationSucceeded hookStatus.Message = fmt.Sprintf("%s created", hook.GetName()) } + return hookStatus +} +// updateHookStatus updates the status of a hook. Returns whether or not the hook was changed or not +func (sc *syncContext) updateHookStatus(hookStatus appv1.HookStatus) bool { + sc.lock.Lock() + defer sc.lock.Unlock() for i, prev := range sc.syncRes.Hooks { - if prev.Name == hookStatus.Name && prev.Kind == hookStatus.Kind && prev.Type == hookType { + if prev.Name == hookStatus.Name && prev.Kind == hookStatus.Kind && prev.Type == hookStatus.Type { if reflect.DeepEqual(prev, hookStatus) { return false } if prev.Status != hookStatus.Status { - sc.log.Infof("Hook %s %s/%s status: %s -> %s", hookType, prev.Kind, prev.Name, prev.Status, hookStatus.Status) + sc.log.Infof("Hook %s %s/%s status: %s -> %s", hookStatus.Type, prev.Kind, prev.Name, prev.Status, hookStatus.Status) } if prev.Message != hookStatus.Message { - sc.log.Infof("Hook %s %s/%s message: '%s' -> '%s'", hookType, prev.Kind, prev.Name, prev.Message, hookStatus.Message) + sc.log.Infof("Hook %s %s/%s message: '%s' -> '%s'", hookStatus.Type, prev.Kind, prev.Name, prev.Message, hookStatus.Message) } sc.syncRes.Hooks[i] = &hookStatus return true @@ -751,3 +761,52 @@ func areHooksCompletedSuccessful(hookType appv1.HookType, hookStatuses []*appv1. } return true, isSuccessful } + +// terminate looks for any running jobs/workflow hooks and deletes the resource +func (sc *syncContext) terminate() { + terminateSuccessful := true + for _, hookStatus := range sc.syncRes.Hooks { + if hookStatus.Status.Completed() { + continue + } + switch hookStatus.Kind { + case "Job", "Workflow": + hookStatus.Status = appv1.OperationFailed + err := sc.deleteHook(hookStatus.Name, hookStatus.Kind, hookStatus.APIVersion) + if err != nil { + hookStatus.Message = fmt.Sprintf("Failed to delete %s hook %s/%s: %v", hookStatus.Type, hookStatus.Kind, hookStatus.Name, err) + terminateSuccessful = false + } else { + hookStatus.Message = fmt.Sprintf("Deleted %s hook %s/%s", hookStatus.Type, hookStatus.Kind, hookStatus.Name) + } + sc.updateHookStatus(*hookStatus) + } + } + if terminateSuccessful { + sc.setOperationPhase(appv1.OperationFailed, "Application terminated") + } else { + sc.setOperationPhase(appv1.OperationError, "Termination had errors") + } +} + +func (sc *syncContext) deleteHook(name, kind, apiVersion string) error { + groupVersion := strings.Split(apiVersion, "/") + if len(groupVersion) != 2 { + return fmt.Errorf("Failed to terminate app. Unrecognized group/version: %s", apiVersion) + } + gvk := schema.GroupVersionKind{ + Group: groupVersion[0], + Version: groupVersion[1], + Kind: kind, + } + dclient, err := sc.dynClientPool.ClientForGroupVersionKind(gvk) + if err != nil { + return err + } + apiResource, err := kube.ServerResourceForGroupVersionKind(sc.disco, gvk) + if err != nil { + return err + } + resIf := dclient.Resource(apiResource, sc.namespace) + return resIf.Delete(name, &metav1.DeleteOptions{}) +} diff --git a/pkg/apis/application/v1alpha1/generated.proto b/pkg/apis/application/v1alpha1/generated.proto index 0a7d6c7c0b80d..717307dbb07c3 100644 --- a/pkg/apis/application/v1alpha1/generated.proto +++ b/pkg/apis/application/v1alpha1/generated.proto @@ -233,10 +233,10 @@ message HookStatus { // Name is the resource name optional string name = 1; - // Name is the resource name + // Kind is the resource kind optional string kind = 2; - // Name is the resource name + // APIVersion is the resource API version optional string apiVersion = 3; // Type is the type of hook (e.g. PreSync, Sync, PostSync, Skip) diff --git a/pkg/apis/application/v1alpha1/types.go b/pkg/apis/application/v1alpha1/types.go index 456127d3150f1..473cf8390adc7 100644 --- a/pkg/apis/application/v1alpha1/types.go +++ b/pkg/apis/application/v1alpha1/types.go @@ -40,10 +40,11 @@ type Operation struct { type OperationPhase string const ( - OperationRunning OperationPhase = "Running" - OperationFailed OperationPhase = "Failed" - OperationError OperationPhase = "Error" - OperationSucceeded OperationPhase = "Succeeded" + OperationRunning OperationPhase = "Running" + OperationTerminating OperationPhase = "Terminating" + OperationFailed OperationPhase = "Failed" + OperationError OperationPhase = "Error" + OperationSucceeded OperationPhase = "Succeeded" ) func (os OperationPhase) Completed() bool { diff --git a/server/application/application.go b/server/application/application.go index 61def5dcc6b5e..fad483f8f36a5 100644 --- a/server/application/application.go +++ b/server/application/application.go @@ -625,3 +625,34 @@ func (s *Server) setAppOperation(ctx context.Context, appName string, operationC } } } + +func (s *Server) TerminateOperation(ctx context.Context, termOpReq *OperationTerminateRequest) (*OperationTerminateResponse, error) { + a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*termOpReq.Name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + if !s.enf.EnforceClaims(ctx.Value("claims"), "applications", "terminateop", appRBACName(*a)) { + return nil, grpc.ErrPermissionDenied + } + + for i := 0; i < 10; i++ { + if a.Operation == nil || a.Status.OperationState == nil { + return nil, status.Errorf(codes.InvalidArgument, "Unable to terminate operation. No operation is in progress") + } + a.Status.OperationState.Phase = appv1.OperationTerminating + _, err = s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Update(a) + if err == nil { + return &OperationTerminateResponse{}, nil + } + if !apierr.IsConflict(err) { + return nil, err + } + log.Warnf("Failed to set operation for app '%s' due to update conflict. Retrying again...", termOpReq.Name) + time.Sleep(100 * time.Millisecond) + a, err = s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*termOpReq.Name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + } + return nil, status.Errorf(codes.Internal, "Failed to terminate app. Too many conflicts") +} diff --git a/server/application/application.pb.go b/server/application/application.pb.go index 7062c7f71c736..a70b82063c307 100644 --- a/server/application/application.pb.go +++ b/server/application/application.pb.go @@ -25,6 +25,8 @@ ApplicationDeletePodRequest ApplicationPodLogsQuery LogEntry + OperationTerminateRequest + OperationTerminateResponse */ package application @@ -476,6 +478,36 @@ func (m *LogEntry) GetTimeStamp() k8s_io_apimachinery_pkg_apis_meta_v1.Time { return k8s_io_apimachinery_pkg_apis_meta_v1.Time{} } +type OperationTerminateRequest struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *OperationTerminateRequest) Reset() { *m = OperationTerminateRequest{} } +func (m *OperationTerminateRequest) String() string { return proto.CompactTextString(m) } +func (*OperationTerminateRequest) ProtoMessage() {} +func (*OperationTerminateRequest) Descriptor() ([]byte, []int) { + return fileDescriptorApplication, []int{13} +} + +func (m *OperationTerminateRequest) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +type OperationTerminateResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *OperationTerminateResponse) Reset() { *m = OperationTerminateResponse{} } +func (m *OperationTerminateResponse) String() string { return proto.CompactTextString(m) } +func (*OperationTerminateResponse) ProtoMessage() {} +func (*OperationTerminateResponse) Descriptor() ([]byte, []int) { + return fileDescriptorApplication, []int{14} +} + func init() { proto.RegisterType((*ApplicationQuery)(nil), "application.ApplicationQuery") proto.RegisterType((*ApplicationResourceEventsQuery)(nil), "application.ApplicationResourceEventsQuery") @@ -490,6 +522,8 @@ func init() { proto.RegisterType((*ApplicationDeletePodRequest)(nil), "application.ApplicationDeletePodRequest") proto.RegisterType((*ApplicationPodLogsQuery)(nil), "application.ApplicationPodLogsQuery") proto.RegisterType((*LogEntry)(nil), "application.LogEntry") + proto.RegisterType((*OperationTerminateRequest)(nil), "application.OperationTerminateRequest") + proto.RegisterType((*OperationTerminateResponse)(nil), "application.OperationTerminateResponse") } // Reference imports to suppress errors if they are not otherwise used. @@ -525,6 +559,8 @@ type ApplicationServiceClient interface { Sync(ctx context.Context, in *ApplicationSyncRequest, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Application, error) // Rollback syncs an application to its target state Rollback(ctx context.Context, in *ApplicationRollbackRequest, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Application, error) + // TerminateOperation terminates the currently running operation + TerminateOperation(ctx context.Context, in *OperationTerminateRequest, opts ...grpc.CallOption) (*OperationTerminateResponse, error) // DeletePod returns stream of log entries for the specified pod. Pod DeletePod(ctx context.Context, in *ApplicationDeletePodRequest, opts ...grpc.CallOption) (*ApplicationResponse, error) // PodLogs returns stream of log entries for the specified pod. Pod @@ -661,6 +697,15 @@ func (c *applicationServiceClient) Rollback(ctx context.Context, in *Application return out, nil } +func (c *applicationServiceClient) TerminateOperation(ctx context.Context, in *OperationTerminateRequest, opts ...grpc.CallOption) (*OperationTerminateResponse, error) { + out := new(OperationTerminateResponse) + err := grpc.Invoke(ctx, "/application.ApplicationService/TerminateOperation", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *applicationServiceClient) DeletePod(ctx context.Context, in *ApplicationDeletePodRequest, opts ...grpc.CallOption) (*ApplicationResponse, error) { out := new(ApplicationResponse) err := grpc.Invoke(ctx, "/application.ApplicationService/DeletePod", in, out, c.cc, opts...) @@ -727,6 +772,8 @@ type ApplicationServiceServer interface { Sync(context.Context, *ApplicationSyncRequest) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Application, error) // Rollback syncs an application to its target state Rollback(context.Context, *ApplicationRollbackRequest) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Application, error) + // TerminateOperation terminates the currently running operation + TerminateOperation(context.Context, *OperationTerminateRequest) (*OperationTerminateResponse, error) // DeletePod returns stream of log entries for the specified pod. Pod DeletePod(context.Context, *ApplicationDeletePodRequest) (*ApplicationResponse, error) // PodLogs returns stream of log entries for the specified pod. Pod @@ -938,6 +985,24 @@ func _ApplicationService_Rollback_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _ApplicationService_TerminateOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OperationTerminateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApplicationServiceServer).TerminateOperation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/application.ApplicationService/TerminateOperation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApplicationServiceServer).TerminateOperation(ctx, req.(*OperationTerminateRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _ApplicationService_DeletePod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ApplicationDeletePodRequest) if err := dec(in); err != nil { @@ -1021,6 +1086,10 @@ var _ApplicationService_serviceDesc = grpc.ServiceDesc{ MethodName: "Rollback", Handler: _ApplicationService_Rollback_Handler, }, + { + MethodName: "TerminateOperation", + Handler: _ApplicationService_TerminateOperation_Handler, + }, { MethodName: "DeletePod", Handler: _ApplicationService_DeletePod_Handler, @@ -1572,6 +1641,56 @@ func (m *LogEntry) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *OperationTerminateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperationTerminateRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Name == nil { + return 0, proto.NewRequiredNotSetError("name") + } else { + dAtA[i] = 0xa + i++ + i = encodeVarintApplication(dAtA, i, uint64(len(*m.Name))) + i += copy(dAtA[i:], *m.Name) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *OperationTerminateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperationTerminateResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + func encodeVarintApplication(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -1793,6 +1912,28 @@ func (m *LogEntry) Size() (n int) { return n } +func (m *OperationTerminateRequest) Size() (n int) { + var l int + _ = l + if m.Name != nil { + l = len(*m.Name) + n += 1 + l + sovApplication(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *OperationTerminateResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovApplication(x uint64) (n int) { for { n++ @@ -3509,6 +3650,143 @@ func (m *LogEntry) Unmarshal(dAtA []byte) error { } return nil } +func (m *OperationTerminateRequest) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApplication + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OperationTerminateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperationTerminateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApplication + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApplication + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Name = &s + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + default: + iNdEx = preIndex + skippy, err := skipApplication(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApplication + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return proto.NewRequiredNotSetError("name") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OperationTerminateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApplication + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OperationTerminateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperationTerminateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipApplication(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApplication + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipApplication(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -3617,83 +3895,86 @@ var ( func init() { proto.RegisterFile("server/application/application.proto", fileDescriptorApplication) } var fileDescriptorApplication = []byte{ - // 1235 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0x66, 0x6c, 0xd7, 0xb1, 0x27, 0x95, 0x40, 0x43, 0x1b, 0x56, 0xdb, 0xfc, 0xb0, 0x36, 0x49, - 0xeb, 0xb8, 0x74, 0x37, 0x89, 0x90, 0x40, 0x11, 0x12, 0x22, 0x24, 0xa4, 0x81, 0x50, 0x05, 0x87, - 0x0a, 0x89, 0x0b, 0x9a, 0xee, 0x4e, 0xd6, 0x4b, 0xec, 0x9d, 0x65, 0x66, 0x6c, 0x64, 0xaa, 0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x96, 0x02, 0x4f, 0xd1, 0x2a, 0x6f, 0x43, 0xe9, 0xea, 0xec, 0x74, 0xa9, 0xb4, 0xbf, - 0xd3, 0x2e, 0x05, 0xde, 0xbf, 0x2f, 0x84, 0xf5, 0x36, 0xbc, 0x76, 0xae, 0xbb, 0x0e, 0xa9, 0x77, - 0x41, 0x83, 0x45, 0xd4, 0xcb, 0xae, 0x9c, 0x76, 0xfa, 0x68, 0xfd, 0x58, 0x82, 0x2f, 0x68, 0xde, - 0x0e, 0xa9, 0x77, 0x40, 0xfd, 0x82, 0x1b, 0x6c, 0xa2, 0x27, 0x64, 0xc1, 0xba, 0x4b, 0x43, 0x81, - 0xa5, 0x80, 0xe4, 0xee, 0xab, 0xcc, 0x2c, 0xef, 0x3f, 0x1e, 0x84, 0x2e, 0x39, 0x22, 0x2e, 0x0d, - 0x3d, 0x6e, 0x54, 0x54, 0x6a, 0x92, 0xfb, 0x4f, 0xdf, 0x41, 0xb7, 0x61, 0x5d, 0x3d, 0xbf, 0x17, - 0xf4, 0x48, 0xd2, 0x6e, 0x2d, 0x3b, 0x56, 0x2a, 0x5b, 0x57, 0xaa, 0xac, 0xa0, 0x52, 0xa9, 0xec, - 0xc1, 0x86, 0x2d, 0xdf, 0x68, 0x67, 0x2f, 0x4b, 0x5e, 0x02, 0x07, 0xdd, 0x83, 0x20, 0x24, 0xdc, - 0xa8, 0x6a, 0x80, 0x99, 0x59, 0x16, 0xe3, 0x98, 0x76, 0xbb, 0xf4, 0x13, 0x63, 0xa6, 0x51, 0xca, - 0x8a, 0x11, 0xdb, 0xac, 0x4f, 0x61, 0xed, 0x80, 0xfa, 0xbb, 0xa1, 0x60, 0x43, 0x29, 0x20, 0x32, - 0x1c, 0x12, 0x8a, 0x38, 0x2d, 0xa9, 0x80, 0x24, 0x46, 0x74, 0x07, 0xd6, 0x45, 0xd0, 0x23, 0x47, - 0x02, 0xf7, 0xa2, 0xa4, 0x21, 0xff, 0x01, 0xef, 0x11, 0xb3, 0xd4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, 0x1e, 0x77, 0xee, 0x27, 0xb3, 0xcb, 0x03, 0xf4, 0x19, - 0x80, 0x33, 0xc9, 0xec, 0x83, 0x56, 0x26, 0x21, 0xe8, 0xc3, 0x91, 0x79, 0x35, 0x77, 0x2a, 0x9d, - 0x0f, 0xac, 0x97, 0x15, 0xf8, 0x06, 0x72, 0x9e, 0x1e, 0xdc, 0xe9, 0x52, 0x9f, 0xaf, 0x83, 0xed, - 0x57, 0x1f, 0x9f, 0x2d, 0x82, 0x5f, 0xcf, 0x16, 0xc1, 0xef, 0x67, 0x8b, 0xe0, 0x03, 0xbb, 0xe8, - 0x57, 0xf1, 0xf9, 0x7f, 0x0f, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x59, 0x12, 0x6d, 0x0c, 0x52, - 0x10, 0x00, 0x00, + // 1288 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x41, 0x8f, 0x1b, 0x35, + 0x14, 0xc6, 0xd9, 0x74, 0x77, 0xe3, 0xed, 0xa1, 0x32, 0x6d, 0x19, 0xa6, 0xe9, 0x36, 0x72, 0xb7, + 0x6d, 0x9a, 0xd2, 0x99, 0xee, 0x0a, 0x09, 0x54, 0x21, 0x21, 0x96, 0x96, 0xb6, 0xb0, 0x94, 0x25, + 0xdb, 0x0a, 0x89, 0x0b, 0x72, 0x67, 0xdc, 0xc9, 0xb0, 0x89, 0x3d, 0xd8, 0x4e, 0x50, 0xa8, 0x7a, + 0xa0, 0x42, 0x5c, 0x40, 0x42, 0x08, 0x0e, 0xdc, 0x80, 0x9e, 0xb9, 0x71, 0xe7, 0xdc, 0x23, 0x12, + 0xf7, 0x0a, 0xad, 0xb8, 0xf2, 0x1b, 0x40, 0xf6, 0xcc, 0x64, 0x3c, 0xdd, 0x64, 0xb6, 0x40, 0xb8, + 0x79, 0x9e, 0xed, 0xf7, 0x7d, 0x7e, 0xef, 0xd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e, 0xb2, 0xa2, 0x89, 0x7b, + 0x8a, 0x3a, 0xdb, 0x30, 0x44, 0x5e, 0xe8, 0x74, 0xaa, 0x88, 0x24, 0x3c, 0x94, 0xfe, 0xbd, 0xac, + 0x43, 0xbb, 0x8f, 0x3e, 0x05, 0x70, 0x29, 0xeb, 0xf0, 0xd0, 0xda, 0x2c, 0x04, 0xbb, 0x05, 0x74, + 0x8f, 0x95, 0x56, 0xe5, 0x5d, 0x10, 0x7e, 0xc9, 0x80, 0xaf, 0x23, 0xff, 0xe9, 0xc1, 0xfd, 0x3e, + 0x8f, 0xe4, 0x25, 0xb0, 0xf9, 0xca, 0xa3, 0xbd, 0x55, 0xf0, 0xeb, 0xde, 0x2a, 0xf8, 0x7d, 0x6f, + 0x15, 0xbc, 0xef, 0x55, 0xfd, 0xf6, 0xdf, 0xff, 0x1f, 0xc9, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x6a, 0x89, 0x9d, 0x9f, 0x38, 0x11, 0x00, 0x00, } diff --git a/server/application/application.pb.gw.go b/server/application/application.pb.gw.go index 2389055307a83..508ba730d203d 100644 --- a/server/application/application.pb.gw.go +++ b/server/application/application.pb.gw.go @@ -355,6 +355,33 @@ func request_ApplicationService_Rollback_0(ctx context.Context, marshaler runtim } +func request_ApplicationService_TerminateOperation_0(ctx context.Context, marshaler runtime.Marshaler, client ApplicationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq OperationTerminateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.StringP(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.TerminateOperation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + func request_ApplicationService_DeletePod_0(ctx context.Context, marshaler runtime.Marshaler, client ApplicationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ApplicationDeletePodRequest var metadata runtime.ServerMetadata @@ -804,6 +831,35 @@ func RegisterApplicationServiceHandlerClient(ctx context.Context, mux *runtime.S }) + mux.Handle("DELETE", pattern_ApplicationService_TerminateOperation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + 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_ApplicationService_TerminateOperation_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApplicationService_TerminateOperation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("DELETE", pattern_ApplicationService_DeletePod_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -888,6 +944,8 @@ var ( pattern_ApplicationService_Rollback_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v1", "applications", "name", "rollback"}, "")) + pattern_ApplicationService_TerminateOperation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v1", "applications", "name", "operation"}, "")) + pattern_ApplicationService_DeletePod_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "applications", "name", "pods", "podName"}, "")) pattern_ApplicationService_PodLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"api", "v1", "applications", "name", "pods", "podName", "logs"}, "")) @@ -916,6 +974,8 @@ var ( forward_ApplicationService_Rollback_0 = runtime.ForwardResponseMessage + forward_ApplicationService_TerminateOperation_0 = runtime.ForwardResponseMessage + forward_ApplicationService_DeletePod_0 = runtime.ForwardResponseMessage forward_ApplicationService_PodLogs_0 = runtime.ForwardResponseStream diff --git a/server/application/application.proto b/server/application/application.proto index e4544a6917527..0678b5902fcea 100644 --- a/server/application/application.proto +++ b/server/application/application.proto @@ -92,6 +92,13 @@ message LogEntry { required k8s.io.apimachinery.pkg.apis.meta.v1.Time timeStamp = 2 [(gogoproto.nullable) = false]; } +message OperationTerminateRequest { + required string name = 1; +} + +message OperationTerminateResponse { +} + // ApplicationService service ApplicationService { @@ -165,6 +172,13 @@ service ApplicationService { }; } + // TerminateOperation terminates the currently running operation + rpc TerminateOperation(OperationTerminateRequest) returns (OperationTerminateResponse) { + option (google.api.http) = { + delete: "/api/v1/applications/{name}/operation"; + }; + } + // DeletePod returns stream of log entries for the specified pod. Pod rpc DeletePod(ApplicationDeletePodRequest) returns (ApplicationResponse) { option (google.api.http).delete = "/api/v1/applications/{name}/pods/{podName}"; diff --git a/server/swagger.json b/server/swagger.json index d90bb7e3a56a4..983c4d492bc44 100644 --- a/server/swagger.json +++ b/server/swagger.json @@ -239,6 +239,31 @@ } } }, + "/api/v1/applications/{name}/operation": { + "delete": { + "tags": [ + "ApplicationService" + ], + "summary": "TerminateOperation terminates the currently running operation", + "operationId": "TerminateOperation", + "parameters": [ + { + "type": "string", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/applicationOperationTerminateResponse" + } + } + } + } + }, "/api/v1/applications/{name}/pods/{podName}": { "delete": { "tags": [ @@ -1113,6 +1138,9 @@ } } }, + "applicationOperationTerminateResponse": { + "type": "object" + }, "clusterClusterResponse": { "type": "object" }, @@ -1968,11 +1996,11 @@ "properties": { "apiVersion": { "type": "string", - "title": "Name is the resource name" + "title": "APIVersion is the resource API version" }, "kind": { "type": "string", - "title": "Name is the resource name" + "title": "Kind is the resource kind" }, "message": { "description": "A human readable message indicating details about why the resource is in this condition.", diff --git a/util/rbac/builtin-policy.csv b/util/rbac/builtin-policy.csv index 58959846491ab..b646a843a7e4f 100644 --- a/util/rbac/builtin-policy.csv +++ b/util/rbac/builtin-policy.csv @@ -17,6 +17,7 @@ p, role:admin, applications, update, */* p, role:admin, applications, delete, */* p, role:admin, applications, sync, */* p, role:admin, applications, rollback, */* +p, role:admin, applications, terminateop, */* p, role:admin, applications/pods, delete, */* p, role:admin, clusters, create, */* p, role:admin, clusters, update, */*