Skip to content

Commit

Permalink
Add support for init containers (#1183)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtaniwaki authored and jessesuen committed Apr 5, 2019
1 parent 4591e44 commit e34024a
Show file tree
Hide file tree
Showing 8 changed files with 583 additions and 382 deletions.
260 changes: 137 additions & 123 deletions api/openapi-spec/swagger.json
Expand Up @@ -784,8 +784,142 @@
}
}
},
"io.argoproj.workflow.v1alpha1.Sidecar": {
"description": "Sidecar is a container which runs alongside the main container",
"io.argoproj.workflow.v1alpha1.SuspendTemplate": {
"description": "SuspendTemplate is a template subtype to suspend a workflow at a predetermined point in time"
},
"io.argoproj.workflow.v1alpha1.TarStrategy": {
"description": "TarStrategy will tar and gzip the file or directory when saving"
},
"io.argoproj.workflow.v1alpha1.Template": {
"description": "Template is a reusable and composable unit of execution in a workflow",
"required": [
"name"
],
"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"
},
"affinity": {
"description": "Affinity sets the pod's scheduling constraints Overrides the affinity set at the workflow level (if any)",
"$ref": "#/definitions/io.k8s.api.core.v1.Affinity"
},
"archiveLocation": {
"description": "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 \u003cworkflowname\u003e/\u003cnodename\u003e in the key.",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ArtifactLocation"
},
"container": {
"description": "Container is the main container image to run in the pod",
"$ref": "#/definitions/io.k8s.api.core.v1.Container"
},
"daemon": {
"description": "Deamon will allow a workflow to proceed to the next step so long as the container reaches readiness",
"type": "boolean"
},
"dag": {
"description": "DAG template subtype which runs a DAG",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.DAGTemplate"
},
"initContainers": {
"description": "InitContainers is a list of containers which run before the main container.",
"type": "array",
"items": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.UserContainer"
}
},
"inputs": {
"description": "Inputs describe what inputs parameters and artifacts are supplied to this template",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Inputs"
},
"metadata": {
"description": "Metdata sets the pods's metadata, i.e. annotations and labels",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Metadata"
},
"name": {
"description": "Name is the name of the template",
"type": "string"
},
"nodeSelector": {
"description": "NodeSelector is a selector to schedule this step of the workflow to be run on the selected node(s). Overrides the selector set at the workflow level.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"outputs": {
"description": "Outputs describe the parameters and artifacts that this template produces",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Outputs"
},
"parallelism": {
"description": "Parallelism limits the max total parallel pods that can execute at the same time within the boundaries of this template invocation. If additional steps/dag templates are invoked, the pods created by those templates will not be counted towards this total.",
"type": "integer",
"format": "int64"
},
"priority": {
"description": "Priority to apply to workflow pods.",
"type": "integer",
"format": "int32"
},
"priorityClassName": {
"description": "PriorityClassName to apply to workflow pods.",
"type": "string"
},
"resource": {
"description": "Resource template subtype which can run k8s resources",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ResourceTemplate"
},
"retryStrategy": {
"description": "RetryStrategy describes how to retry a template when it fails",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.RetryStrategy"
},
"schedulerName": {
"description": "If specified, the pod will be dispatched by specified scheduler. Or it will be dispatched by workflow scope scheduler if specified. If neither specified, the pod will be dispatched by default scheduler.",
"type": "string"
},
"script": {
"description": "Script runs a portion of code against an interpreter",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ScriptTemplate"
},
"sidecars": {
"description": "Sidecars is a list of containers which run alongside the main container Sidecars are automatically killed when the main container completes",
"type": "array",
"items": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.UserContainer"
}
},
"steps": {
"description": "Steps define a series of sequential/parallel workflow steps",
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.WorkflowStep"
}
}
},
"suspend": {
"description": "Suspend template subtype which can suspend a workflow when reaching the step",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.SuspendTemplate"
},
"tolerations": {
"description": "Tolerations to apply to workflow pods.",
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.Toleration"
}
},
"volumes": {
"description": "Volumes is a list of volumes that can be mounted by containers in a template.",
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.Volume"
}
}
}
},
"io.argoproj.workflow.v1alpha1.UserContainer": {
"description": "UserContainer is a container specified by a user.",
"required": [
"name"
],
Expand Down Expand Up @@ -837,7 +971,7 @@
"$ref": "#/definitions/io.k8s.api.core.v1.Probe"
},
"mirrorVolumeMounts": {
"description": "MirrorVolumeMounts will mount the same volumes specified in the main container to the sidecar (including artifacts), at the same mountPaths. This enables dind daemon to partially see the same filesystem as the main container in order to use features such as docker volume binding",
"description": "MirrorVolumeMounts will mount the same volumes specified in the main container to the container (including artifacts), at the same mountPaths. This enables dind daemon to partially see the same filesystem as the main container in order to use features such as docker volume binding",
"type": "boolean"
},
"name": {
Expand Down Expand Up @@ -909,126 +1043,6 @@
}
}
},
"io.argoproj.workflow.v1alpha1.SuspendTemplate": {
"description": "SuspendTemplate is a template subtype to suspend a workflow at a predetermined point in time"
},
"io.argoproj.workflow.v1alpha1.TarStrategy": {
"description": "TarStrategy will tar and gzip the file or directory when saving"
},
"io.argoproj.workflow.v1alpha1.Template": {
"description": "Template is a reusable and composable unit of execution in a workflow",
"required": [
"name"
],
"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"
},
"affinity": {
"description": "Affinity sets the pod's scheduling constraints Overrides the affinity set at the workflow level (if any)",
"$ref": "#/definitions/io.k8s.api.core.v1.Affinity"
},
"archiveLocation": {
"description": "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 \u003cworkflowname\u003e/\u003cnodename\u003e in the key.",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ArtifactLocation"
},
"container": {
"description": "Container is the main container image to run in the pod",
"$ref": "#/definitions/io.k8s.api.core.v1.Container"
},
"daemon": {
"description": "Deamon will allow a workflow to proceed to the next step so long as the container reaches readiness",
"type": "boolean"
},
"dag": {
"description": "DAG template subtype which runs a DAG",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.DAGTemplate"
},
"inputs": {
"description": "Inputs describe what inputs parameters and artifacts are supplied to this template",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Inputs"
},
"metadata": {
"description": "Metdata sets the pods's metadata, i.e. annotations and labels",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Metadata"
},
"name": {
"description": "Name is the name of the template",
"type": "string"
},
"nodeSelector": {
"description": "NodeSelector is a selector to schedule this step of the workflow to be run on the selected node(s). Overrides the selector set at the workflow level.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"outputs": {
"description": "Outputs describe the parameters and artifacts that this template produces",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Outputs"
},
"parallelism": {
"description": "Parallelism limits the max total parallel pods that can execute at the same time within the boundaries of this template invocation. If additional steps/dag templates are invoked, the pods created by those templates will not be counted towards this total.",
"type": "integer",
"format": "int64"
},
"priority": {
"description": "Priority to apply to workflow pods.",
"type": "integer",
"format": "int32"
},
"priorityClassName": {
"description": "PriorityClassName to apply to workflow pods.",
"type": "string"
},
"resource": {
"description": "Resource template subtype which can run k8s resources",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ResourceTemplate"
},
"retryStrategy": {
"description": "RetryStrategy describes how to retry a template when it fails",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.RetryStrategy"
},
"schedulerName": {
"description": "If specified, the pod will be dispatched by specified scheduler. Or it will be dispatched by workflow scope scheduler if specified. If neither specified, the pod will be dispatched by default scheduler.",
"type": "string"
},
"script": {
"description": "Script runs a portion of code against an interpreter",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ScriptTemplate"
},
"sidecars": {
"description": "Sidecars is a list of containers which run alongside the main container Sidecars are automatically killed when the main container completes",
"type": "array",
"items": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Sidecar"
}
},
"steps": {
"description": "Steps define a series of sequential/parallel workflow steps",
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.WorkflowStep"
}
}
},
"suspend": {
"description": "Suspend template subtype which can suspend a workflow when reaching the step",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.SuspendTemplate"
},
"tolerations": {
"description": "Tolerations to apply to workflow pods.",
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.Toleration"
}
}
}
},
"io.argoproj.workflow.v1alpha1.ValueFrom": {
"description": "ValueFrom describes a location in which to obtain the value to a parameter",
"properties": {
Expand Down
22 changes: 22 additions & 0 deletions examples/init-container.yaml
@@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: init-container-
spec:
entrypoint: init-container-example
templates:
- name: init-container-example
container:
image: alpine:latest
command: ["echo", "bye"]
volumeMounts:
- name: foo
mountPath: /foo
initContainers:
- name: hello
image: alpine:latest
command: ["echo", "hello"]
mirrorVolumeMounts: true
volumes:
- name: foo
emptyDir:

0 comments on commit e34024a

Please sign in to comment.