Skip to content

Commit

Permalink
docs: review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Clucas <[email protected]>
  • Loading branch information
Joibel committed Oct 11, 2024
1 parent 3ec9cdf commit 5878b21
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion api/jsonschema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions docs/cron-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ In the above example it would be similar to `test-cron-wf-tj6fe`.

You can use `CronWorkflow.spec.workflowMetadata` to add `labels` and `annotations`.

### `CronWorkflow` Spec
### `CronWorkflow` Options

| Option Name | Default Value | Description |
|:----------------------------:|:----------------------:|-------------|
Expand All @@ -51,8 +51,7 @@ You can use `CronWorkflow.spec.workflowMetadata` to add `labels` and `annotation
| `startingDeadlineSeconds` | `0` | Seconds after [the last scheduled time](#crash-recovery) during which a missed `Workflow` will still be run. |
| `successfulJobsHistoryLimit` | `3` | Number of successful `Workflows` to persist |
| `failedJobsHistoryLimit` | `1` | Number of failed `Workflows` to persist |
| `stopStrategy` | `nil` | v3.6 and after: defines if the CronWorkflow should stop scheduling based on an expression |
| `stopStrategy.expression` | None | v3.6 and after: an expression which if present must evaluate to false for the workflow to be created |
| `stopStrategy.expression` | `nil` | v3.6 and after: defines if the CronWorkflow should stop scheduling based on an expression, which if present must evaluate to false for the workflow to be created |

### Cron Schedule Syntax

Expand Down Expand Up @@ -115,7 +114,7 @@ For example, with `timezone: America/Los_Angeles`:
> v3.6 and after

You can configure a `CronWorkflow` to automatically stop based on an [expression](variables.md#expression) with `stopStrategy.condition`.
You can use the [variables](variables.md#stopstrategy) `failed` and `succeeded`.
You can use the [variables](variables.md#stopstrategy) `cronworkflow.failed` and `cronworkflow.succeeded`.

For example, if you want to stop scheduling new workflows after one success:

Expand All @@ -135,10 +134,10 @@ stopStrategy:
!!! Warning "Scheduling vs. Completions"
Depending on the time it takes to schedule and run a workflow, the number of completions can exceed the configured maximum.

For example, if you configure the `CronWorkflow` to schedule every minute (`* * * * *`) and stop after one success (`succeeded >= 1`).
For example, if you configure the `CronWorkflow` to schedule every minute (`* * * * *`) and stop after one success (`cronworkflow.succeeded >= 1`).
If the `Workflow` takes 90 seconds to run, the `CronWorkflow` will actually stop after two completions.
This is because when the stopping condition is achieved, there is _already_ another `Workflow` running.
For that reason, prefer conditions like `succeeded >= 1` over `succeeded == 1`.
For that reason, prefer conditions like `cronworkflow.succeeded >= 1` over `cronworkflow.succeeded == 1`.
<!-- markdownlint-enable MD046 -->

## Managing `CronWorkflow`
Expand Down
2 changes: 1 addition & 1 deletion docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ StopStrategy defines if the CronWorkflow should stop scheduling based on an expr
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`expression`|`string`|Expression is an expression that stops scheduling workflows when true. Use the `cronworkflow` variables `failed` or `succeeded` to access the number of failed or successful child workflows. v3.6 and after|
|`expression`|`string`|v3.6 and after: Expression is an expression that stops scheduling workflows when true. Use the variables `cronworkflow`.`failed` or `cronworkflow`.`succeeded` to access the number of failed or successful child workflows.|

## Artifact

Expand Down
5 changes: 2 additions & 3 deletions pkg/apis/workflow/v1alpha1/cron_workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ type CronWorkflowSpec struct {

// StopStrategy defines if the CronWorkflow should stop scheduling based on an expression. v3.6 and after
type StopStrategy struct {
// Expression is an expression that stops scheduling workflows when true. Use the `cronworkflow`
// variables `failed` or `succeeded` to access the number of failed or successful child workflows.
// v3.6 and after
// v3.6 and after: Expression is an expression that stops scheduling workflows when true. Use the variables
// `cronworkflow`.`failed` or `cronworkflow`.`succeeded` to access the number of failed or successful child workflows.
Expression string `json:"expression" protobuf:"bytes,1,opt,name=expression"`
}

Expand Down
5 changes: 2 additions & 3 deletions pkg/apis/workflow/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/apis/workflow/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5878b21

Please sign in to comment.