-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework custom-bundle.Dockerfile to use staged data
This reworks custom-bundle.Dockerfile so that it involves less stages and can support 2 distinct steps: sync time and build time. This will more cleanly align to our downstream build needs At sync time a bundle_extra_data directory is populated with ENV variables from all operators (required for webhooks). Additionally dataplane-operator CRDs are cached in this repo. At build time the custom-bundle.Dockerfile pulls from bundle_extra_data directly. The csv-merger is used at 'sync time' to extract ENV variables and again at 'build time' to merge those ENV variables along with the dataplane-operators into the combined openstack operator CSV. Jira: OSP-29916
- Loading branch information
Showing
7 changed files
with
95 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export USE_IMAGE_DIGESTS=true | ||
export BUNDLE_DOCKERFILE=custom-bundle.Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
|
||
# extract select data from bundles: | ||
# -env vars from all service operators | ||
# -dataplane-operator bundle is cached (in order to merge at build time) | ||
set -ex | ||
|
||
function extract_bundle { | ||
local IN_DIR=$1 | ||
local OUT_DIR=$2 | ||
for X in $(file ${IN_DIR}/* | grep gzip | cut -f 1 -d ':'); do | ||
tar xvf $X -C ${OUT_DIR}/; | ||
done | ||
} | ||
|
||
function extract_csv { | ||
local IN_DIR=$1 | ||
local OUT_DIR=$2 | ||
for X in $(file ${IN_DIR}/* | grep gzip | cut -f 1 -d ':'); do | ||
tar xvf $X -C ${OUT_DIR} --wildcards --no-anchor '**/*clusterserviceversion.yaml' | ||
done | ||
} | ||
|
||
OUT_BUNDLE=bundle_extra_data | ||
EXTRACT_DIR=tmp/bundle_extract | ||
|
||
mkdir -p "$EXTRACT_DIR" | ||
mkdir -p "$EXTRACT_DIR/csvs" | ||
mkdir -p "$OUT_BUNDLE" | ||
|
||
for BUNDLE in $(hack/pin-bundle-images.sh | tr "," " "); do | ||
skopeo copy "docker://$BUNDLE" dir:${EXTRACT_DIR}/tmp; | ||
if echo $BUNDLE | grep dataplane-operator &> /dev/null; then | ||
extract_bundle "${EXTRACT_DIR}/tmp" "${OUT_BUNDLE}/" | ||
else | ||
extract_csv "${EXTRACT_DIR}/tmp" "${EXTRACT_DIR}/csvs" | ||
fi | ||
done | ||
|
||
# Extract the ENV vars from all the CSVs | ||
CSV_DIR="${EXTRACT_DIR}/csvs/manifests" | ||
bin/csv-merger \ | ||
--export-env-file=$OUT_BUNDLE/env-vars.yaml \ | ||
--mariadb-csv=$CSV_DIR/mariadb-operator.clusterserviceversion.yaml \ | ||
--infra-csv=$CSV_DIR/infra-operator.clusterserviceversion.yaml \ | ||
--keystone-csv=$CSV_DIR/keystone-operator.clusterserviceversion.yaml \ | ||
--placement-csv=$CSV_DIR/placement-operator.clusterserviceversion.yaml \ | ||
--ovn-csv=$CSV_DIR/ovn-operator.clusterserviceversion.yaml \ | ||
--neutron-csv=$CSV_DIR/neutron-operator.clusterserviceversion.yaml \ | ||
--ansibleee-csv=$CSV_DIR/openstack-ansibleee-operator.clusterserviceversion.yaml \ | ||
--nova-csv=$CSV_DIR/nova-operator.clusterserviceversion.yaml \ | ||
--heat-csv=$CSV_DIR/heat-operator.clusterserviceversion.yaml \ | ||
--ironic-csv=$CSV_DIR/ironic-operator.clusterserviceversion.yaml \ | ||
--baremetal-csv=$CSV_DIR/openstack-baremetal-operator.clusterserviceversion.yaml \ | ||
--horizon-csv=$CSV_DIR/horizon-operator.clusterserviceversion.yaml \ | ||
--telemetry-csv=$CSV_DIR/telemetry-operator.clusterserviceversion.yaml \ | ||
--glance-csv=$CSV_DIR/glance-operator.clusterserviceversion.yaml \ | ||
--cinder-csv=$CSV_DIR/cinder-operator.clusterserviceversion.yaml \ | ||
--manila-csv=$CSV_DIR/manila-operator.clusterserviceversion.yaml \ | ||
--swift-csv=$CSV_DIR/swift-operator.clusterserviceversion.yaml \ | ||
--octavia-csv=$CSV_DIR/octavia-operator.clusterserviceversion.yaml \ | ||
--designate-csv=$CSV_DIR/designate-operator.clusterserviceversion.yaml \ | ||
--barbican-csv=$CSV_DIR/barbican-operator.clusterserviceversion.yaml \ | ||
--base-csv=config/manifests/bases/openstack-operator.clusterserviceversion.yaml | tee "$EXTRACT_DIR/out.yaml" | ||
|
||
# cleanup our temporary dir used for extraction | ||
rm -Rf "$EXTRACT_DIR" | ||
|
||
# we only keep manifests from extracted (merged) bundles | ||
rm -Rf "$OUT_BUNDLE/metadata" | ||
rm -Rf "$OUT_BUNDLE/tests" |