Pipekit Docs
Search
⌃K

Pipekit CronWorkflows

Pipekit support of Argo CronWorkflows
Pipekit supports creating, updating, suspending, resuming and deleting Argo CronWorkflows. You can issue commands for CronWorkflows in multiple different ways:
  • git events
  • Pipekit CLI
  • Hera workflows

git events

CREATE action

To create (submit) a CronWorkflow via git events, user must create a Pipe and link a .yaml file to the CronWorkflow in the repo. Then when run condition is triggered, pipekitd will submit the CronWorkflow to the Cluster.
NOTE: Only one CronWorkflow YAML can run with a single Pipe on same cluster, this means every next git event will just updated the CronWorkflow. Because Pipe is linked to only one .yaml file, it is assumed that this is the same CronWorkflow and only updates are executed on that same CronWorkflow. This means no new CronWorkflow is triggered.
If this restriction is too heavy, please send us feedback via Slack or [email protected]

UPDATE action

To update a CronWorkflow via Git events, procedure is the same as for CREATE action. If user pushes another commit that triggers the same Pipe, pipekitd knows that the CronWorkflow is already running and in this case it will update it.

SUSPEND action

To suspend a CronWorkflow, use the toggle in the UI to mark the Pipe as inactive, this will trigger pipekitd to suspend the CronWorkflow associated with the Pipe.
Or, set .spec.suspend: true in .yaml manifest to mark that CronWorkflow should be suspended and then trigger new git event.
NOTE: There is no explicit button to click to suspend a CronWorkflow, but that should be added in the near future.

RESUME action

To resume suspended a CronWorkflow, use the toggle in the UI to mark the Pipe as active, this will trigger pipekitd to resume the CronWorkflow associated with the Pipe.
Or, set .spec.suspend: false in .yaml manifest to mark that CronWorkflow should be resumed and then trigger new git event.
NOTE: There is no explicit button to click to resume a CronWorkflow, but that should be added in the near future.

DELETE action

To delete a CronWorkflow, user can select Delete in the Pipe UI, this will trigger pipekitd to delete the CronWorkflow, associated with the pipe, from ALL clusters.
IMPORTANT: Deleting a Pipe will also delete all Runs and logs associated with the Pipe. Everything associated with the CronWorkflow will be lost when a Pipe is deleted.

generateName vs name for CronWorkflows

Pipekit treats generateName inside the CronWorkflows definition in the same way as kubernetes and argo do. So, submitting multiple Runs of the same CronWorkflow that are using generateName instead of name will result in multiple CronWorkflows submitted to the cluster with unique names, which can cause duplicative workflows (or Pipes in the Pipekit UI) based on the same cron schedule.
This can be a problem when using generateName while submitting CronWorkflow through git events. When a new git event triggers a workflow (i.e. if a new commit is pushed), that triggers run condition, and Pipekit/ Argo Workflows will create new CronWorkflow, and will not update the existing one.
To avoid this, we recommend using name instead of generateName in your CronWorkflow definition if you want to update the existing CronWorkflow Pipe instead of creating a new one.

Pipekit CLI

CREATE action

To create a CronWorkflow with the Pipekit CLI execute:
pipekit create cron -c CLUSTER_NAME path_to_cron.yaml
NOTE: You can use the Pipekit CLI to run a single CronWorkflow YAML on multiple Clusters.

UPDATE action

To update, execute:
pipekit update cron -c CLUSTER_NAME path_to_cron.yaml

SUSPEND action

To suspend, execute:
pipekit suspend cron -c CLUSTER_NAME -n NAMESPACE CRON_WORKFLOW_NAME
NOTE: You can use the Pipekit CLI to suspend a CronWorkflow on a single Cluster while leaving it active on other Clusters. To suspend the CronWorkflow on all Clusters, repeat the suspend command, or use the UI to disable the Pipe.

RESUME action

To resume, execute:
pipekit resume cron -c CLUSTER_NAME -n NAMESPACE CRON_WORKFLOW_NAME

DELETE action

To delete a CronWorkflow, execute:
pipekit delete cron -c CLUSTER_NAME -n NAMESPACE CRON_WORKFLOW_NAME
NOTE: You can use the Pipekit CLI to delete a CronWorkflow on a single Cluster while leaving it active on other Clusters. To delete the CronWorkflow on all Clusters, repeat the delete command.

Hera workflows

An example for how to define a CronWorkflow with the Hera Workflows Python SDK:
from hera import CronWorkflow, Task, WorkflowService
def hello():
print("Hello, Hera!")
wf_svc = WorkflowService(host="HOST_HERE" verify_ssl=False, token="TOKEN_HERE", namespace="NAMESPACE_HERE")
with CronWorkflow("hello-hera-cron6", "* * * * *", timezone="UTC", service=wf_svc) as cw:
Task("t", hello)
In the above example, CronWorkflow is defined by cw variable, this will be used in documentation below.
Specify the Cluster to run the CronWorkflow by changing the HOST_HERE variable. In the variable there is cluster uuid specified.
Example: How to run a CronWorkflow on a Cluster with uuid = 11111111-1111-1111-1111-111111111111:
_host = "https://pipekit.io/api/users/v1/clusters/11111111-1111-1111-1111-111111111111/hera"
wf_svc = WorkflowService(host=_host verify_ssl=False, token="TOKEN_HERE", namespace="NAMESPACE_HERE")

CREATE action

To create a CronWorkflow with Hera Workflows:
cw.create()

UPDATE action

To update:
cw.update()

SUSPEND action

To suspend:
cw.suspend()

RESUME action

To resume:
cw.resume()

DELETE action

To delete:
cw.delete()