-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathcreate-samba-bundle
More file actions
executable file
·72 lines (57 loc) · 1.77 KB
/
Copy pathcreate-samba-bundle
File metadata and controls
executable file
·72 lines (57 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
# A hackish script to build bundle and index images for given driver + operator images.
# The output is available in opm-bundle directory.
set -o errexit
set -o nounset
set -o pipefail
if [ "$#" -ne "4" ]; then
echo "Usage: $0 <input_driver_image> <input_operator_image> <output_bundle_image> <output_index_image>"
exit 1
fi
DEFAULT_TOOL_BIN=$(which podman 2>/dev/null || which docker 2>/dev/null)
if [ "$? " -ne "0" ]; then
echo "Error: No suitable container manipulation tool (podman, docker) found in \$PATH" 1>&2
exit 1
fi
TOOL_BIN=${TOOL_BIN:-$DEFAULT_TOOL_BIN}
TOOL_NAME=$(basename $TOOL_BIN)
DRIVER_IMAGE=$1
OPERATOR_IMAGE=$2
BUNDLE_IMAGE=$3
INDEX_IMAGE=$4
# Prepare output dir
mkdir -p opm-bundle
pushd opm-bundle
cp -r -v ../../config/samba/* .
MANIFEST=manifests/stable/smb-csi-driver-operator.clusterserviceversion.yaml
# Replace images in the manifest - error prone, needs to be in sync with image-references.
sed -i.bak -e "s~quay.io/openshift/origin-smb-csi-driver-operator:latest~$OPERATOR_IMAGE~" \
-e "s~quay.io/openshift/origin-csi-driver-smb:latest~$DRIVER_IMAGE~" \
$MANIFEST
rm $MANIFEST.bak
# Build the bundle and push it
$TOOL_BIN build -t $BUNDLE_IMAGE -f bundle.Dockerfile .
$TOOL_BIN push $BUNDLE_IMAGE
# Build the index image and push it
opm index add --bundles $BUNDLE_IMAGE --tag $INDEX_IMAGE --container-tool $TOOL_NAME
$TOOL_BIN push $INDEX_IMAGE
echo
echo --------------------
echo "Index image created"
echo "Copy following snipped to apply it to your cluster"
echo
# Show oc apply -f - <<EOF to copy-paste into shell
cat <<REAL_EOF
oc apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: smb
namespace: openshift-marketplace
spec:
sourceType: grpc
image: $INDEX_IMAGE
EOF
REAL_EOF
echo
popd