From 3ec52745f4a12cbfe3d697e26b1bed8c8a63a93b Mon Sep 17 00:00:00 2001 From: karmab Date: Thu, 10 Oct 2024 10:24:50 +0200 Subject: [PATCH] prega boolean --- kcli_pre.sh | 7 ++++++ paramfiles/prega.yml | 3 ++- plans/kcli_plan_default.yml | 2 +- scripts/04_disconnected_olm.sh | 5 ++-- scripts/mirror-config.yaml.sample | 39 ++++--------------------------- 5 files changed, 18 insertions(+), 38 deletions(-) diff --git a/kcli_pre.sh b/kcli_pre.sh index 62ab32d..4f57e1e 100755 --- a/kcli_pre.sh +++ b/kcli_pre.sh @@ -222,3 +222,10 @@ exit 1 echo You need to populate baremetal_macs with the complete list of mac addresses including your spokes or put that info in baremetal_nodes arrays exit 1 {% endif %} + +{% if prega %} +if [ "$(grep quay.io/prega {{ pull_secret }})" == "" ] ; then +echo prega requires a valid pull secret entry +exit 1 +fi +{% endif %} diff --git a/paramfiles/prega.yml b/paramfiles/prega.yml index c8b462f..1dd7b52 100644 --- a/paramfiles/prega.yml +++ b/paramfiles/prega.yml @@ -1,6 +1,7 @@ version: dev-preview tag: 4.18.0-ec.1 -disconnected_prega_operators: +prega: true +disconnected_operators: - name: cluster-logging channels: - name: stable-6.0 diff --git a/plans/kcli_plan_default.yml b/plans/kcli_plan_default.yml index e89630a..a226a88 100644 --- a/plans/kcli_plan_default.yml +++ b/plans/kcli_plan_default.yml @@ -59,7 +59,6 @@ disconnected_operators_deploy_after_openshift: false disconnected_certified_operators: [] disconnected_community_operators: [] disconnected_marketplace_operators: [] -disconnected_prega_operators: [] disconnected_operators_version: disconnected_certified_operators_version: disconnected_community_operators_version: @@ -68,6 +67,7 @@ disconnected_extra_images: [] disconnected_extra_catalogs: [] disconnected_extra_releases: [] disconnected_clean_pull_secret: false +prega: false nfs: false imageregistry: false go_version: 1.13.8 diff --git a/scripts/04_disconnected_olm.sh b/scripts/04_disconnected_olm.sh index f159343..8225c0a 100755 --- a/scripts/04_disconnected_olm.sh +++ b/scripts/04_disconnected_olm.sh @@ -52,7 +52,7 @@ cp -f /root/openshift_pull.json /root/.docker/config.json envsubst < /root/scripts/mirror-config.yaml.sample > /root/mirror-config.yaml rm -rf /root/oc-mirror-workspace || true -oc-mirror --config /root/mirror-config.yaml --max-per-registry 20 --ignore-history docker://$LOCAL_REGISTRY > /tmp/mirror-registry-output || oc-mirror --config /root/mirror-config.yaml --max-per-registry 20 --ignore-history docker://$LOCAL_REGISTRY > /tmp/mirror-registry-output || oc-mirror --config /root/mirror-config.yaml --max-per-registry 20 --ignore-history docker://$LOCAL_REGISTRY > /tmp/mirror-registry-output +oc-mirror --config /root/mirror-config.yaml --max-per-registry 20 --ignore-history --max-nested-paths 5 docker://$LOCAL_REGISTRY > /tmp/mirror-registry-output || oc-mirror --config /root/mirror-config.yaml --max-per-registry 20 --ignore-history --max-nested-paths 5 docker://$LOCAL_REGISTRY > /tmp/mirror-registry-output || oc-mirror --config /root/mirror-config.yaml --max-per-registry 20 --ignore-history --max-nested-paths 5 docker://$LOCAL_REGISTRY > /tmp/mirror-registry-output # When there are no new images to be mirrored, oc-mirror will not generate the icsp and catalogsource files, so we need to get them generated by ourselves if [ $(grep -c "No new images detected" /tmp/mirror-registry-output) -eq 1 ] ; then @@ -64,9 +64,10 @@ if [ $(grep -c "No new images detected" /tmp/mirror-registry-output) -eq 1 ] ; t python3 /root/bin/mapping_to_icsp.py -m /root/oc-mirror-workspace/mapping.txt -o /root/oc-mirror-workspace/results-mapping/ -c /root/mirror-config.yaml fi -{% if disconnected_prega_operators|length > 0 %} +{% if prega %} [ ! -d /root/idms ] || rm -rf /root/idms mkdir /root/idms +cp /root/oc-mirror-workspace/results-*/*imageContentSourcePolicy.yaml sed -i -e '/source:/!b;/bundle/b;/cincinnati/b;s,quay.io/prega/test/,registry.redhat.io/,' /root/oc-mirror-workspace/results-*/*imageContentSourcePolicy.yaml oc adm migrate icsp /root/oc-mirror-workspace/results-*/*imageContentSourcePolicy.yaml --dest-dir /root/idms {% endif %} diff --git a/scripts/mirror-config.yaml.sample b/scripts/mirror-config.yaml.sample index 621566c..89cea1e 100644 --- a/scripts/mirror-config.yaml.sample +++ b/scripts/mirror-config.yaml.sample @@ -1,6 +1,3 @@ -{% if disconnected_prega_operators|length > 0 %} -{% set disconnected_operators = [] %} -{% endif %} apiVersion: mirror.openshift.io/v1alpha2 kind: ImageSetConfiguration storageConfig: @@ -13,18 +10,15 @@ mirror: # minVersion: 4.10.24 # maxVersion: 4.10.24 # graph: true - operators: # Operators we want to mirror + operators: {% if disconnected_operators %} -{% if disconnected_operators_version %} - - catalog: registry.redhat.io/redhat/redhat-operator-index:{{ disconnected_operators_version }} -{% else %} - - catalog: registry.redhat.io/redhat/redhat-operator-index:v${OCP_RELEASE} -{% endif %} +{% set catalog = 'quay.io/prega/prega-operator-index' if prega else 'registry.redhat.io/redhat/redhat-operator-index' %} + - catalog: {{ catalog }}:{{ disconnected_operators_version or 'v${OCP_RELEASE}' }} packages: {% for package in disconnected_operators %} -{% if package.name is defined %}{# Comment: Support new syntax allowing to further filtering #} +{% if package.name is defined %} - name: {{ package.name }} -{% else %}{# Comment: Support old syntax #} +{% else %} - name: {{ package }} {% endif %} {% if package.channels is defined and package.channels|length > 0 %} @@ -122,29 +116,6 @@ mirror: {% endif %} {% endfor %} {% endif %} -{% if disconnected_prega_operators %} - - catalog: quay.io/prega/prega-operator-index:v${OCP_RELEASE} - packages: -{% for package in disconnected_prega_operators %} -{% if package.name is defined %} - - name: {{ package.name }} -{% else %} - - name: {{ package }} -{% endif %} -{% if package.channels is defined and package.channels|length > 0 %} - channels: -{% for channel in package.channels %} - - name: {{ channel.name }} -{% if channel.minVersion is defined %} - minVersion: {{ channel.minVersion }} -{% endif %} -{% if channel.maxVersion is defined %} - maxVersion: {{ channel.maxVersion }} -{% endif %} -{% endfor %} -{% endif %} -{% endfor %} -{% endif %} {% if disconnected_extra_catalogs %} {% for catalog_image in disconnected_extra_catalogs %} - catalog: {{ catalog_image }}