Skip to content
Closed
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
8 changes: 8 additions & 0 deletions 04_setup_ironic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ for IMAGE_VAR in $(env | grep "_LOCAL_IMAGE=" | grep -o "^[^=]*") ; do
echo "RUN sed -i 's%$OLDIMAGE%${!IMAGE_VAR}%g' /release-manifests/*" >> $DOCKERFILE
done

if [ ! -z "${MIRROR_IMAGES}" ]; then
oc adm release mirror \
--insecure=true \
-a $REGISTRY_AUTH_FILE \
--from $OPENSHIFT_RELEASE_IMAGE \
--to $LOCAL_REGISTRY_ADDRESS/localimages/local-release-image
fi

if [ -f assets/templates/99_local-registry.yaml ] ; then
build_installer
sudo podman image build -t $OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE -f $DOCKERFILE
Expand Down
1 change: 1 addition & 0 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fi
source $CONFIG

export LOCAL_REGISTRY_ADDRESS=${LOCAL_REGISTRY_ADDRESS:-"192.168.111.1:5000"}
export MIRROR_IMAGES=${MIRROR_IMAGES:-}

#
# See https://openshift-release.svc.ci.openshift.org for release details
Expand Down
3 changes: 3 additions & 0 deletions config_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ set -x
#export IRONIC_LOCAL_IMAGE=quay.io/username/ironic
#export MACHINE_CONFIG_OPERATOR_LOCAL_IMAGE=https://github.com/openshift/machine-config-operator

# Mirror latest ci images to local registry
#export MIRROR_IMAGES=true

# Switch to upstream metal3-io ironic images instead of openshift ones.
#export UPSTREAM_IRONIC=true

Expand Down
1 change: 1 addition & 0 deletions ocp_install_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ platform:
dnsVIP: ${DNS_VIP}
hosts:
$(master_node_map_to_install_config $NUM_MASTERS)
$(image_mirror_config)
pullSecret: |
$(echo $PULL_SECRET | jq -c .)
sshKey: |
Expand Down
16 changes: 16 additions & 0 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,19 @@ function bmo_config_map {

cp ocp/deploy/metal3-config.yaml assets/generated/99_metal3-config.yaml
}

function image_mirror_config {
if [ ! -z "${MIRROR_IMAGES}" ]; then
TAGGED=$(echo $OPENSHIFT_RELEASE_IMAGE | sed -e 's/release://')
RELEASE=$(echo $OPENSHIFT_RELEASE_IMAGE | grep -o 'registry.svc.ci.openshift.org[^":]\+')
Comment on lines +191 to +192
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't always work, that's what I got while using nightly

Success
Update image:  192.168.123.141:5000/localimages/local-release-image:4.3.0-0.nightly-2019-11-25-022933
Mirror prefix: 192.168.123.141:5000/localimages/local-release-image

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

imageContentSources:
- mirrors:
  - 192.168.123.141:5000/localimages/local-release-image
  source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
- mirrors:
  - 192.168.123.141:5000/localimages/local-release-image
  source: registry.svc.ci.openshift.org/ocp/release

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe if the user wants to mirror images, we should ask them for the exact sources? What do you think?

Choose a reason for hiding this comment

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

I can confirm that was the behavior I got as well using 4.3 nightly's on an environment where I was doing disconnected.

Copy link

Choose a reason for hiding this comment

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

I don't like how the data structure is laid out at all... What we have here is a hodge podge of array and string objects. It will be mind bending to code against this.

How about ...

imageContentSources:
-
  target: <url>:<port> 
  user: <user ie. openshift-release-dev or localimages>
  release: <release ie. ocp-v4.0-art-dev or release>
-
  target: <url>:<port> 
  user: <user ie. openshift-release-dev or localimages>
  release: <release ie. ocp-v4.0-art-dev or release>
-
  target: <url>:<port> 
  user: <user ie. openshift-release-dev or localimages>
  release: <release ie. ocp-v4.0-art-dev or release>

Copy link
Member

Choose a reason for hiding this comment

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

This is an API defined by OpenShift, it's not something we can revisit.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mazzystr I'm not sure what you mean. We're simply using openshift-installer-provided values. We don't define any data structures.

cat << EOF
imageContentSources:
- mirrors:
- ${LOCAL_REGISTRY_ADDRESS}/localimages/local-release-image
source: ${RELEASE}
- mirrors:
- ${LOCAL_REGISTRY_ADDRESS}/localimages/local-release-image
source: ${TAGGED}
EOF
fi
}