Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Rancher Image Mirror
# Rancher Artifact Mirror

This repo is dedicated to mirroring images from other organizations to the
This repo is dedicated to mirroring artifacts from other organizations to the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd definitely use the term "OCI artifacts" here, rather than only "artifacts", since this is the first thing that a user who is unfamiliar with this repo will see.

places they need to be for Rancher and its associated projects to use them.

> [!NOTE]
> This repository used to be called `image-mirror`; It was renamed to better reflect its usecases, see [this](https://github.com/rancher/rancher/issues/52259) issue for more information
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spelling/grammar:

  • "usecases" -> "use cases"
  • "image-mirror; It" -> "image-mirror; it"
  • Could use a period on the end of the sentence


## Overview

`regsync` is used for mirroring images from one repository to another. `regsync`
`regsync` is used for mirroring OCI artifacts from one repository to another. `regsync`
is configured via `regsync.yaml`. `regsync.yaml` is generated by running the
`generate-regsync` subcommand of the Go code in `tools/`, using `config.yaml` as
input. You can build the latest version of this code to `bin/artifact-mirror-tools`
Expand All @@ -18,14 +21,14 @@ Once `regsync.yaml` has been updated, you may run `regsync` via the command
```
regsync once --verbosity error --config regsync.yaml --missing
```
`autoupdate.yaml` is used to configure automatic updates for images. When
`autoupdate.yaml` is used to configure automatic updates for artifacts. When
an update is found, the automation creates a pull request that a human user
can then review and merge. See [`autoupdate.yaml`](#autoupdateyaml) for
more information.

### Adding New Artifacts

When adding new artifacts to the repo, please indicate so in the pull request.
When adding new OCI artifacts to the repo, please indicate so in the pull request.
You will need to submit a request to EIO, who will create the repo in
DockerHub. If this is not done, mirroring the artifact will fail. Nothing
special needs to be done for mirroring a new artifact to the Rancher Prime
Expand Down Expand Up @@ -78,7 +81,7 @@ This section roughly correlates to the `creds` section of `regsync.yaml`.
| `Password` | yes | The password to use when authenticating against the registry. See [the regsync documentation](https://regclient.org/usage/regsync/) for more details.
| `Registry` | yes | The registry URL. See [the regsync documentation](https://regclient.org/usage/regsync/) for more details.
| `ReqConcurrent` | no | The number of concurrent requests that are made to this registry. See [the regsync documentation](https://regclient.org/usage/regsync/) for more details.
| `DefaultTarget` | no | Whether the Repository is used as a target repository for a given artifact when the `TargetRepositories` field of the artifact is not set.
| `DefaultTarget` | no | Whether the Repository is used as a target repository for a given artifact when the `TargetRepositories` field of the `Artifact` is not set.
| `Username` | yes | The username to use when authenticating against the registry. See [the regsync documentation](https://regclient.org/usage/regsync/) for more details.

#### `Artifacts`
Expand All @@ -88,17 +91,17 @@ repository.

| Field | Required | Description |
|----------------------| ------------- |------------- |
| `DoNotMirror` | no | Set to `true` to exclude the entire artifact from regsync.yaml. Alternatively, set to an array of strings to specify tags to exclude from regsync.yaml.
| `DoNotMirror` | no | Set to `true` to exclude the entire `Artifact` from regsync.yaml. Alternatively, set to an array of strings to specify tags to exclude from regsync.yaml.
| `SourceArtifact` | yes | The source artifact. If there is no host, the artifact is assumed to be from Docker Hub.
| `Tags` | yes | The tags to mirror.
| `TargetArtifactName` | no | By default, the target artifact name is derived from the source artifact, and is of the format `mirrored-<org>-<name>`. For example, `banzaicloud/logging-operator` becomes `mirrored-banzaicloud-logging-operator`. However, there are some artifacts that do not follow this convention - this field exists for these cases. New artifacts should not set this field.
| `TargetRepositories` | no | Repositories to mirror the artifact to. Repositories are specified via their `BaseUrl` field. If not specified, the artifact is mirrored to all Repositories that have `DefaultTarget` set to true.
| `TargetRepositories` | no | Repositories to mirror the artifact to. Repositories are specified via their `BaseUrl` field. If not specified, the `Artifact` is mirrored to all Repositories that have `DefaultTarget` set to true.

### `autoupdate.yaml`

`autoupdate.yaml` defines configuration for automatically updating image tags
`autoupdate.yaml` defines configuration for automatically updating artifact tags
based on various update strategies that monitor sources for new tags. Each
entry specifies a strategy for finding tags of images to potentially add to
entry specifies a strategy for finding tags of artifacts to potentially add to
`config.yaml`, which are then submitted as pull requests.

| Field | Required | Description |
Expand All @@ -112,44 +115,44 @@ entry specifies a strategy for finding tags of images to potentially add to
#### `GithubRelease`

The `GithubRelease` strategy fetches all release tags that matches the VersionConstraint from a GitHub
repository and applies it to the specified images.
repository and applies it to the specified artifacts.
If LatestOnly is true, it only fetches from the latest release and does not consider the VersionConstraint.

| Field | Required | Description |
|---------------------|----------|------------- |
| `Owner` | yes | The GitHub repository owner/organization.
| `Repository` | yes | The GitHub repository name.
| `Images` | yes | See [`Images`](#images).
| `Artifacts` | yes | See [`Artifacts`](#Artifacts).
| `LatestOnly` | no | If true, get only the tag from the latest github release.
| `VersionConstraint` | no | A SemVer constraint used to filter the github releases.
| `VersionRegex` | no | If specified, only matching release tags will be considered. If a capture group is present, only its contents will be passed on.

##### `Images`
##### `Artifacts`

A list of images to be updated with the latest release tag. Each image will get the same tag as the GitHub release.
A list of artifacts to be updated with the latest release tag. Each artifact will get the same tag as the GitHub release.

| Field | Required | Description |
| ------------- | ------------- |------------- |
| `SourceImage` | yes | The GitHub repository name.
| `TargetImageName` | no | The TargetImageName of the image in `config.yaml` that you want to update.
| Field | Required | Description |
|----------------------| ------------- |------------- |
| `SourceArtifact` | yes | The GitHub repository name.
| `TargetArtifactName` | no | The TargetArtifactName of the artifact in `config.yaml` that you want to update.

#### `HelmLatest`

The `HelmLatest` strategy templates out the latest version of configured
Helm charts and extracts image references from the rendered manifests. It
Helm charts and extracts artifact references from the rendered manifests. It
recursively searches for fields with an "image" key in the templated YAML
output.

| Field | Required | Description |
| ------------- | ------------- |------------- |
| `HelmRepo` | yes | The URL of the Helm chart repository.
| `Charts` | yes | A map where keys are the charts to template, and values are another map from environment name to lists of helm values to `--set` in that environment. `helm template` is run once for each environment.
| `Images` | no | Used to map a given update image to an entry in `config.yaml`. There may be multiple entries that have the same `SourceImage`, but different `TargetImageName`s, so we need to choose which one receives the update image.
| Field | Required | Description |
|-----------------| ------------- |------------- |
| `HelmRepo` | yes | The URL of the Helm chart repository.
| `Charts` | yes | A map where keys are the charts to template, and values are another map from environment name to lists of helm values to `--set` in that environment. `helm template` is run once for each environment.
| `Artifacts` | no | Used to map a given update artifact to an entry in `config.yaml`. There may be multiple entries that have the same `SourceArtifact`, but different `TargetArtifactName`s, so we need to choose which one receives the update artifact.
| `ImageDenylist` | no | A list of images to exclude from the results.

#### `Registry`

The `Registry` strategy fetches all image tags that matches the `VersionFilter` from a registry defined in the Images provided.
The `Registry` strategy fetches all artifact tags that matches the `VersionFilter` from a registry defined in the `Artifacts` provided.
Supported registries are:
* Suse Container Registry (registry.suse.com)
* Docker Hub
Expand All @@ -160,6 +163,6 @@ Supported registries are:

| Field | Required | Description |
|-----------------|----------|------------- |
| `Images` | yes | Used to map a given update image to an entry in `config.yaml`. There may be multiple entries that have the same `SourceImage`, but different `TargetImageName`s, so we need to choose which one receives the update image.
| `Artifacts` | yes | Used to map a given update artifact to an entry in `config.yaml`. There may be multiple entries that have the same `SourceArtifact`, but different `TargetArtifactName`s, so we need to choose which one receives the update artifact.
| `Latest` | no | A flag to only use the latest tag. This only works if all tags are in semver format.
| `VersionFilter` | no | A regex to match against the image tags fetched from the registry.
| `VersionFilter` | no | A regex to match against the artifact tags fetched from the registry.
Loading
Loading