From 5fcb281777fe024aa6406ec729478cf7c2e5e33c Mon Sep 17 00:00:00 2001 From: "gajan@jp.ibm.com" Date: Tue, 15 Dec 2020 01:25:05 +0000 Subject: [PATCH 1/2] Fixed demo magic scripts and make target --- Makefile | 18 +++++++++++++++--- demo/quick-start/demo.sh | 6 +++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8d1dd566..de6078c4 100644 --- a/Makefile +++ b/Makefile @@ -354,7 +354,11 @@ install-operator: @echo @echo setting image cp $(SHIELD_OP_DIR)config/manager/kustomization.yaml $(TMP_DIR)kustomization.yaml #copy original file to tmp dir. - cd $(SHIELD_OP_DIR)config/manager && kustomize edit set image controller=$(TEST_ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION) + @if [ -z "$(DEMO_ISHIELD_OP_IMAGE_NAME)" ]; then \ + cd $(SHIELD_OP_DIR)config/manager && kustomize edit set image controller=$(TEST_ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION); \ + else \ + cd $(SHIELD_OP_DIR)config/manager && kustomize edit set image controller=$(DEMO_ISHIELD_OP_IMAGE_NAME); \ + fi @echo installing operator kustomize build $(SHIELD_OP_DIR)config/default | kubectl apply --validate=false -f - cp $(TMP_DIR)kustomization.yaml $(SHIELD_OP_DIR)config/manager/kustomization.yaml #put back the original file from tmp dir. @@ -377,9 +381,17 @@ setup-tmp-cr: @echo copy cr into tmp dir cp $(SHIELD_OP_DIR)config/samples/apis_v1alpha1_integrityshield_local.yaml $(TMP_CR_FILE) @echo insert image - yq write -i $(TMP_CR_FILE) spec.logger.image $(TEST_ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION) + @if [ -z "$(DEMO_ISHIELD_LOGGING_IMAGE_NAME)" ]; then \ + yq write -i $(TMP_CR_FILE) spec.logger.image $(TEST_ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION); \ + else \ + yq write -i $(TMP_CR_FILE) spec.logger.image $(DEMO_ISHIELD_LOGGING_IMAGE_NAME); \ + fi yq write -i $(TMP_CR_FILE) spec.logger.imagePullPolicy Always - yq write -i $(TMP_CR_FILE) spec.server.image $(TEST_ISHIELD_SERVER_IMAGE_NAME_AND_VERSION) + @if [ -z "$(DEMO_ISHIELD_SERVER_IMAGE_NAME)" ]; then \ + yq write -i $(TMP_CR_FILE) spec.server.image $(TEST_ISHIELD_SERVER_IMAGE_NAME_AND_VERSION); \ + else \ + yq write -i $(TMP_CR_FILE) spec.server.image $(DEMO_ISHIELD_SERVER_IMAGE_NAME); \ + fi yq write -i $(TMP_CR_FILE) spec.server.imagePullPolicy Always @echo setup keyring configs yq write -i $(TMP_CR_FILE) spec.keyRingConfigs[1].name $(TEST_SECRET2) diff --git a/demo/quick-start/demo.sh b/demo/quick-start/demo.sh index 29b5639e..cf0f8e8b 100755 --- a/demo/quick-start/demo.sh +++ b/demo/quick-start/demo.sh @@ -73,17 +73,17 @@ echo NO_WAIT=true p "Now, we are ready to install IntegrityShield. Please enter." read -pe "make install-operator" +pe "make install-operator DEMO_ISHIELD_OP_IMAGE_NAME=${ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION}" echo echo "===== Integrtity Shield operator is being deployed in cluster. =====" echo echo "Then, we set up IntegrityShield custome resource (CR)." -make setup-tmp-cr +make setup-tmp-cr DEMO_ISHIELD_SERVER_IMAGE_NAME=${ISHIELD_SERVER_IMAGE_NAME_AND_VERSION} DEMO_ISHIELD_LOGGING_IMAGE_NAME=${ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION} echo echo "===== Integrity Shield CR is set up. =====" echo echo "After setting up Integrity Shield CR, Let's now deploy Integrity Shield CR in the cluster." -make create-cr +make create-tmp-cr echo echo "===== Integrity Shield CR is created in cluster. =====" echo From ba59cd107c386c929344ecfaff2a2650eed002d4 Mon Sep 17 00:00:00 2001 From: "gajan@jp.ibm.com" Date: Mon, 4 Jan 2021 04:41:41 +0000 Subject: [PATCH 2/2] fixed makefile to include a new target: setup-demo --- Makefile | 39 ++++++++++++++++++++++++--------------- demo/quick-start/demo.sh | 14 ++------------ 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index de6078c4..3e925a50 100644 --- a/Makefile +++ b/Makefile @@ -354,11 +354,7 @@ install-operator: @echo @echo setting image cp $(SHIELD_OP_DIR)config/manager/kustomization.yaml $(TMP_DIR)kustomization.yaml #copy original file to tmp dir. - @if [ -z "$(DEMO_ISHIELD_OP_IMAGE_NAME)" ]; then \ - cd $(SHIELD_OP_DIR)config/manager && kustomize edit set image controller=$(TEST_ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION); \ - else \ - cd $(SHIELD_OP_DIR)config/manager && kustomize edit set image controller=$(DEMO_ISHIELD_OP_IMAGE_NAME); \ - fi + cd $(SHIELD_OP_DIR)config/manager && kustomize edit set image controller=$(TEST_ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION) @echo installing operator kustomize build $(SHIELD_OP_DIR)config/default | kubectl apply --validate=false -f - cp $(TMP_DIR)kustomization.yaml $(SHIELD_OP_DIR)config/manager/kustomization.yaml #put back the original file from tmp dir. @@ -381,17 +377,9 @@ setup-tmp-cr: @echo copy cr into tmp dir cp $(SHIELD_OP_DIR)config/samples/apis_v1alpha1_integrityshield_local.yaml $(TMP_CR_FILE) @echo insert image - @if [ -z "$(DEMO_ISHIELD_LOGGING_IMAGE_NAME)" ]; then \ - yq write -i $(TMP_CR_FILE) spec.logger.image $(TEST_ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION); \ - else \ - yq write -i $(TMP_CR_FILE) spec.logger.image $(DEMO_ISHIELD_LOGGING_IMAGE_NAME); \ - fi + yq write -i $(TMP_CR_FILE) spec.logger.image $(TEST_ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION) yq write -i $(TMP_CR_FILE) spec.logger.imagePullPolicy Always - @if [ -z "$(DEMO_ISHIELD_SERVER_IMAGE_NAME)" ]; then \ - yq write -i $(TMP_CR_FILE) spec.server.image $(TEST_ISHIELD_SERVER_IMAGE_NAME_AND_VERSION); \ - else \ - yq write -i $(TMP_CR_FILE) spec.server.image $(DEMO_ISHIELD_SERVER_IMAGE_NAME); \ - fi + yq write -i $(TMP_CR_FILE) spec.server.image $(TEST_ISHIELD_SERVER_IMAGE_NAME_AND_VERSION) yq write -i $(TMP_CR_FILE) spec.server.imagePullPolicy Always @echo setup keyring configs yq write -i $(TMP_CR_FILE) spec.keyRingConfigs[1].name $(TEST_SECRET2) @@ -489,3 +477,24 @@ sonar-go-test-op: publish: $(ISHIELD_REPO_ROOT)/build/publish_images.sh $(ISHIELD_REPO_ROOT)/build/publish_bundle_ocm.sh + +setup-demo: + @echo + @echo setting image + cp $(SHIELD_OP_DIR)config/manager/kustomization.yaml $(TMP_DIR)kustomization.yaml #copy original file to tmp dir. + cd $(SHIELD_OP_DIR)config/manager && kustomize edit set image controller=$(DEMO_ISHIELD_OP_IMAGE_NAME) + @echo installing operator + kustomize build $(SHIELD_OP_DIR)config/default | kubectl apply --validate=false -f - + cp $(TMP_DIR)kustomization.yaml $(SHIELD_OP_DIR)config/manager/kustomization.yaml + @echo prepare cr + @echo copy cr into tmp dir + cp $(SHIELD_OP_DIR)config/samples/apis_v1alpha1_integrityshield_local.yaml $(TMP_CR_FILE) + @echo insert image + yq write -i $(TMP_CR_FILE) spec.logger.image $(DEMO_ISHIELD_LOGGING_IMAGE_NAME) + yq write -i $(TMP_CR_FILE) spec.logger.imagePullPolicy Always + yq write -i $(TMP_CR_FILE) spec.server.image $(DEMO_ISHIELD_SERVER_IMAGE_NAME) + yq write -i $(TMP_CR_FILE) spec.server.imagePullPolicy Always + @echo setup keyring configs + yq write -i $(TMP_CR_FILE) spec.keyRingConfigs[1].name $(TEST_SECRET2) + @echo setup signer policy + kubectl apply -f $(TMP_CR_FILE) -n $(ISHIELD_OP_NS) diff --git a/demo/quick-start/demo.sh b/demo/quick-start/demo.sh index cf0f8e8b..73f9a89c 100755 --- a/demo/quick-start/demo.sh +++ b/demo/quick-start/demo.sh @@ -73,19 +73,9 @@ echo NO_WAIT=true p "Now, we are ready to install IntegrityShield. Please enter." read -pe "make install-operator DEMO_ISHIELD_OP_IMAGE_NAME=${ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION}" +pe "make setup-demo DEMO_ISHIELD_OP_IMAGE_NAME=${ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION} DEMO_ISHIELD_SERVER_IMAGE_NAME=${ISHIELD_SERVER_IMAGE_NAME_AND_VERSION} DEMO_ISHIELD_LOGGING_IMAGE_NAME=${ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION}" echo -echo "===== Integrtity Shield operator is being deployed in cluster. =====" -echo -echo "Then, we set up IntegrityShield custome resource (CR)." -make setup-tmp-cr DEMO_ISHIELD_SERVER_IMAGE_NAME=${ISHIELD_SERVER_IMAGE_NAME_AND_VERSION} DEMO_ISHIELD_LOGGING_IMAGE_NAME=${ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION} -echo -echo "===== Integrity Shield CR is set up. =====" -echo -echo "After setting up Integrity Shield CR, Let's now deploy Integrity Shield CR in the cluster." -make create-tmp-cr -echo -echo "===== Integrity Shield CR is created in cluster. =====" +echo "===== Integrtity Shield operator is being deployed and IntegrityShield custome resource (CR) is created in cluster. =====" echo NO_WAIT=false