|
| 1 | +# External Artifacts |
| 2 | + |
| 3 | +<!-- menuweight:100 --> |
| 4 | + |
| 5 | +The `ExternalArtifact` is a generic API designed for interoperability with Flux. |
| 6 | +It allows 3rd party controllers to produce and store [Artifact](#artifact) objects |
| 7 | +in the same way as Flux's own source-controller. |
| 8 | +For more details on the design and motivation behind this API, |
| 9 | +see [RFC-0012](https://github.com/fluxcd/flux2/tree/main/rfcs/0012-external-artifact). |
| 10 | + |
| 11 | +## Example |
| 12 | + |
| 13 | +The following is an example of a ExternalArtifact produced by a 3rd party |
| 14 | +source controller: |
| 15 | + |
| 16 | +```yaml |
| 17 | +apiVersion: source.toolkit.fluxcd.io/v1 |
| 18 | +kind: ExternalArtifact |
| 19 | +metadata: |
| 20 | + name: my-artifact |
| 21 | + namespace: flux-system |
| 22 | +spec: |
| 23 | + sourceRef: |
| 24 | + apiVersion: example.com/v1 |
| 25 | + kind: Source |
| 26 | + name: my-source |
| 27 | +status: |
| 28 | + artifact: |
| 29 | + digest: sha256:35d47c9db0eee6ffe08a404dfb416bee31b2b79eabc3f2eb26749163ce487f52 |
| 30 | + lastUpdateTime: "2025-08-21T13:37:31Z" |
| 31 | + path: source/flux-system/my-source/35d47c9d.tar.gz |
| 32 | + revision: v1.0.0@sha256:35d47c9db0eee6ffe08a404dfb416bee31b2b79eabc3f2eb26749163ce487f52 |
| 33 | + size: 20914 |
| 34 | + url: http://example-controller.flux-system.svc.cluster.local./source/flux-system/my-source/35d47c9d.tar.gz |
| 35 | + conditions: |
| 36 | + - lastTransitionTime: "2025-08-21T13:37:31Z" |
| 37 | + message: stored artifact for revision v1.0.0 |
| 38 | + observedGeneration: 1 |
| 39 | + reason: Succeeded |
| 40 | + status: "True" |
| 41 | + type: Ready |
| 42 | +``` |
| 43 | +
|
| 44 | +## ExternalArtifact spec |
| 45 | +
|
| 46 | +### Source reference |
| 47 | +
|
| 48 | +The `spec.sourceRef` field is optional and contains a reference |
| 49 | +to the custom resource that the ExternalArtifact is based on. |
| 50 | + |
| 51 | +The `spec.sourceRef` contains the following fields: |
| 52 | + |
| 53 | +- `apiVersion`: the API version of the custom resource. |
| 54 | +- `kind`: the kind of the custom resource. |
| 55 | +- `name`: the name of the custom resource. |
| 56 | +- `namespace`: the namespace of the custom resource. If omitted, it defaults to the |
| 57 | + namespace of the ExternalArtifact. |
| 58 | + |
| 59 | +## ExternalArtifact status |
| 60 | + |
| 61 | +### Artifact |
| 62 | + |
| 63 | +The ExternalArtifact reports the latest synchronized state |
| 64 | +as an Artifact object in the `.status.artifact`. |
| 65 | + |
| 66 | +The `.status.artifact` contains the following fields: |
| 67 | + |
| 68 | +- `digest`: The checksum of the tar.gz file in the format `<algorithm>:<checksum>`. |
| 69 | +- `lastUpdateTime`: Timestamp of the last artifact update. |
| 70 | +- `path`: Relative file path of the artifact in storage. |
| 71 | +- `revision`: Human-readable identifier with version and checksum in the format `<human-readable-identifier>@<algorithm>:<checksum>`. |
| 72 | +- `size`: Number of bytes in the tar.gz file. |
| 73 | +- `url`: In-cluster HTTP address for artifact retrieval. |
| 74 | + |
| 75 | +### Conditions |
| 76 | + |
| 77 | +The ExternalArtifact reports its status using Kubernetes standard conditions. |
| 78 | + |
| 79 | +#### Ready ExternalArtifact |
| 80 | + |
| 81 | +When the 3rd party controller has successfully produced and stored an |
| 82 | +Artifact in storage, it sets a Condition with the following |
| 83 | +attributes in the ExternalArtifact's `.status.conditions`: |
| 84 | + |
| 85 | +- `type: Ready` |
| 86 | +- `status: "True"` |
| 87 | +- `reason: Succeeded` |
| 88 | + |
| 89 | +The `message` field should contain a human-readable message indicating |
| 90 | +the successful storage of the artifact and the associated revision. |
| 91 | + |
| 92 | +If the 3rd party controller performs a signature verification |
| 93 | +of the artifact, and the verification is successful, a Condition with the |
| 94 | +following attributes is added to the ExternalArtifact's `.status.conditions`: |
| 95 | + |
| 96 | +- `type: SourceVerified` |
| 97 | +- `status: "True"` |
| 98 | +- `reason: Succeeded` |
| 99 | + |
| 100 | +The `message` field should contain a human-readable message indicating |
| 101 | +the successful verification of the artifact and the associated verification method. |
| 102 | + |
| 103 | +#### Failed ExternalArtifact |
| 104 | + |
| 105 | +If the 3rd party controller fails to produce and store an Artifact, |
| 106 | +it sets the `Ready` Condition status to `False`, and adds a Condition with |
| 107 | +the following attributes to the ExternalArtifact's `.status.conditions`: |
| 108 | + |
| 109 | +- `type: Ready` |
| 110 | +- `status: "False"` |
| 111 | +- `reason: FetchFailed` | `reason: StorageOperationFailed` | `reason: VerificationFailed` |
| 112 | + |
| 113 | +The `message` field should contain a human-readable message indicating |
| 114 | +the reason for the failure. |
0 commit comments