Skip to content

Commit a8c31b7

Browse files
Add oadp disconnected support (#448)
* add oadp disconnected support * Update disconnected prep script and CSV * More CSV updates * Remove comments Co-authored-by: dymurray <[email protected]>
1 parent af016c1 commit a8c31b7

File tree

2 files changed

+127
-10
lines changed

2 files changed

+127
-10
lines changed

deploy/disconnected-prep.sh

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/bin/bash
2+
3+
#Find most recent version
4+
export OADPVERSION=$(ls deploy/olm-catalog/bundle/manifests/oadp-operator.v* | awk -F '.' '{out=""; for(i=2;i<4;i++){out=out$i"."}{out=out$4}; print out}')
5+
export OADPTAG=$(git branch --show-current)
6+
git checkout origin/$(git branch --show-current) -- Dockerfile
7+
git checkout origin/$(git branch --show-current) -- .gitignore
8+
for file in $(git status --porcelain -- render_templates* | awk '{print $2}'); do
9+
git checkout origin/$(git branch --show-current) -- "${file}"
10+
done
11+
12+
13+
#Declare image information
14+
IMAGES=(
15+
"operator"
16+
"plugin"
17+
"velero"
18+
"helper"
19+
"csiplugin"
20+
"gcpplugin"
21+
"awsplugin"
22+
"azureplugin"
23+
"registry"
24+
)
25+
26+
declare -A IMG_MAP
27+
IMG_MAP[operator_repo]="oadp-operator"
28+
IMG_MAP[plugin_repo]="openshift-velero-plugin"
29+
IMG_MAP[velero_repo]="velero"
30+
IMG_MAP[helper_repo]="velero-restic-restore-helper"
31+
IMG_MAP[csiplugin_repo]="velero-plugin-for-csi"
32+
IMG_MAP[gcpplugin_repo]="velero-plugin-for-gcp"
33+
IMG_MAP[awsplugin_repo]="velero-plugin-for-aws"
34+
IMG_MAP[azureplugin_repo]="velero-plugin-for-microsoft-azure"
35+
IMG_MAP[registry_repo]="registry"
36+
37+
#Get latest images
38+
for i in ${IMAGES[@]}; do
39+
docker pull quay.io/konveyor/${IMG_MAP[${i}_repo]}:${OADPTAG} >/dev/null 2>&1
40+
DOCKER_STAT=$?
41+
RETRIES=10
42+
while [ "$DOCKER_STAT" -ne 0 ] && [ $RETRIES -gt 0 ]; do
43+
docker pull quay.io/konveyor/${IMG_MAP[${i}_repo]}:${OADPTAG} >/dev/null 2>&1
44+
DOCKER_STAT=$?
45+
let RETRIES=RETRIES-1
46+
done
47+
48+
if [ $RETRIES -le 0 ]; then
49+
echo "Failed to pull new images"
50+
exit 1
51+
fi
52+
done
53+
54+
#oc mirror images to get correct shas
55+
for i in ${IMAGES[@]}; do
56+
RETRIES=10
57+
while [ -z "${IMG_MAP[${i}_sha]}" ] && [ $RETRIES -gt 0 ]; do
58+
IMG_MAP[${i}_sha]=$(oc image mirror --keep-manifest-list=true --dry-run=true quay.io/konveyor/${IMG_MAP[${i}_repo]}:${OADPTAG}=quay.io/foobar/${IMG_MAP[${i}_repo]}:${OADPTAG} 2>&1 | grep "\->" | awk -F'[: ]' '{ print $8 }')
59+
let RETRIES=RETRIES-1
60+
done
61+
62+
if [ $RETRIES -le 0 ]; then
63+
echo "Failed to mirror images to obtain SHAs"
64+
exit 1
65+
fi
66+
done
67+
68+
69+
# Make CSV Changes check for OADP version inf csv file name
70+
for f in deploy/olm-catalog/bundle/manifests/oadp-operator.${OADPVERSION}.clusterserviceversion.yaml
71+
do
72+
sed -i "s,oadp-operator:.*,oadp-operator@sha256:${IMG_MAP[operator_sha]},g" ${f}
73+
sed -i "s,/velero:.*,/velero@sha256:${IMG_MAP[velero_sha]},g" ${f}
74+
sed -i "s,/velero-restic-restore-helper:.*,/velero-restic-restore-helper@sha256:${IMG_MAP[helper_sha]},g" ${f}
75+
sed -i "s,/openshift-velero-plugin:.*,/openshift-velero-plugin@sha256:${IMG_MAP[plugin_sha]},g" ${f}
76+
sed -i "s,/velero-plugin-for-aws:.*,/velero-plugin-for-aws@sha256:${IMG_MAP[awsplugin_sha]},g" ${f}
77+
sed -i "s,/velero-plugin-for-microsoft-azure:.*,/velero-plugin-for-microsoft-azure@sha256:${IMG_MAP[azureplugin_sha]},g" ${f}
78+
sed -i "s,/velero-plugin-for-csi:.*,/velero-plugin-for-csi@sha256:${IMG_MAP[csiplugin_sha]},g" ${f}
79+
sed -i "s,/velero-plugin-for-gcp:.*,/velero-plugin-for-gcp@sha256:${IMG_MAP[gcpplugin_sha]},g" ${f}
80+
sed -i "s,/registry:.*,/registry@sha256:${IMG_MAP[registry_sha]},g" ${f}
81+
sed -i 's,value: velero-restic-restore-helper,value: velero-restic-restore-helper@sha256,g' ${f}
82+
sed -i 's,value: velero-plugin-for-csi,value: velero-plugin-for-csi@sha256,g' ${f}
83+
sed -i 's,value: velero-plugin-for-gcp,value: velero-plugin-for-gcp@sha256,g' ${f}
84+
sed -i 's,value: velero-plugin-for-aws,value: velero-plugin-for-aws@sha256,g' ${f}
85+
sed -i 's,value: velero-plugin-for-microsoft-azure,value: velero-plugin-for-microsoft-azure@sha256,g' ${f}
86+
sed -i 's,value: velero$,value: velero@sha256,g' ${f}
87+
sed -i 's,value: openshift-velero-plugin$,value: openshift-velero-plugin@sha256,g' ${f}
88+
sed -i 's,value: registry$,value: registry@sha256,g' ${f}
89+
sed -i "/VELERO_OPENSHIFT_PLUGIN_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[plugin_sha]}/" ${f}
90+
sed -i "/VELERO_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[velero_sha]}/" ${f}
91+
sed -i "/VELERO_RESTIC_RESTORE_HELPER_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[helper_sha]}/" ${f}
92+
sed -i "/VELERO_CSI_PLUGIN_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[csiplugin_sha]}/" ${f}
93+
sed -i "/VELERO_GCP_PLUGIN_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[gcpplugin_sha]}/" ${f}
94+
sed -i "/VELERO_AWS_PLUGIN_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[awsplugin_sha]}/" ${f}
95+
sed -i "/VELERO_AZURE_PLUGIN_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[azureplugin_sha]}/" ${f}
96+
sed -i "/VELERO_REGISTRY_TAG/,/^ *[^:]*:/s/value: .*/value: ${IMG_MAP[registry_sha]}/" ${f}
97+
if [[ "$f" =~ .*clusterserviceversion.* ]] && ! grep -q infrastructure-features ${f}; then
98+
sed -i '/^spec:/i\ \ \ \ operators.openshift.io/infrastructure-features: \x27[\"Disconnected\"]\x27' ${f}
99+
fi
100+
if [[ "$f" =~ .*clusterserviceversion.* ]] && ! grep -q cluster-monitoring ${f}; then
101+
sed -i '/^spec:/i\ \ \ \ operatorframework.io/cluster-monitoring: "true"' ${f}
102+
fi
103+
done

deploy/olm-catalog/bundle/manifests/oadp-operator.v99.0.0.clusterserviceversion.yaml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ metadata:
1616
"namespace":"openshift-adp"
1717
},
1818
"spec": {
19-
"olmManaged": true,
2019
"backupStorageLocations": [
2120
{
2221
"config": {
@@ -163,6 +162,23 @@ metadata:
163162
support: Red Hat
164163
operatorframework.io/suggested-namespace: openshift-adp
165164
spec:
165+
relatedImages:
166+
- name: velero
167+
image: quay.io/konveyor/velero:latest
168+
- name: velero_restic_restore_helper
169+
image: quay.io/konveyor/velero-restic-restore-helper:latest
170+
- name: openshift_plugin
171+
image: quay.io/konveyor/openshift-velero-plugin:latest
172+
- name: aws_plugin
173+
image: quay.io/konveyor/velero-plugin-for-aws:latest
174+
- name: azure_plugin
175+
image: quay.io/konveyor/velero-plugin-for-microsoft-azure:latest
176+
- name: gcp_plugin
177+
image: quay.io/konveyor/velero-plugin-for-gcp:latest
178+
- name: csi_plugin
179+
image: quay.io/konveyor/velero-plugin-for-csi:latest
180+
- name: registry
181+
image: quay.io/konveyor/registry:latest
166182
apiservicedefinitions: {}
167183
displayName: OADP Operator
168184
description: OADP (OpenShift API for Data Protection) operator sets up and installs Velero on the OpenShift platform.
@@ -207,11 +223,11 @@ spec:
207223
- name: VELERO_REGISTRY_REPO
208224
value: registry
209225
- name: VELERO_REGISTRY_TAG
210-
value: oadp-0.3.0
226+
value: latest
211227
- name: VELERO_OPENSHIFT_PLUGIN_REPO
212228
value: openshift-velero-plugin
213229
- name: VELERO_OPENSHIFT_PLUGIN_TAG
214-
value: oadp-0.3.0
230+
value: latest
215231
- name: VELERO_RESTIC_RESTORE_HELPER_REPO
216232
value: velero-restic-restore-helper
217233
- name: VELERO_AWS_PLUGIN_REPO
@@ -222,20 +238,18 @@ spec:
222238
value: velero-plugin-for-microsoft-azure
223239
- name: VELERO_CSI_PLUGIN_REPO
224240
value: velero-plugin-for-csi
225-
- name: VELERO_VSPHERE_PLUGIN_REPO
226-
value: velero-plugin-for-vsphere
227241
- name: VELERO_TAG
228-
value: konveyor-1.7.0
242+
value: latest
229243
- name: VELERO_RESTIC_RESTORE_HELPER_TAG
230244
value: latest
231245
- name: VELERO_AWS_PLUGIN_TAG
232-
value: konveyor-1.3.0
246+
value: latest
233247
- name: VELERO_GCP_PLUGIN_TAG
234-
value: konveyor-1.3.0
248+
value: latest
235249
- name: VELERO_AZURE_PLUGIN_TAG
236-
value: konveyor-1.3.0
250+
value: latest
237251
- name: VELERO_CSI_PLUGIN_TAG
238-
value: konveyor-0.2.0
252+
value: latest
239253
args:
240254
- --leader-elect
241255
image: "quay.io/konveyor/oadp-operator:latest"

0 commit comments

Comments
 (0)