Skip to content

Commit

Permalink
prega boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
karmab committed Oct 10, 2024
1 parent 1c3ab9a commit 3ec5274
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 38 deletions.
7 changes: 7 additions & 0 deletions kcli_pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
3 changes: 2 additions & 1 deletion paramfiles/prega.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion plans/kcli_plan_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions scripts/04_disconnected_olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 %}
Expand Down
39 changes: 5 additions & 34 deletions scripts/mirror-config.yaml.sample
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{% if disconnected_prega_operators|length > 0 %}
{% set disconnected_operators = [] %}
{% endif %}
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
Expand All @@ -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 %}
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit 3ec5274

Please sign in to comment.