Repository navigation
Expand file tree
/
Copy pathbundle.sh
More file actions
executable file
·38 lines (30 loc) · 1.55 KB
/
Copy pathbundle.sh
File metadata and controls
executable file
·38 lines (30 loc) · 1.55 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
#!/bin/bash
REGISTRY=${REGISTRY:-quay.io/orc}
IMAGE=${BASE_IMAGE:-openstack-resource-controller}
TAG=${BASE_IMAGE:-$(git describe --abbrev=0 --tags)}
IMG=${REGISTRY}/${IMAGE}:${TAG}
# Update config/manifests/bases/orc.clusterserviceversion.yaml if needed
operator-sdk generate kustomize manifests -q --plugins=go.kubebuilder.io/v4
# Create an overlay for customizing the controller image
TMP_OVERLAY=config/manifests_overlay
mkdir "${TMP_OVERLAY}"
pushd "${TMP_OVERLAY}" || exit
kustomize create --resources ../manifests
kustomize edit set image controller="${IMG}"
kustomize edit add patch --kind ClusterServiceVersion --name "orc.*" --patch '[{"op": "replace", "path": "/spec/version", "value": "'$TAG'"}]'
kustomize edit add patch --kind ClusterServiceVersion --name "orc.*" --patch '[{"op": "replace", "path": "/metadata/name", "value": "orc.'$TAG'"}]'
popd || exit
# Generate bundle and bundle.Dockerfile
kustomize build "${TMP_OVERLAY}" | operator-sdk generate bundle --plugins=go.kubebuilder.io/v4 --use-image-digests
rm -rf "${TMP_OVERLAY}"
# Remove sample CRs from bundle/manifests/. They are already captured in the
# CSV's alm-examples annotation and should not be installed as standalone
# resources by OLM.
find bundle/manifests -name '*sample*' -delete
# Inject the operator logo into the generated CSV
LOGO_FILE="logos/orc-logo-color.svg"
CSV_FILE="bundle/manifests/orc.clusterserviceversion.yaml"
if [ -f "${LOGO_FILE}" ] && [ -f "${CSV_FILE}" ]; then
LOGO_BASE64=$(base64 -w0 "${LOGO_FILE}")
sed -i "s|__ORC_LOGO_BASE64__|${LOGO_BASE64}|" "${CSV_FILE}"
fi