Skip to content

DO NOT MERGE: OLD BRANCH ICSP mirroring - old - #790

Closed
sallyom wants to merge 4 commits into
openshift:masterfrom
sallyom:icsp_old
Closed

sallyom wants to merge 4 commits into
openshift:masterfrom
sallyom:icsp_old

Conversation

@sallyom

@sallyom sallyom commented Mar 27, 2021

Copy link
Copy Markdown
Contributor

sample output of mirroring

$ oc adm release mirror 4.7.0 --to localhost:5000/openshift/release
-----
info: Mirroring completed in 750ms (0B/s)

Success
Update image:  localhost:5000/openshift/release:4.7.0
Mirror prefix: localhost:5000/openshift/release

To use the new mirrored repository to install, add the following section to the install-config.yaml:

imageContentSources:
- mirrors:
  - localhost:5000/openshift/release
  source: quay.io/openshift-release-dev/ocp-release
- mirrors:
  - localhost:5000/openshift/release
  source: quay.io/openshift-release-dev/ocp-v4.0-art-dev

ImageContentSourcePolicy file config/icsp-sha256-e1ed6d1672bf041f.yaml created


To use the new mirrored repository for upgrades, use the following to create an ImageContentSourcePolicy:

apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  name: release
spec:
  repositoryDigestMirrors:
  - mirrors:
    - localhost:5000/openshift/release
    source: quay.io/openshift-release-dev/ocp-release
  - mirrors:
    - localhost:5000/openshift/release
    source: quay.io/openshift-release-dev/ocp-v4.0-art-dev


To apply ImageContentSourcePolicy,  use 'oc apply' on file config/icsp-sha256-e1ed6d1672bf041f.yaml

sample cmds to test extracts (logging currently at v(2) but will increase)
pull-secret has quay creds+localhost, pull-secret-local only has localhost creds:

$ oc adm release extract --command openshift-install -a ~/pull-secret-local localhost:5000/openshift/release:4.7.0-x86_64 -v=2
$ oc adm release extract --command openshift-install -a ~/pull-secret-local 4.7.0 --icsp-file config/icsp-sha256-e1ed6d1672bf041f.yaml  -v=2
$ oc adm release extract --command openshift-install quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:d74b1cfa81f8c9cc23336aee72d8ae9c9905e62c4874b071317a078c316f8a70 --icsp-file /tmp/config/icsp-sha256....yaml -a ~/ps-local
$ oc apply -f  config/icsp-sha256-e1ed6d1672bf041f.yaml
$ oc adm release extract --command openshift-install -a ~/pull-secret-local 4.7.0 -v=2

Sample output of oc image extract:

$ cat /tmp/icsp.yaml 
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  name: tests
spec:
  repositoryDigestMirrors:
  - mirrors:
    - localhost:5000/tests
    source: registry.ci.openshift.org/ocp/4.7
$ oc image mirror registry.ci.openshift.org/ocp/4.7:tests=localhost:5000/tests -a ~/installer/pull-secret
$ mkdir /tmp/ext  && oc image extract registry.ci.openshift.org/ocp/4.7:tests --path=/:/tmp/ext -a ~/ps-local -v=2 --icsp-file /tmp/icsp.yaml
I0214 09:34:27.668384  721898 simplelookup.go:133] registry.ci.openshift.org/ocp/4.7 RepositoryDigestMirrors source matches given image
I0214 09:34:27.668425  721898 simplelookup.go:138] localhost:5000/tests RepositoryDigestMirrors mirror added to potential ImageSourcePrefixes from ImageContentSourcePolicy
I0214 09:34:27.668434  721898 simplelookup.go:163] Found sources: [localhost:5000/tests] for image: registry.ci.openshift.org/ocp/4.7:tests

sallyom added 4 commits March 24, 2021 18:15
For 'oc adm release' commands:
0. If user passes --icsp-file path, fail if no valid sources found from the file
1. Try the current flow of lookup image from any underlying image references.  If this fails, go to 2.
2. Try to gather image source info from ImageContentSourcePolicy from cluster, if this fails go to 3.
3. Set the registry/repo/name to be that of user-given release rather than its refs.  If image not found,
return the original error from 1.

For 'oc image' commands:
Do not implicitly check alternative image sources.
* If user passes --icsp-file path, fail if no valid sources found from the file
* If user passes --lookup-cluster-icsp, fail if no valid sources found from the cluster
* Try the current flow of lookup image from any underlying image references.

When working with mirrored release payloads, a release from a mirrored registry,
mylocalregistry/ocp/release:4.5.0-0.nightly-2020-04-18-093630 mirrored from
registry.svc.ci.openshift.org/ocp/release:4.5.0-0.nightly-2020-04-18-093630 -
Both reference 'quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:2eb0a51...'.
In case of disconnected, oc will now use 'mylocalregistry/ocp/release' if passed,
instead of 'quay.io/openshift-release-dev/ocp-v4.0-art-dev' _or_ it will succeed with
'quay.io/openshift-release-dev/ocp-v4.0-art-dev' if a matching ICSP is found in cluster,
or get image source information from an ICSP file passed.
@openshift-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sallyom
To complete the pull request process, please assign mfojtik after the PR has been reviewed.
You can assign the PR to them by writing /assign @mfojtik in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants