-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gerd Oberlechner <[email protected]>
- Loading branch information
Showing
10 changed files
with
224 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
# oc-mirror | ||
|
||
This container contains oc-mirror end required dependencies. | ||
|
||
## Example usage for devarohcp | ||
|
||
* Build the container image `podman build -t oc-mirror .` | ||
* Alternatively, use `make image` | ||
* Get credentials for Openshift registries https://console.redhat.com/openshift/install/pull-secret | ||
* Get Azure registry credentials `az acr login -n devarohcp` | ||
* Run the sync using the built container | ||
```BASH | ||
podman run -it --rm --tmpfs /oc-mirror-workspace \ | ||
-e XDG_RUNTIME_DIR=/ \ | ||
-v $PWD/imageset-config.yml:/imageset-config.yml:Z \ | ||
-v $HOME/.docker/config.json:/containers/auth.json:Z \ | ||
oc-mirror \ | ||
oc mirror --config=/imageset-config.yml docker://devarohcp.azurecr.io --dry-run | ||
This tool packages oc-mirror and all dependencies to mirror OCP artifacts and operators to an ACR. | ||
|
||
## Build and push | ||
|
||
To build a container image and push it to the service ACR, run | ||
|
||
```bash | ||
make build-push | ||
``` | ||
|
||
Note, the above command will run the sync in dry-run mode. To run the sync, remove the `--dry-run` flag. | ||
## Production deployment | ||
|
||
## Example configuration | ||
oc-mirror and the required configurations are deployed as Azure Container App | ||
via the `dev-infrastructure/templates/image-sync.bicep` template. | ||
|
||
The following is an example of the configuration file `imageset-config.yml`. | ||
## Local dry-run | ||
|
||
This exact configuration was used in the initial testing of the `oc-mirror` tool. | ||
To run oc-mirror locally, you need to have an active Azure CLI session. | ||
|
||
```YAML | ||
kind: ImageSetConfiguration | ||
apiVersion: mirror.openshift.io/v1alpha2 | ||
storageConfig: | ||
registry: | ||
imageURL: devarohcp.azurecr.io/mirror/oc-mirror-metadata | ||
skipTLS: false | ||
mirror: | ||
platform: | ||
channels: | ||
- name: stable-4.16 | ||
type: ocp | ||
graph: true | ||
### OCP mirror | ||
|
||
To dry-run the OCP mirror, run | ||
|
||
```bash | ||
make ocp-dry-run | ||
``` | ||
|
||
The test mirror-configuration can be found in the `test` directory. | ||
|
||
### ACM/MCE mirror | ||
|
||
To dry-run the ACM/MCE operator mirror, run | ||
|
||
```bash | ||
make acm-dry-run | ||
``` | ||
|
||
The test mirror-configuration can be found in the `test` directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
ARO_HCP_IMAGE_ACR ?= {{ .svcAcrName }} | ||
ARO_HCP_FULL ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io | ||
OC_MIRROR_IMAGE ?= $(ARO_HCP_FULL)/{{ .ocMirrorImageRepo }} | ||
ARO_HCP_IMAGE_ACR_URL ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io | ||
OC_MIRROR_IMAGE ?= $(ARO_HCP_IMAGE_ACR_URL)/{{ .ocMirrorImageRepo }} | ||
OC_MIRROR_IMAGE_TAGGED ?= $(OC_MIRROR_IMAGE):$(COMMIT) | ||
|
||
ARO_HCP_OCP_IMAGE_ACR ?= {{ .ocpAcrName }} | ||
ARO_HCP_OCP_IMAGE_ACR_URL ?= ${ARO_HCP_OCP_IMAGE_ACR}.azurecr.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
#!/bin/sh | ||
az login --identity -u ${AZURE_CLIENT_ID} | ||
echo ${IMAGE_SET_CONFIG} | base64 -d | yq eval -P > /config/imageset-config.yaml | ||
DOCKER_COMMAND=/usr/local/bin/docker-login.sh az acr login -n ${REGISTRY} | ||
/usr/local/bin/oc-mirror --continue-on-error --config /config/imageset-config.yaml docker://${REGISTRY_URL} @$ | ||
|
||
IMAGE_SET_CONFIG_FILE="/config/imageset-config.yaml" | ||
echo ${IMAGE_SET_CONFIG} | base64 -d | yq eval -P > ${IMAGE_SET_CONFIG_FILE} | ||
API_VERSION=$(yq eval '.apiVersion' ${IMAGE_SET_CONFIG_FILE}) | ||
|
||
if echo "$API_VERSION" | grep -q "^mirror.openshift.io/v2"; then | ||
ADDITIONAL_FLAGS="--workspace file:///oc-mirror-workspace --v2" | ||
else | ||
ADDITIONAL_FLAGS="--continue-on-error" | ||
fi | ||
|
||
/usr/local/bin/oc-mirror --config ${IMAGE_SET_CONFIG_FILE} ${ADDITIONAL_FLAGS} docker://${REGISTRY_URL} @$ |
Oops, something went wrong.