Skip to content

Commit 4b381f5

Browse files
Merge pull request #1266 from dprince/bindata_fix
Use local yq for bindata
2 parents 7705657 + a1e78ea commit 4b381f5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
146146
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
147147

148148
.PHONY: bindata
149-
bindata: kustomize yq ## Build docker image with the manager.
149+
bindata: export LOCAL_BINARIES=$(LOCALBIN)
150+
bindata: kustomize yq ## Call sync bindata script
150151
mkdir -p bindata/crds bindata/rbac bindata/operator
151152
$(KUSTOMIZE) build config/crd > bindata/crds/crds.yaml
152153
$(KUSTOMIZE) build config/default > bindata/operator/operator.yaml

hack/sync-bindata.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set -ex
77

88
OUT_DATA=bindata
99
EXTRACT_DIR=tmp/bindata
10+
LOCAL_BINARIES=${LOCAL_BINARIES:?}
1011

1112
mkdir -p "$EXTRACT_DIR"
1213
mkdir -p "$OUT_DATA/crds"
@@ -25,7 +26,7 @@ local CSV_FILENAME=$1
2526
local OPERATOR_NAME=$2
2627
local TYPE=$3
2728

28-
cat $CSV_FILENAME | yq -r ".spec.webhookdefinitions.[] | select(.type == \"$TYPE\")" | \
29+
cat $CSV_FILENAME | $LOCAL_BINARIES/yq -r ".spec.webhookdefinitions.[] | select(.type == \"$TYPE\")" | \
2930
sed -e '/^containerPort:/d' | \
3031
sed -e '/^deploymentName:/d' | \
3132
sed -e '/^targetPort:/d' | \
@@ -152,9 +153,9 @@ grep -l CustomResourceDefinition manifests/* | xargs -I % sh -c 'cp % ./crds/'
152153
for X in $(ls manifests/*clusterserviceversion.yaml); do
153154
OPERATOR_NAME=$(echo $X | sed -e "s|manifests\/\([^\.]*\)\..*|\1|")
154155
echo $OPERATOR_NAME
155-
LEADER_ELECTION_ROLE_RULES=$(cat $X | yq -r .spec.install.spec.permissions | sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d'
156+
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'
156157
)
157-
CLUSTER_ROLE_RULES=$(cat $X | yq -r .spec.install.spec.clusterPermissions| sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d'
158+
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'
158159
)
159160

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

0 commit comments

Comments
 (0)