Skip to content

Commit

Permalink
feat: Allow parametrizable int fields (argoproj#3610)
Browse files Browse the repository at this point in the history
  • Loading branch information
simster7 authored Aug 12, 2020
1 parent da115f9 commit e35a86f
Show file tree
Hide file tree
Showing 21 changed files with 887 additions and 568 deletions.
9 changes: 3 additions & 6 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2021,8 +2021,7 @@
},
"factor": {
"description": "Factor is a factor to multiply the base duration after each failed retry",
"type": "integer",
"format": "int32"
"$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
},
"maxDuration": {
"description": "MaxDuration is the maximum amount of time allowed for the backoff strategy",
Expand Down Expand Up @@ -3130,8 +3129,7 @@
},
"limit": {
"description": "Limit is the maximum number of attempts when retrying a container",
"type": "integer",
"format": "int32"
"$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
},
"retryPolicy": {
"description": "RetryPolicy is a policy of NodePhase statuses that will be retried",
Expand Down Expand Up @@ -3531,8 +3529,7 @@
"properties": {
"activeDeadlineSeconds": {
"description": "Optional duration in seconds relative to the StartTime that the pod may be active on a node before the system actively tries to terminate the pod; value must be positive integer This field is only applicable to container and script templates.",
"type": "integer",
"format": "int64"
"$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
},
"affinity": {
"description": "Affinity sets the pod's scheduling constraints Overrides the affinity set at the workflow level (if any)",
Expand Down
36 changes: 16 additions & 20 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ Template is a reusable and composable unit of execution in a workflow
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`activeDeadlineSeconds`|`int64`|Optional duration in seconds relative to the StartTime that the pod may be active on a node before the system actively tries to terminate the pod; value must be positive integer This field is only applicable to container and script templates.|
|`activeDeadlineSeconds`|[`IntOrString`](#intorstring)|Optional duration in seconds relative to the StartTime that the pod may be active on a node before the system actively tries to terminate the pod; value must be positive integer This field is only applicable to container and script templates.|
|`affinity`|[`Affinity`](#affinity)|Affinity sets the pod's scheduling constraints Overrides the affinity set at the workflow level (if any)|
|`archiveLocation`|[`ArtifactLocation`](#artifactlocation)|Location in which all files related to the step will be stored (logs, artifacts, etc...). Can be overridden by individual items in Outputs. If omitted, will use the default artifact repository location configured in the controller, appended with the <workflowname>/<nodename> in the key.|
|~`arguments`~|~[`Arguments`](#arguments)~|~Arguments hold arguments to the template.~ DEPRECATED: This field is not used.|
Expand Down Expand Up @@ -2839,7 +2839,7 @@ RetryStrategy provides controls on how to retry a workflow step
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`backoff`|[`Backoff`](#backoff)|Backoff is a backoff strategy|
|`limit`|`int32`|Limit is the maximum number of attempts when retrying a container|
|`limit`|[`IntOrString`](#intorstring)|Limit is the maximum number of attempts when retrying a container|
|`retryPolicy`|`string`|RetryPolicy is a policy of NodePhase statuses that will be retried|

## ScriptTemplate
Expand Down Expand Up @@ -3573,7 +3573,7 @@ Backoff is a backoff strategy to use within retryStrategy
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`duration`|`string`|Duration is the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h")|
|`factor`|`int32`|Factor is a factor to multiply the base duration after each failed retry|
|`factor`|[`IntOrString`](#intorstring)|Factor is a factor to multiply the base duration after each failed retry|
|`maxDuration`|`string`|MaxDuration is the maximum amount of time allowed for the backoff strategy|

## ContinueOn
Expand Down Expand Up @@ -4228,6 +4228,19 @@ ObjectReference contains enough information to let you inspect or modify the ref
|`resourceVersion`|`string`|Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency|
|`uid`|`string`|UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids|

## IntOrString

IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.

<details>
<summary>Examples with this field (click to open)</summary>
<br>

- [`timeouts-step.yaml`](https://github.com/argoproj/argo/blob/master/examples/timeouts-step.yaml)

- [`timeouts-workflow.yaml`](https://github.com/argoproj/argo/blob/master/examples/timeouts-workflow.yaml)
</details>

## Container

A single application container that you want to run within a pod.
Expand Down Expand Up @@ -4478,23 +4491,6 @@ A single application container that you want to run within a pod.
|`volumeMounts`|`Array<`[`VolumeMount`](#volumemount)`>`|Pod volumes to mount into the container's filesystem. Cannot be updated.|
|`workingDir`|`string`|Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.|

## IntOrString

IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.

<details>
<summary>Examples with this field (click to open)</summary>
<br>

- [`cron-backfill.yaml`](https://github.com/argoproj/argo/blob/master/examples/cron-backfill.yaml)

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo/blob/master/examples/input-artifact-s3.yaml)

- [`output-artifact-s3.yaml`](https://github.com/argoproj/argo/blob/master/examples/output-artifact-s3.yaml)

- [`output-parameter.yaml`](https://github.com/argoproj/argo/blob/master/examples/output-parameter.yaml)
</details>

## ConfigMapKeySelector

Selects a key from a ConfigMap.
Expand Down
6 changes: 3 additions & 3 deletions docs/swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ Backoff is a backoff strategy to use within retryStrategy
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| duration | string | Duration is the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h") | No |
| factor | integer | Factor is a factor to multiply the base duration after each failed retry | No |
| factor | [io.k8s.apimachinery.pkg.util.intstr.IntOrString](#io.k8s.apimachinery.pkg.util.intstr.intorstring) | Factor is a factor to multiply the base duration after each failed retry | No |
| maxDuration | string | MaxDuration is the maximum amount of time allowed for the backoff strategy | No |

#### io.argoproj.workflow.v1alpha1.Cache
Expand Down Expand Up @@ -1309,7 +1309,7 @@ RetryStrategy provides controls on how to retry a workflow step
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| backoff | [io.argoproj.workflow.v1alpha1.Backoff](#io.argoproj.workflow.v1alpha1.backoff) | Backoff is a backoff strategy | No |
| limit | integer | Limit is the maximum number of attempts when retrying a container | No |
| limit | [io.k8s.apimachinery.pkg.util.intstr.IntOrString](#io.k8s.apimachinery.pkg.util.intstr.intorstring) | Limit is the maximum number of attempts when retrying a container | No |
| retryPolicy | string | RetryPolicy is a policy of NodePhase statuses that will be retried | No |

#### io.argoproj.workflow.v1alpha1.S3Artifact
Expand Down Expand Up @@ -1469,7 +1469,7 @@ Template is a reusable and composable unit of execution in a workflow

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| activeDeadlineSeconds | long | Optional duration in seconds relative to the StartTime that the pod may be active on a node before the system actively tries to terminate the pod; value must be positive integer This field is only applicable to container and script templates. | No |
| activeDeadlineSeconds | [io.k8s.apimachinery.pkg.util.intstr.IntOrString](#io.k8s.apimachinery.pkg.util.intstr.intorstring) | Optional duration in seconds relative to the StartTime that the pod may be active on a node before the system actively tries to terminate the pod; value must be positive integer This field is only applicable to container and script templates. | No |
| affinity | [io.k8s.api.core.v1.Affinity](#io.k8s.api.core.v1.affinity) | Affinity sets the pod's scheduling constraints Overrides the affinity set at the workflow level (if any) | No |
| archiveLocation | [io.argoproj.workflow.v1alpha1.ArtifactLocation](#io.argoproj.workflow.v1alpha1.artifactlocation) | Location in which all files related to the step will be stored (logs, artifacts, etc...). Can be overridden by individual items in Outputs. If omitted, will use the default artifact repository location configured in the controller, appended with the <workflowname>/<nodename> in the key. | No |
| arguments | [io.argoproj.workflow.v1alpha1.Arguments](#io.argoproj.workflow.v1alpha1.arguments) | Arguments hold arguments to the template. DEPRECATED: This field is not used. | No |
Expand Down
18 changes: 12 additions & 6 deletions manifests/base/crds/full/argoproj.io_clusterworkflowtemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,10 @@ spec:
items:
properties:
activeDeadlineSeconds:
format: int64
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
affinity:
properties:
nodeAffinity:
Expand Down Expand Up @@ -4044,14 +4046,18 @@ spec:
duration:
type: string
factor:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxDuration:
type: string
type: object
limit:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
retryPolicy:
type: string
type: object
Expand Down
18 changes: 12 additions & 6 deletions manifests/base/crds/full/argoproj.io_cronworkflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,10 @@ spec:
items:
properties:
activeDeadlineSeconds:
format: int64
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
affinity:
properties:
nodeAffinity:
Expand Down Expand Up @@ -4065,14 +4067,18 @@ spec:
duration:
type: string
factor:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxDuration:
type: string
type: object
limit:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
retryPolicy:
type: string
type: object
Expand Down
54 changes: 36 additions & 18 deletions manifests/base/crds/full/argoproj.io_workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,10 @@ spec:
items:
properties:
activeDeadlineSeconds:
format: int64
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
affinity:
properties:
nodeAffinity:
Expand Down Expand Up @@ -4054,14 +4056,18 @@ spec:
duration:
type: string
factor:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxDuration:
type: string
type: object
limit:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
retryPolicy:
type: string
type: object
Expand Down Expand Up @@ -8693,8 +8699,10 @@ spec:
additionalProperties:
properties:
activeDeadlineSeconds:
format: int64
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
affinity:
properties:
nodeAffinity:
Expand Down Expand Up @@ -11854,14 +11862,18 @@ spec:
duration:
type: string
factor:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxDuration:
type: string
type: object
limit:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
retryPolicy:
type: string
type: object
Expand Down Expand Up @@ -14900,8 +14912,10 @@ spec:
items:
properties:
activeDeadlineSeconds:
format: int64
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
affinity:
properties:
nodeAffinity:
Expand Down Expand Up @@ -18061,14 +18075,18 @@ spec:
duration:
type: string
factor:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxDuration:
type: string
type: object
limit:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
retryPolicy:
type: string
type: object
Expand Down
18 changes: 12 additions & 6 deletions manifests/base/crds/full/argoproj.io_workflowtemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,10 @@ spec:
items:
properties:
activeDeadlineSeconds:
format: int64
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
affinity:
properties:
nodeAffinity:
Expand Down Expand Up @@ -4043,14 +4045,18 @@ spec:
duration:
type: string
factor:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxDuration:
type: string
type: object
limit:
format: int32
type: integer
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
retryPolicy:
type: string
type: object
Expand Down
Loading

0 comments on commit e35a86f

Please sign in to comment.