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

[minor] User defined DRO namespace #1024

Merged
merged 5 commits into from
Jun 14, 2024
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
11 changes: 10 additions & 1 deletion image/cli/mascli/functions/install
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function install_noninteractive() {

WAIT_FOR_PVCS=true
STORAGE_CLASS_PROVIDER=custom

while [[ $# -gt 0 ]]
do
key="$1"
Expand Down Expand Up @@ -339,6 +338,10 @@ function install_noninteractive() {
--uds-lastname)
export UDS_CONTACT_LASTNAME=$1 && shift
;;
# DRO
--dro-namespace)
export DRO_NAMESPACE=$1 && shift
;;

# MongoDB
--mongodb-namespace)
Expand Down Expand Up @@ -776,6 +779,12 @@ function install() {
# DRO is installed by default on latest catalog version, for catalogs older than 240227 install UDS
uds_action_selection

# Select DRO Namespace
if [[ "$INTERACTIVE_MODE" == "true" ]] && [[ "$UDS_ACTION" == "install-dro" ]]; then
prompt_for_input "Provide DRO Namespace [Default:'redhat-marketplace']" DRO_NAMESPACE "redhat-marketplace"
echo_highlight "DRO is configured to install in ${DRO_NAMESPACE} namespace"
fi

# Prepare and launch the Tekton pipeline
install_pipelinerun_prepare
install_pipelinerun_preview
Expand Down
11 changes: 10 additions & 1 deletion image/cli/mascli/functions/update
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Update Dependencies (Optional):
--dro-migration ${COLOR_YELLOW}DRO_MIGRATION${TEXT_RESET} Confirm the removal of UDS and replacement with DRO as part of the update
--cp4d-version ${COLOR_YELLOW}CP4D_VERSION${TEXT_RESET} Optional. Set Cloud Pak for Data version for the upgrade. Note: This overrides the default CP4D version defined by the Maximo Operator Catalog version.
--dro-storage-class ${COLOR_YELLOW}DRO_STORAGE_CLASS${TEXT_RESET} Set Custom RWO Storage Class name for DRO as part of the update
--dro-namespace ${COLOR_YELLOW}DRO_NAMESPACE${TEXT_RESET} Set Custom Namespace for DRO(Default: redhat-marketplace)
Other Commands:
--skip-pre-check Skips the 'pre-update-check' and 'post-update-verify' tasks in the update pipeline
--no-confirm Launch the update without prompting for confirmation
Expand Down Expand Up @@ -176,6 +177,10 @@ function validate_dro_migration() {
DRO_STORAGE_CLASS=""
echo "No storage class selected for DRO"
fi
if [[ "$NO_CONFIRM" != "true" ]] && [[ -z "${DRO_NAMESPACE}" ]]; then
prompt_for_input "Provide DRO Namespace [Default:'redhat-marketplace']" DRO_NAMESPACE "redhat-marketplace"
echo_highlight "DRO is configured to install in ${DRO_NAMESPACE} namespace"
fi

## Check all avaliable Suite Instance's versions, if any of them is 8.9.x cancel the update. Exit mas update throw error.
for suite_namespace in $(oc get Suite --all-namespaces --ignore-not-found -o jsonpath='{.items[*].metadata.namespace}'); do
Expand Down Expand Up @@ -210,7 +215,6 @@ function validate_dro_migration() {
else
DRO_MIGRATION="false"
echo -e "${COLOR_YELLOW}UDS does not exist, skipping DRO migration and proceeding with mas update"
DRO_NAMESPACE="redhat-marketplace"
DRO_CSV=$(oc get csv -n "${DRO_NAMESPACE}" | grep ibm-data-reporter-operator | awk '{print $1}')
echo $DRO_CSV
if [[ -n $DRO_CSV ]]; then
Expand Down Expand Up @@ -604,6 +608,9 @@ function update_noninteractive() {
--dro-migration)
DRO_MIGRATION=true
;;
--dro-namespace)
DRO_NAMESPACE=$1 && shift
;;
--dro-storage-class)
DRO_STORAGE_CLASS=$1 && shift
;;
Expand Down Expand Up @@ -739,6 +746,7 @@ function update() {
export SKIP_ENTITLEMENT_KEY_FLAG
export DRO_STORAGE_CLASS
export UDS_ACTION
export DRO_NAMESPACE

reset_colors
echo_h2 "Review Settings"
Expand Down Expand Up @@ -868,6 +876,7 @@ function update() {
if [ "$DRO_MIGRATION" = "true" ]; then
echo_reset_dim "UDS to DRO ................................. ${COLOR_GREEN}Yes"
echo_reset_dim " - DRO Storage Class ....................... ${COLOR_GREEN}${DRO_STORAGE_CLASS}"
echo_reset_dim " - DRO Namespace ........................... ${COLOR_GREEN}${DRO_NAMESPACE}"
else
echo_reset_dim "UDS to DRO ................................. ${COLOR_RED}Not Required"
fi
Expand Down
3 changes: 2 additions & 1 deletion image/cli/mascli/templates/pipelinerun-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ spec:
value: '$UDS_CONTACT_LASTNAME'
- name: uds_action
value: '$UDS_ACTION'

- name: dro_namespace
value: '$DRO_NAMESPACE'
# Dependencies - AppConnect
# -------------------------------------------------------------------------
- name: appconnect_entitlement_username
Expand Down
2 changes: 2 additions & 0 deletions image/cli/mascli/templates/pipelinerun-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ spec:
value: '$DRO_STORAGE_CLASS'
- name: uds_action
value: '$UDS_ACTION'
- name: dro_namespace
value: '$DRO_NAMESPACE'
- name: grafana_v5_upgrade
value: '$GRAFANA_V5_UPGRADE'

Expand Down
3 changes: 3 additions & 0 deletions tekton/src/params/install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@
- name: uds_action
type: string
default: ""
- name: dro_namespace
type: string
default: ""
- name: mas_segment_key
type: string
default: ""
Expand Down
2 changes: 2 additions & 0 deletions tekton/src/pipelines/taskdefs/dependencies/uds.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
# Only used by DRO
- name: ibm_entitlement_key
value: $(params.ibm_entitlement_key)
- name: DRO_NAMESPACE
value: $(params.dro_namespace)
when:
- input: "$(params.uds_action)"
operator: in
Expand Down
5 changes: 5 additions & 0 deletions tekton/src/pipelines/update.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ spec:
default: "install-dro"
type: string
description: set UDS_ACTION, default is install-dro'
- name: dro_namespace
default: "redhat-marketplace"
type: string

# grafana operator update
- name: grafana_v5_upgrade
Expand Down Expand Up @@ -378,6 +381,8 @@ spec:
value: $(params.uds_storage_class)
- name: uds_action
value: $(params.uds_action)
- name: DRO_NAMESPACE
value: $(params.dro_namespace)
- name: devops_suite_name
value: update-uds
{% if wait_for_install == true %}
Expand Down
5 changes: 5 additions & 0 deletions tekton/src/tasks/dependencies/uds.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ spec:
- name: ibm_entitlement_key
type: string
default: ""
- name: dro_namespace
type: string
default: "redhat-marketplace"

# Used by UDS & DRO
- name: uds_contact_email
Expand Down Expand Up @@ -144,6 +147,8 @@ spec:
value: $(params.dro_migration)
- name: DRO_STORAGE_CLASS
value: $(params.uds_storage_class)
- name: DRO_NAMESPACE
value: $(params.dro_namespace)
workspaces:
- name: configs
optional: true
Expand Down
Loading