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

🐛 move patch routine to copy crd #261

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
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ $(call build-image,registration-operator,$(OPERATOR_IMAGE_NAME),./build/Dockerfi
$(call build-image,addon-manager,$(ADDON_MANAGER_IMAGE),./build/Dockerfile.addon,.)

copy-crd:
bash -x hack/copy-crds.sh
bash -x hack/copy-crds.sh $(YAML_PATCH)

patch-crd: ensure-yaml-patch
bash hack/patch/patch-crd.sh $(YAML_PATCH)

update: patch-crd copy-crd update-csv
update: copy-crd update-csv

update-csv: ensure-operator-sdk
cd deploy/cluster-manager && ../../$(OPERATOR_SDK) generate bundle --manifests --deploy-dir config/ --crds-dir config/crds/ --output-dir olm-catalog/cluster-manager/ --version $(CSV_VERSION)
Expand All @@ -64,7 +61,7 @@ update-csv: ensure-operator-sdk
rm ./deploy/cluster-manager/olm-catalog/cluster-manager/manifests/cluster-manager_v1_serviceaccount.yaml
rm ./deploy/klusterlet/olm-catalog/klusterlet/manifests/klusterlet_v1_serviceaccount.yaml

verify-crds: patch-crd
verify-crds:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems need to pass parameter $(YAML_PATCH) to hack/verify-crds.sh

bash -x hack/verify-crds.sh

verify-gocilint:
Expand Down
6 changes: 4 additions & 2 deletions hack/copy-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

source "$(dirname "${BASH_SOURCE}")/init.sh"

BASE_DIR=$(dirname $(readlink -f $0))

for f in $HUB_CRD_FILES
do
if [ -f "$PATCHED_DIR/$(basename $f)" ]
if [ -f "$BASE_DIR/$(basename $f).yaml-patch" ];
then
cp $PATCHED_DIR/$(basename $f) ./manifests/cluster-manager/hub/
$1 -o $BASE_DIR/$(basename $f).yaml-patch < $f > ./manifests/cluster-manager/hub/$(basename $f)
else
cp $f ./manifests/cluster-manager/hub/
fi
Expand Down
29 changes: 0 additions & 29 deletions hack/patch/patch-crd.sh

This file was deleted.

8 changes: 6 additions & 2 deletions hack/verify-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

source "$(dirname "${BASH_SOURCE}")/init.sh"

BASE_DIR=$(dirname $(readlink -f $0))

for f in $HUB_CRD_FILES
do
if [ -f "$PATCHED_DIR/$(basename $f)" ]
if [ -f "$BASE_DIR/$(basename $f).yaml-patch" ];
then
diff -N $PATCHED_DIR/$(basename $f) ./manifests/cluster-manager/hub/$(basename $f) || ( echo 'crd content is incorrect' && false )
$1 -o $BASE_DIR/$(basename $f).yaml-patch < $f > ./manifests/cluster-manager/hub/$(basename $f).tmp
diff -N ./manifests/cluster-manager/hub/$(basename $f).tmp ./manifests/cluster-manager/hub/$(basename $f) || ( echo 'crd content is incorrect' && false )
rm ./manifests/cluster-manager/hub/$(basename $f).tmp
else
diff -N $f ./manifests/cluster-manager/hub/$(basename $f) || ( echo 'crd content is incorrect' && false )
fi
Expand Down
Loading