diff --git a/agent/05_agent_configure.sh b/agent/05_agent_configure.sh index 019b8e482..d0457b7dc 100755 --- a/agent/05_agent_configure.sh +++ b/agent/05_agent_configure.sh @@ -240,9 +240,9 @@ function get_mirror_info { # output ImageDigestSources, while prior to that it was ImageContentSources sed -n -E '/imageContentSources|imageDigestSources/,/^ *$/p' ${MIRROR_LOG_FILE} | tail -n+2 > ${tmpmirrorinfo} else - results_dir=$(grep ICSP ${WORKING_DIR}/.oc-mirror.log | grep -o 'oc-mirror[^;]*') - sed -ne '/repository/,/---/p' ${WORKING_DIR}/${results_dir}/imageContentSourcePolicy.yaml > ${tmpmirrorinfo} - sed -i '/repositoryDigestMirrors/d;/---/d' ${tmpmirrorinfo} + # Get the mirror config from the idms file generated by oc-mirror + idms_file=${WORKING_DIR}/working-dir/cluster-resources/idms-oc-mirror.yaml + sed -ne '/imageDigestMirrors:$/,/^status:/{/imageDigestMirrors:$/d;/^status:/d;p;}' $idms_file | sed 's/ //' > ${tmpmirrorinfo} fi if [[ ${AGENT_USE_ZTP_MANIFESTS} == true ]]; then diff --git a/agent/roles/manifests/templates/install-config_baremetal_yaml.j2 b/agent/roles/manifests/templates/install-config_baremetal_yaml.j2 index 7b1013e85..286bc68e1 100644 --- a/agent/roles/manifests/templates/install-config_baremetal_yaml.j2 +++ b/agent/roles/manifests/templates/install-config_baremetal_yaml.j2 @@ -56,9 +56,7 @@ platform: baremetal: apiVIPs: {% set a_vips = api_vips.split(',') %} -{% for api_vip in a_vips %} - - {{ api_vip }} -{% endfor %} + - {{ a_vips[0] }} ingressVIPs: {% set i_vips = ingress_vips.split(',') %} {% for ingress_vip in i_vips %} @@ -133,4 +131,4 @@ proxy: {% if no_proxy %} noProxy: "{{ no_proxy }}" {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/common.sh b/common.sh index 417085268..27e3dd419 100644 --- a/common.sh +++ b/common.sh @@ -551,12 +551,6 @@ if [[ "${MIRROR_IMAGES,,}" != "false" ]] && [[ "${MIRROR_IMAGES,,}" == "true" || if [[ "${MIRROR_COMMAND}" == "oc-mirror" ]]; then # Use the string that is generated by the output of oc-mirror export LOCAL_IMAGE_URL_SUFFIX="openshift/release-images" - - # set up the channel using the most recent candidate release - pushd ${WORKING_DIR} - release_candidate=`oc-mirror list releases --channel=candidate-${OPENSHIFT_RELEASE_STREAM} | tail -1` - popd - export OPENSHIFT_RELEASE_TAG="${release_candidate}-$(uname -m)" fi # We're going to be using a locally modified release image diff --git a/config_example.sh b/config_example.sh index 4ed2c2f14..56887d821 100755 --- a/config_example.sh +++ b/config_example.sh @@ -645,12 +645,6 @@ set -x # Default: oc-adm #export MIRROR_COMMAND=oc-adm -# OC_MIRROR_TO_FILE - -# When MIRROR_IMAGES is true and MIRROR_COMMAND is oc-mirror, if this is set it -# will cause the mirror to be generated in a 2-step process. First the contents of -# the mirror is stored in a tarfile and then the tarfile is published to the registry -# Default is unset - # When the MIRROR_COMMAND is set to 'oc-mirror' the auths for the mirror will be added # to DOCKER_CONFIG_FILE or an UNAUTHORIZED error will result. # An example entry in this file is: diff --git a/oc_mirror.sh b/oc_mirror.sh index f00067a43..89b766ca5 100755 --- a/oc_mirror.sh +++ b/oc_mirror.sh @@ -49,93 +49,39 @@ function setup_quay_mirror_registry() { popd } -function create_registry_imageset() { - - imageset=$1 - - cat > "${imageset}" << EOF -apiVersion: mirror.openshift.io/v1alpha2 -kind: ImageSetConfiguration -archiveSize: 4 -storageConfig: - registry: - imageURL: ${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT}/origin:latest - skipTLS: true -mirror: - platform: - architectures: - - "amd64" - channels: - - name: candidate-${OPENSHIFT_RELEASE_STREAM} - type: ocp - additionalImages: - - name: registry.redhat.io/ubi8/ubi:latest -EOF - -} - function create_file_imageset() { imageset=$1 - latest_release=$(oc-mirror list releases --channel candidate-${OPENSHIFT_RELEASE_STREAM}| tail -n1) - - # Note that the archiveSize defines the maximum size, in GiB, of each file within the image set. - # This must be large enough to include all images in one file for the publish. cat > "${imageset}" << EOF -apiVersion: mirror.openshift.io/v1alpha2 kind: ImageSetConfiguration -archiveSize: 16 -storageConfig: - local: - path: metadata +apiVersion: mirror.openshift.io/v2alpha1 mirror: platform: - architectures: - - "amd64" - channels: - - name: candidate-${OPENSHIFT_RELEASE_STREAM} - minVersion: $latest_release - maxVersion: $latest_release - type: ocp + graph: true + release: $OPENSHIFT_RELEASE_IMAGE additionalImages: - name: registry.redhat.io/ubi8/ubi:latest EOF } -# Mirror the upstream channel directly to the local registry -function mirror_to_mirror_publish() { - - # Create imageset containing the local URL and the OCP release to mirror - tmpimageset=$(mktemp --tmpdir "imageset--XXXXXXXXXX") - _tmpfiles="$_tmpfiles $tmpimageset" - - create_registry_imageset $tmpimageset - - pushd ${WORKING_DIR} - oc mirror --dest-skip-tls --config ${tmpimageset} docker://${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT} - popd -} - # Use the oc-mirror command to generate a tar file of the release image function mirror_to_file() { config=${1} pushd ${WORKING_DIR} - oc_mirror_dir=$(mktemp --tmpdir -d "oc-mirror-files--XXXXXXXXXX") - _tmpfiles="$_tmpfiles $oc_mirror_dir" - oc-mirror --config ${config} file://${oc_mirror_dir} --ignore-history - archive_file="$(ls ${oc_mirror_dir}/mirror_seq*)" + oc-mirror --v2 --config ${config} file://${WORKING_DIR} popd - } function publish_image() { + config=${1} + pushd ${WORKING_DIR} - oc-mirror --from $archive_file docker://${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT} --dest-skip-tls --skip-metadata-check + oc-mirror --v2 --config ${config} --from file://${WORKING_DIR} docker://${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT} popd } @@ -146,16 +92,15 @@ function setup_oc_mirror() { update_docker_config - if [ -z "${OC_MIRROR_TO_FILE}" ]; then - mirror_to_mirror_publish - else - tmpimageset=$(mktemp --tmpdir "imageset--XXXXXXXXXX") - _tmpfiles="$_tmpfiles $tmpimageset" + tmpimageset=$(mktemp --tmpdir "imageset--XXXXXXXXXX") + _tmpfiles="$_tmpfiles $tmpimageset" - create_file_imageset $tmpimageset + create_file_imageset $tmpimageset - mirror_to_file $tmpimageset + mirror_to_file $tmpimageset - publish_image - fi + publish_image $tmpimageset + + # remove interim file + rm ${WORKING_DIR}/mirror_*.tar } diff --git a/oc_mirror_cleanup.sh b/oc_mirror_cleanup.sh index 202b45fa0..4f3765391 100755 --- a/oc_mirror_cleanup.sh +++ b/oc_mirror_cleanup.sh @@ -14,12 +14,8 @@ if [[ -f "/usr/local/bin/oc-mirror" ]]; then sudo rm "/usr/local/bin/oc-mirror" fi -if [ -f "${WORKING_DIR}/.oc-mirror.log" ]; then - rm "${WORKING_DIR}/.oc-mirror.log" -fi - -if [ -d "${WORKING_DIR}/oc-mirror-workspace" ]; then - rm -rf "${WORKING_DIR}/oc-mirror-workspace" +if [ -d "${WORKING_DIR}/working-dir" ]; then + rm -rf "${WORKING_DIR}/working-dir" fi if [ -d "${WORKING_DIR}/quay-install" ]; then