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

[4.2] Introducing the global variable DRYRUN when the preview mode is enabled. #1383

Open
wants to merge 1 commit into
base: scripts-dev
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions cp3pt0-deployment/common/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ function create_namespace() {
title "Checking whether Namespace $namespace exist..."
if [[ -z "$(${OC} get namespace ${namespace} --ignore-not-found)" ]]; then
info "Creating namespace ${namespace}"
${OC} create namespace ${namespace}
${OC} ${DRY_RUN} create namespace ${namespace}
if [[ $? -ne 0 ]]; then
error "Error creating namespace ${namespace}"
fi
Expand Down Expand Up @@ -657,7 +657,7 @@ EOF
info "Creating following OperatorGroup:\n"
cat ${PREVIEW_DIR}/operatorgroup.yaml
echo ""
cat "${PREVIEW_DIR}/operatorgroup.yaml" | ${OC} apply -f -
cat "${PREVIEW_DIR}/operatorgroup.yaml" | ${OC} ${DRY_RUN} apply -f -
if [[ $? -ne 0 ]]; then
error "Failed to create OperatorGroup ${name} in ${ns}\n"
fi
Expand Down Expand Up @@ -688,7 +688,7 @@ EOF
info "Creating following Subscription:\n"
cat ${PREVIEW_DIR}/${name}-subscription.yaml
echo ""
cat ${PREVIEW_DIR}/${name}-subscription.yaml | ${OC} apply -f -
cat ${PREVIEW_DIR}/${name}-subscription.yaml | ${OC} ${DRY_RUN} apply -f -
if [[ $? -ne 0 ]]; then
error "Failed to create subscription ${name} in ${ns}\n"
fi
Expand Down Expand Up @@ -1315,6 +1315,6 @@ function is_supports_delegation() {
function prepare_preview_mode() {
mkdir -p ${PREVIEW_DIR}
if [[ $PREVIEW_MODE -eq 1 ]]; then
OC_CMD="oc --dry-run=client" # a redirect to the file is needed too
DRY_RUN="--dry-run=client" # a redirect to the file is needed too
fi
}
1 change: 1 addition & 0 deletions cp3pt0-deployment/migrate_tenant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ NEW_MAPPING=""
NEW_TENANT=0
DEBUG=0
PREVIEW_MODE=0
DRY_RUN=""
LICENSE_ACCEPT=0

# ---------- Command variables ----------
Expand Down
1 change: 1 addition & 0 deletions cp3pt0-deployment/setup_singleton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CERT_MANAGER_NAMESPACE="ibm-cert-manager"
LICENSING_NAMESPACE="ibm-licensing"
LICENSE_ACCEPT=0
PREVIEW_MODE=0
DRY_RUN=""
DEBUG=0

CUSTOMIZED_LICENSING_NAMESPACE=0
Expand Down
10 changes: 5 additions & 5 deletions cp3pt0-deployment/setup_tenant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SIZE_PROFILE=""
INSTALL_MODE="Automatic"
PREVIEW_MODE=0
ENABLE_PRIVATE_CATALOG=0
OC_CMD="oc"
DRY_RUN=""
DEBUG=0
LICENSE_ACCEPT=0
RETRY_CONFIG_CSCR=0
Expand Down Expand Up @@ -481,15 +481,15 @@ EOF
debug1 "Creating following Role:\n"
cat ${PREVIEW_DIR}/role.yaml | sed "s/ns_to_replace/$ns/g"
echo ""
cat ${PREVIEW_DIR}/role.yaml | sed "s/ns_to_replace/$ns/g" | ${OC_CMD} apply -f -
cat ${PREVIEW_DIR}/role.yaml | sed "s/ns_to_replace/$ns/g" | ${OC} ${DRY_RUN} apply -f -
if [[ $? -ne 0 ]]; then
error "Failed to create Role for NSS in namespace $ns, please check if user has proper permission to create role\n"
fi

debug1 "Creating following RoleBinding:\n"
cat ${PREVIEW_DIR}/rolebinding.yaml | sed "s/ns_to_replace/$ns/g"
echo ""
cat ${PREVIEW_DIR}/rolebinding.yaml | sed "s/ns_to_replace/$ns/g" | ${OC_CMD} apply -f -
cat ${PREVIEW_DIR}/rolebinding.yaml | sed "s/ns_to_replace/$ns/g" | ${OC} ${DRY_RUN} apply -f -
if [[ $? -ne 0 ]]; then
error "Failed to create RoleBinding for NSS in namespace $ns, please check if user has proper permission to create rolebinding\n"
fi
Expand Down Expand Up @@ -575,7 +575,7 @@ EOF

cat ${PREVIEW_DIR}/namespacescope.yaml
echo ""
cat "${PREVIEW_DIR}/namespacescope.yaml" | ${OC_CMD} apply -f -
cat "${PREVIEW_DIR}/namespacescope.yaml" | ${OC} ${DRY_RUN} apply -f -
}

function configure_cs_kind() {
Expand Down Expand Up @@ -608,7 +608,7 @@ EOF

while [ $retries -gt 0 ]; do

cat "${PREVIEW_DIR}/commonservice.yaml" | ${OC_CMD} apply -f -
cat "${PREVIEW_DIR}/commonservice.yaml" | ${OC} ${DRY_RUN} apply -f -

# Check if the patch was successful
if [[ $? -eq 0 ]]; then
Expand Down
Loading