From 097fe9210564c382d933eca5c78d5a82dfaba88c Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Fri, 25 Jun 2021 13:57:51 -0700 Subject: [PATCH] docs: Add workflow-count-resourcequota.yaml example (#6225) Signed-off-by: Alex Collins --- docs/fields.md | 10 +++++++++ examples/workflow-count-resourcequota.yaml | 24 ++++++++++++++++++++++ hack/capture-pprof.sh | 8 +++----- 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 examples/workflow-count-resourcequota.yaml diff --git a/docs/fields.md b/docs/fields.md index 95dcdaf1ce88..42d3fb82e1af 100644 --- a/docs/fields.md +++ b/docs/fields.md @@ -691,6 +691,8 @@ WorkflowSpec is the specification of a Workflow. - [`work-avoidance.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/work-avoidance.yaml) +- [`workflow-count-resourcequota.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-count-resourcequota.yaml) + - [`event-consumer-workfloweventbinding.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workfloweventbinding.yaml) - [`event-consumer-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workflowtemplate.yaml) @@ -1093,6 +1095,8 @@ CronWorkflowSpec is the specification of a CronWorkflow - [`work-avoidance.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/work-avoidance.yaml) +- [`workflow-count-resourcequota.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-count-resourcequota.yaml) + - [`event-consumer-workfloweventbinding.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workfloweventbinding.yaml) - [`event-consumer-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workflowtemplate.yaml) @@ -1452,6 +1456,8 @@ WorkflowTemplateSpec is a spec of WorkflowTemplate. - [`work-avoidance.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/work-avoidance.yaml) +- [`workflow-count-resourcequota.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-count-resourcequota.yaml) + - [`event-consumer-workfloweventbinding.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workfloweventbinding.yaml) - [`event-consumer-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workflowtemplate.yaml) @@ -4635,6 +4641,8 @@ ObjectMeta is metadata that all persisted resources must have, which includes al - [`work-avoidance.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/work-avoidance.yaml) +- [`workflow-count-resourcequota.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-count-resourcequota.yaml) + - [`event-consumer-workfloweventbinding.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workfloweventbinding.yaml) - [`event-consumer-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workflowtemplate.yaml) @@ -5886,6 +5894,8 @@ PersistentVolumeClaimSpec describes the common attributes of storage devices and - [`work-avoidance.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/work-avoidance.yaml) +- [`workflow-count-resourcequota.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-count-resourcequota.yaml) + - [`event-consumer-workfloweventbinding.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workfloweventbinding.yaml) - [`event-consumer-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-event-binding/event-consumer-workflowtemplate.yaml) diff --git a/examples/workflow-count-resourcequota.yaml b/examples/workflow-count-resourcequota.yaml new file mode 100644 index 000000000000..827e6e6f0c59 --- /dev/null +++ b/examples/workflow-count-resourcequota.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: ResourceQuota +metadata: + name: workflow-count + annotations: + workflows.argoproj.io/description: | + This resource quota prevents creation of more than a certain number of workflows being created in a namespace. + + The user will get an error when they try to create more. As the count includes both completed and incomplete + workflows, and complete workflows do not make any significant demands of your cluster, you probably want to use it + with a workflow GC strategy, so that a build up of completed workflows does not prevent you from creating and + running new workflows. + + Argo Workflowws has feature called "parallelism" that limits the number of running workflows, ignoring completed + workflows. + + <= v3.1 you can configure a global limit to the total number of running workflows in the cluster. This is suitable + for single-tenancy set-up. + + For multi-tenancy set-up, where each tenant own a single namespace, then in >= v3.1 you can globaly configure a + limit for the total number of running workflows within each namespace. +spec: + hard: + count/workflows.argoproj.io: "100" diff --git a/hack/capture-pprof.sh b/hack/capture-pprof.sh index 541a64e08a25..c4f4a1de1185 100755 --- a/hack/capture-pprof.sh +++ b/hack/capture-pprof.sh @@ -7,8 +7,6 @@ cd $(dirname $0)/.. n=$(date +%s) -go tool pprof -png -output dist/heap-$n.png http://localhost:6060/debug/pprof/heap -go tool pprof -png -output dist/allocs-$n.png http://localhost:6060/debug/pprof/allocs -go tool pprof -png -output dist/block-$n.png http://localhost:6060/debug/pprof/block -go tool pprof -png -output dist/mutex-$n.png http://localhost:6060/debug/pprof/mutex -go tool pprof -png -output dist/profile-$n.png http://localhost:6060/debug/pprof/profile \ No newline at end of file +go tool pprof -web http://localhost:6060/debug/pprof/allocs +go tool pprof -web http://localhost:6060/debug/pprof/heap +go tool pprof -web http://localhost:6060/debug/pprof/profile \ No newline at end of file