Skip to content

Commit

Permalink
Merge pull request #1266 from dprince/bindata_fix
Browse files Browse the repository at this point in the history
Use local yq for bindata
  • Loading branch information
openshift-merge-bot[bot] authored Jan 15, 2025
2 parents 7705657 + a1e78ea commit 4b381f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: bindata
bindata: kustomize yq ## Build docker image with the manager.
bindata: export LOCAL_BINARIES=$(LOCALBIN)
bindata: kustomize yq ## Call sync bindata script
mkdir -p bindata/crds bindata/rbac bindata/operator
$(KUSTOMIZE) build config/crd > bindata/crds/crds.yaml
$(KUSTOMIZE) build config/default > bindata/operator/operator.yaml
Expand Down
11 changes: 6 additions & 5 deletions hack/sync-bindata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -ex

OUT_DATA=bindata
EXTRACT_DIR=tmp/bindata
LOCAL_BINARIES=${LOCAL_BINARIES:?}

mkdir -p "$EXTRACT_DIR"
mkdir -p "$OUT_DATA/crds"
Expand All @@ -25,7 +26,7 @@ local CSV_FILENAME=$1
local OPERATOR_NAME=$2
local TYPE=$3

cat $CSV_FILENAME | yq -r ".spec.webhookdefinitions.[] | select(.type == \"$TYPE\")" | \
cat $CSV_FILENAME | $LOCAL_BINARIES/yq -r ".spec.webhookdefinitions.[] | select(.type == \"$TYPE\")" | \
sed -e '/^containerPort:/d' | \
sed -e '/^deploymentName:/d' | \
sed -e '/^targetPort:/d' | \
Expand Down Expand Up @@ -152,9 +153,9 @@ grep -l CustomResourceDefinition manifests/* | xargs -I % sh -c 'cp % ./crds/'
for X in $(ls manifests/*clusterserviceversion.yaml); do
OPERATOR_NAME=$(echo $X | sed -e "s|manifests\/\([^\.]*\)\..*|\1|")
echo $OPERATOR_NAME
LEADER_ELECTION_ROLE_RULES=$(cat $X | yq -r .spec.install.spec.permissions | sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d'
LEADER_ELECTION_ROLE_RULES=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.permissions | sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d'
)
CLUSTER_ROLE_RULES=$(cat $X | yq -r .spec.install.spec.clusterPermissions| sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d'
CLUSTER_ROLE_RULES=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.clusterPermissions| sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d'
)

if [[ "$OPERATOR_NAME" == "infra-operator" ]]; then
Expand Down Expand Up @@ -271,9 +272,9 @@ for X in $(ls manifests/*clusterserviceversion.yaml); do
OPERATOR_NAME=$(echo $X | sed -e "s|manifests\/\([^\.]*\)\..*|\1|" | sed -e "s|-|_|g" | tr '[:lower:]' '[:upper:]' )
echo $OPERATOR_NAME
if [[ $OPERATOR_NAME == "RABBITMQ_CLUSTER_OPERATOR" ]]; then
IMAGE=$(cat $X | yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[0].image)
IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[0].image)
else
IMAGE=$(cat $X | yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[1].image)
IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[1].image)
fi
echo $IMAGE

Expand Down

0 comments on commit 4b381f5

Please sign in to comment.