Skip to content

Commit

Permalink
feat(controller): Enhanced artifact repository ref. See #3184 (#4458)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Collins <alex_collins@intuit.com>
  • Loading branch information
alexec committed Nov 30, 2020
1 parent 5c538d7 commit c84d56b
Show file tree
Hide file tree
Showing 32 changed files with 1,499 additions and 749 deletions.
27 changes: 27 additions & 0 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,32 @@
"io.argoproj.workflow.v1alpha1.ArtifactRepositoryRef": {
"properties": {
"configMap": {
"description": "The name of the config map. Defaults to \"artifact-repositories\".",
"type": "string"
},
"key": {
"description": "The config map key. Defaults to the value of the \"workflows.argoproj.io/default-artifact-repository\" annotation.",
"type": "string"
}
},
"type": "object"
},
"io.argoproj.workflow.v1alpha1.ArtifactRepositoryRefStatus": {
"properties": {
"configMap": {
"description": "The name of the config map. Defaults to \"artifact-repositories\".",
"type": "string"
},
"default": {
"description": "If this ref represents the default artifact repository, rather than a config map.",
"type": "boolean"
},
"key": {
"description": "The config map key. Defaults to the value of the \"workflows.argoproj.io/default-artifact-repository\" annotation.",
"type": "string"
},
"namespace": {
"description": "The namespace of the config map. Defaults to the workflow's namespace, or the controller's namespace (if found).",
"type": "string"
}
},
Expand Down Expand Up @@ -2739,6 +2762,10 @@
"io.argoproj.workflow.v1alpha1.WorkflowStatus": {
"description": "WorkflowStatus contains overall status information about a workflow",
"properties": {
"artifactRepositoryRef": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ArtifactRepositoryRefStatus",
"description": "ArtifactRepositoryRef is used to cache the repository to use so we do not need to determine it everytime we reconcile."
},
"compressedNodes": {
"description": "Compressed and base64 decoded Nodes map",
"type": "string"
Expand Down
27 changes: 27 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2269,9 +2269,32 @@
"type": "object",
"properties": {
"configMap": {
"description": "The name of the config map. Defaults to \"artifact-repositories\".",
"type": "string"
},
"key": {
"description": "The config map key. Defaults to the value of the \"workflows.argoproj.io/default-artifact-repository\" annotation.",
"type": "string"
}
}
},
"io.argoproj.workflow.v1alpha1.ArtifactRepositoryRefStatus": {
"type": "object",
"properties": {
"configMap": {
"description": "The name of the config map. Defaults to \"artifact-repositories\".",
"type": "string"
},
"default": {
"description": "If this ref represents the default artifact repository, rather than a config map.",
"type": "boolean"
},
"key": {
"description": "The config map key. Defaults to the value of the \"workflows.argoproj.io/default-artifact-repository\" annotation.",
"type": "string"
},
"namespace": {
"description": "The namespace of the config map. Defaults to the workflow's namespace, or the controller's namespace (if found).",
"type": "string"
}
}
Expand Down Expand Up @@ -4788,6 +4811,10 @@
"description": "WorkflowStatus contains overall status information about a workflow",
"type": "object",
"properties": {
"artifactRepositoryRef": {
"description": "ArtifactRepositoryRef is used to cache the repository to use so we do not need to determine it everytime we reconcile.",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ArtifactRepositoryRefStatus"
},
"compressedNodes": {
"description": "Compressed and base64 decoded Nodes map",
"type": "string"
Expand Down
15 changes: 10 additions & 5 deletions docs/artifact-repository-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
You can reduce duplication in your templates by configuring repositories that can be accessed by any workflow. This can also remove sensitive information from your templates.

Create a suitable config map in either (a) your workflows namespace or (b) in the Argo's namespace, the default name is `artifact-repositories`:
Create a suitable config map in either (a) your workflows namespace or (b) in the managed namespace:

```
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
# if you want to use this config map by default - name it "artifact-repositories"
name: artifact-repositories
annotations:
# if you want to use a specific key, put that's key into this annotation
workflows.argoproj.io/default-artifact-repository: default-v1
data:
minio: |
default-v1: |
s3:
bucket: my-bucket
endpoint: minio:9000
Expand All @@ -29,10 +33,11 @@ data:

You can override the repository for a workflow as follows:

```
```yaml
spec:
artifactRepositoryRef:
key: minio
configMap: my-cm # default is "artifact-repositories"
key: my-key # default can be set by the annotation
```

Reference: [fields.md#artifactrepositoryref](fields.md#artifactrepositoryref).
6 changes: 6 additions & 0 deletions docs/configure-artifact-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Subsequent sections will show how to use it.
| Raw | Yes | No | 5% |
| S3 | Yes | Yes | 86% |

The actual repository used by a workflow is choose by the following rules:

1. Anything explicitly configured using [Artifact Repository Ref](artifact-repository-ref.md). This is the most flexible, safe, and secure option.
2. From a config map named `artifact-repositories` if it has the `workflows.argoproj.io/default-artifact-repository` annotation in the workflow's namespace.
3. From a workflow controller configmap.

## Configuring Minio

```
Expand Down
24 changes: 22 additions & 2 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ WorkflowStatus contains overall status information about a workflow
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`artifactRepositoryRef`|[`ArtifactRepositoryRefStatus`](#artifactrepositoryrefstatus)|ArtifactRepositoryRef is used to cache the repository to use so we do not need to determine it everytime we reconcile.|
|`compressedNodes`|`string`|Compressed and base64 decoded Nodes map|
|`conditions`|`Array<`[`Condition`](#condition)`>`|Conditions is a list of conditions the Workflow may have|
|`estimatedDuration`|`int32`|EstimatedDuration in seconds.|
Expand Down Expand Up @@ -1492,8 +1493,8 @@ _No description available_
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`configMap`|`string`|_No description available_|
|`key`|`string`|_No description available_|
|`configMap`|`string`|The name of the config map. Defaults to "artifact-repositories".|
|`key`|`string`|The config map key. Defaults to the value of the "workflows.argoproj.io/default-artifact-repository" annotation.|

## ExecutorConfig

Expand Down Expand Up @@ -1963,6 +1964,25 @@ WorkflowTemplateRef is a reference to a WorkflowTemplate resource.
|`clusterScope`|`boolean`|ClusterScope indicates the referred template is cluster scoped (i.e. a ClusterWorkflowTemplate).|
|`name`|`string`|Name is the resource name of the workflow template.|

## ArtifactRepositoryRefStatus

_No description available_

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

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

### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`configMap`|`string`|The name of the config map. Defaults to "artifact-repositories".|
|`default`|`boolean`|If this ref represents the default artifact repository, rather than a config map.|
|`key`|`string`|The config map key. Defaults to the value of the "workflows.argoproj.io/default-artifact-repository" annotation.|
|`namespace`|`string`|The namespace of the config map. Defaults to the workflow's namespace, or the controller's namespace (if found).|

## Condition

_No description available_
Expand Down
6 changes: 3 additions & 3 deletions examples/artifact-repository-ref.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ metadata:
spec:
entrypoint: main
artifactRepositoryRef:
key: minio
key: my-key
templates:
- name: main
container:
image: docker/whalesay:latest
command: [sh, -c]
args: ["cowsay hello world | tee /tmp/hello_world.txt"]
command: [ sh, -c ]
args: [ "cowsay hello world | tee /tmp/hello_world.txt" ]
outputs:
artifacts:
- name: hello_world
Expand Down
11 changes: 11 additions & 0 deletions manifests/base/crds/full/argoproj.io_workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6702,6 +6702,17 @@ spec:
type: object
status:
properties:
artifactRepositoryRef:
properties:
configMap:
type: string
default:
type: boolean
key:
type: string
namespace:
type: string
type: object
compressedNodes:
type: string
conditions:
Expand Down
17 changes: 16 additions & 1 deletion manifests/quick-start-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,20 @@ subjects:
---
apiVersion: v1
data:
minio: |
default-v1: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
insecure: true
accessKeySecret:
name: my-minio-cred
key: accesskey
secretKeySecret:
name: my-minio-cred
key: secretkey
my-key: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
Expand All @@ -462,6 +475,8 @@ data:
key: secretkey
kind: ConfigMap
metadata:
annotations:
workflows.argoproj.io/default-artifact-repository: default-v1
name: artifact-repositories
---
apiVersion: v1
Expand Down
17 changes: 16 additions & 1 deletion manifests/quick-start-mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,20 @@ subjects:
---
apiVersion: v1
data:
minio: |
default-v1: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
insecure: true
accessKeySecret:
name: my-minio-cred
key: accesskey
secretKeySecret:
name: my-minio-cred
key: secretkey
my-key: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
Expand All @@ -462,6 +475,8 @@ data:
key: secretkey
kind: ConfigMap
metadata:
annotations:
workflows.argoproj.io/default-artifact-repository: default-v1
name: artifact-repositories
---
apiVersion: v1
Expand Down
17 changes: 16 additions & 1 deletion manifests/quick-start-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,20 @@ subjects:
---
apiVersion: v1
data:
minio: |
default-v1: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
insecure: true
accessKeySecret:
name: my-minio-cred
key: accesskey
secretKeySecret:
name: my-minio-cred
key: secretkey
my-key: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
Expand All @@ -462,6 +475,8 @@ data:
key: secretkey
kind: ConfigMap
metadata:
annotations:
workflows.argoproj.io/default-artifact-repository: default-v1
name: artifact-repositories
---
apiVersion: v1
Expand Down
25 changes: 21 additions & 4 deletions manifests/quick-start/base/artifact-repositories-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: artifact-repositories
annotations:
# you'll want to change the default over time, e.g. when you move to new storage solution,
# so we recommend you version them from the outset by suffixing the version
workflows.argoproj.io/default-artifact-repository: default-v1
data:
minio: |
default-v1: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
Expand All @@ -11,6 +19,15 @@ data:
secretKeySecret:
name: my-minio-cred
key: secretkey
kind: ConfigMap
metadata:
name: artifact-repositories
my-key: |
archiveLogs: true
s3:
bucket: my-bucket
endpoint: minio:9000
insecure: true
accessKeySecret:
name: my-minio-cred
key: accesskey
secretKeySecret:
name: my-minio-cred
key: secretkey

0 comments on commit c84d56b

Please sign in to comment.