diff --git a/controllers/sensor/validate.go b/controllers/sensor/validate.go index be38010a8f5d..c2deeab4a526 100644 --- a/controllers/sensor/validate.go +++ b/controllers/sensor/validate.go @@ -188,7 +188,7 @@ func validateArgoWorkflowTrigger(trigger *v1alpha1.ArgoWorkflowTrigger) error { return errors.New("must provide group, version and resource for the resource") } switch trigger.Operation { - case v1alpha1.Submit, v1alpha1.Suspend, v1alpha1.Retry, v1alpha1.Resume, v1alpha1.Resubmit: + case v1alpha1.Submit, v1alpha1.Suspend, v1alpha1.Retry, v1alpha1.Resume, v1alpha1.Resubmit, v1alpha1.Terminate: default: return errors.Errorf("unknown operation type %s", string(trigger.Operation)) } diff --git a/docs/sensors/triggers/argo-workflow.md b/docs/sensors/triggers/argo-workflow.md index d98efaabca93..b822fc416b97 100644 --- a/docs/sensors/triggers/argo-workflow.md +++ b/docs/sensors/triggers/argo-workflow.md @@ -66,6 +66,6 @@ To make use of Argo CLI operations, The sensor provides the `argoWorkflow` trigg group: argoproj.io version: v1alpha1 resource: workflows - operation: submit # submit, resubmit, resume, retry or suspend + operation: submit # submit, resubmit, resume, retry, suspend or terminate Complete example is available [here](https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/special-workflow-trigger.yaml). diff --git a/pkg/apis/sensor/v1alpha1/types.go b/pkg/apis/sensor/v1alpha1/types.go index 09344eeb45a0..f9f8970b6790 100644 --- a/pkg/apis/sensor/v1alpha1/types.go +++ b/pkg/apis/sensor/v1alpha1/types.go @@ -46,11 +46,12 @@ type ArgoWorkflowOperation string // possible values for ArgoWorkflowOperation const ( - Submit ArgoWorkflowOperation = "submit" // submit a workflow - Suspend ArgoWorkflowOperation = "suspend" // suspends a workflow - Resubmit ArgoWorkflowOperation = "resubmit" // resubmit a workflow - Retry ArgoWorkflowOperation = "retry" // retry a workflow - Resume ArgoWorkflowOperation = "resume" // resume a workflow + Submit ArgoWorkflowOperation = "submit" // submit a workflow + Suspend ArgoWorkflowOperation = "suspend" // suspends a workflow + Resubmit ArgoWorkflowOperation = "resubmit" // resubmit a workflow + Retry ArgoWorkflowOperation = "retry" // retry a workflow + Resume ArgoWorkflowOperation = "resume" // resume a workflow + Terminate ArgoWorkflowOperation = "terminate" // terminate a workflow ) // Comparator refers to the comparator operator for a data filter diff --git a/sensors/triggers/argo-workflow/argo-workflow.go b/sensors/triggers/argo-workflow/argo-workflow.go index 4008ebdfbb50..4e7c8177d211 100644 --- a/sensors/triggers/argo-workflow/argo-workflow.go +++ b/sensors/triggers/argo-workflow/argo-workflow.go @@ -164,6 +164,8 @@ func (t *ArgoWorkflowTrigger) Execute(ctx context.Context, events map[string]*v1 cmd = exec.Command("argo", "-n", namespace, "retry", name) case v1alpha1.Suspend: cmd = exec.Command("argo", "-n", namespace, "suspend", name) + case v1alpha1.Terminate: + cmd = exec.Command("argo", "-n", namespace, "terminate", name) default: return nil, errors.Errorf("unknown operation type %s", string(op)) }