Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local yq for bindata #1266

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading