openshift / oc-mirror

Lifecycle manager for internet-disconnected OpenShift environments
Apache License 2.0
82 stars 80 forks source link

possible to replace `oc adm release mirror` for imageContentSources generation and image download? #873

Open brightzheng100 opened 4 weeks ago

brightzheng100 commented 4 weeks ago

Currently, as per the doc, there is a need to generate the imageContentSources with command like:

$ oc adm release mirror \
    --registry-config=${LOCAL_SECRET_JSON} \
    --from=quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE} \
    --to=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY} \
    --to-release-image=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY}:${OCP_RELEASE}-${ARCHITECTURE} \
    --dry-run

So that we can have something like:

imageContentSources:
- mirrors:
  - registry.ocp4.local:8443/ocp4/openshift4
  source: quay.io/openshift-release-dev/ocp-release
- mirrors:
  - registry.ocp4.local:8443/ocp4/openshift4
  source: quay.io/openshift-release-dev/ocp-v4.0-art-dev

And then download the OpenShift cluster images with another command:

$ oc adm release mirror \
    --registry-config=${LOCAL_SECRET_JSON} \
    --to-dir=${REMOVABLE_MEDIA_PATH} \
    quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE}

So question: Is it possible to use oc-mirror to

  1. generate such imageContentSources YAML section for install-config.yaml?
  2. download OpenShift cluster images without the need of oc adm release mirror?

Look forward to your advice. Thank you!

brightzheng100 commented 4 weeks ago

Wait, how about image upload?

$ oc image mirror \
    --registry-config=${LOCAL_SECRET_JSON} \
    --from-dir=${REMOVABLE_MEDIA_PATH} \
    "file://openshift/release:${OCP_RELEASE}*" \
    ${LOCAL_REGISTRY}/${LOCAL_REPOSITORY} \
    --skip-missing