Skip to content

Conversation

@amitpandey0217
Copy link
Contributor

@amitpandey0217 amitpandey0217 commented Oct 15, 2025

This changes include to automate rds instance creations using gitops
https://jsw.ibm.com/browse/MASCORE-10165

@amitpandey0217 amitpandey0217 requested a review from a team as a code owner October 15, 2025 15:53
--secrets-key-seperator ${COLOR_YELLOW}SECRETS_KEY_SEPERATOR${TEXT_RESET} Secrets Manager key seperator string

IBM DB2RDS:
--db2_namespace ${COLOR_YELLOW}DB2_RDS_NAMESPACE${TEXT_RESET} db2rds namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

should we just use default value instead of parameterising it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DOne

Comment on lines 237 to 241
#adding default values # -- db2rds Defaults
export DB2_NAMESPACE=${DB2_NAMESPACE}
export DB2_INSTANCE_NAME=${DB2_INSTANCE_NAME}
export MAS_APP_ID=${MAS_APP_ID}
export RDS_ADMIN_DB_NAME=${RDS_ADMIN_DB_NAME}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not required as you are already setting the values above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 28 to 32
--host ${COLOR_YELLOW}DB2_CHANNEL${TEXT_RESET} db2rds host
--port ${COLOR_YELLOW}DB2_CHANNEL${TEXT_RESET} db2rds port
--dbname ${COLOR_YELLOW}DB2_CHANNEL${TEXT_RESET} db2rds dbname
--user ${COLOR_YELLOW}DB2_CHANNEL${TEXT_RESET} db2rds user
--password ${COLOR_YELLOW}DB2_CHANNEL${TEXT_RESET} db2rds password
Copy link
Contributor

Choose a reason for hiding this comment

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

The env vars here needs to be updated. All are referring to DB2_CHANNEL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DOne

# TODO: will need to add explicit args to pipeline when we start using this code to deploy to MCSP
export REGION=${REGION:-${SM_AWS_REGION}}

export DB2_INSTALL_PLAN=${DB2_INSTALL_PLAN:-"Automatic"}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not required for RDS right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

# Define cluster-level secrets used
# ---------------------------------------------------------------------------
# Note that this cluster-level secret is set up by gitops-cluster
SECRETS_PREFIX="${ACCOUNT_ID}${SECRETS_KEY_SEPARATOR}${CLUSTER_ID}-${MAS_INSTANCE_ID}${SECRETS_KEY_SEPARATOR}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use ${SECRETS_KEY_SEPARATOR} instead of - after ${CLUSTER_ID} to maintain consistency?

Copy link
Contributor Author

@amitpandey0217 amitpandey0217 Oct 16, 2025

Choose a reason for hiding this comment

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

we cant use SECRETS_KEY_SEPARATOR as SECRETS_KEY_SEPARATOR is defined as "/"

Copy link
Member

Choose a reason for hiding this comment

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

@amitpandey0217 it should be a slash shouldn't it? the expected secrets path would be aws-dev/cluster1/instance1/ and not aws-dev/cluster1-instance1/

Comment on lines 248 to 252
export HOST=${SECRETS_PREFIX}rds-db2-endpoint-config-GiAgxQ#db2_endpoint
export PORT=${SECRETS_PREFIX}rds-db2-endpoint-config-GiAgxQ#db2_port
export DBNAME=${SECRETS_PREFIX}rds-db2-endpoint-config-GiAgxQ#db2_name
export USER=${SECRETS_PREFIX}rds-db2-endpoint-config-GiAgxQ#username
export PASSWORD=${SECRETS_PREFIX}rds-db2-endpoint-config-GiAgxQ#password
Copy link
Contributor

Choose a reason for hiding this comment

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

"-GiAgxQ" needs to be removed from the secret name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

# ---------------------------------------------------------------------------
ROOT_APP_NAME="root.${ACCOUNT_ID}"
CLUSTER_APP_NAME="cluster.${CLUSTER_ID}"
DB2RDS_APP_NAME="DB2RDS.${CLUSTER_ID}.${MAS_INSTANCE_ID}"
Copy link
Contributor

Choose a reason for hiding this comment

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

App naming convention to be matched with argo app mentioned in gitops

echo_h2 "Generating DB2RDS operator Applications"
echo "- DB2RDS operator"

export IBM_ENTITLEMENT_KEY=$SECRET_KEY_IBM_ENTITLEMENT
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is not required as it is not used for rds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

# Define cluster-level secrets used
# ---------------------------------------------------------------------------
# Note that this cluster-level secret is set up by gitops-cluster
SECRETS_PREFIX="${ACCOUNT_ID}${SECRETS_KEY_SEPARATOR}${CLUSTER_ID}-${MAS_INSTANCE_ID}${SECRETS_KEY_SEPARATOR}"
Copy link
Member

Choose a reason for hiding this comment

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

@amitpandey0217 it should be a slash shouldn't it? the expected secrets path would be aws-dev/cluster1/instance1/ and not aws-dev/cluster1-instance1/

Comment on lines 24 to 26
--db2_instance_name ${COLOR_YELLOW}DB2_INSTANCE_NAME${TEXT_RESET} db2rds instance name
--MAS_APP_ID ${COLOR_YELLOW}MAS_APP_ID${TEXT_RESET} db2rds mas application id
--rds_admin_db_name ${COLOR_YELLOW}RDS_ADMIN_DB_NAME{TEXT_RESET} db2rds admin db name
Copy link
Member

Choose a reason for hiding this comment

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

these need fixing. The params use - rather than _ and MAS_APP_ID should be lowercase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done also update the secrets path which you provided under above comment

Copy link
Member

Choose a reason for hiding this comment

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

This still looks incorrect. it should be --db2-instance-name etc

Comment on lines 62 to 65
-g|--gitops-version)
echo "${COLOR_YELLOW}WARNING: the -g|--gitops-version parameter is deprecated; it has no effect and will be removed in a future release${COLOR_RESET}"
shift
;;
Copy link
Member

Choose a reason for hiding this comment

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

i don't think this is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

[[ -z "$GITHUB_ORG" ]] && gitops_db2rds_help "GITHUB_ORG is not set"
[[ -z "$GITHUB_REPO" ]] && gitops_db2rds_help "GITHUB_REPO is not set"
[[ -z "$GIT_BRANCH" ]] && gitops_db2rds_help "GIT_BRANCH is not set"
fi
Copy link
Member

Choose a reason for hiding this comment

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

the checks for db2 related vars shouldn't be under if [[ "$GITHUB_PUSH" == "true" ]]; then

echo_reset_dim "Region ................................ ${COLOR_MAGENTA}${REGION}"
echo_reset_dim "Cluster ID ............................ ${COLOR_MAGENTA}${CLUSTER_ID}"
echo_reset_dim "MAS Instance ID ....................... ${COLOR_MAGENTA}${MAS_INSTANCE_ID}"
echo_reset_dim "DB2RDS Namespace ........................ ${COLOR_MAGENTA}${DB2_NAMESPACE}"
Copy link
Member

Choose a reason for hiding this comment

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

fix formtting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

echo_reset_dim "DB2RDS Namespace ........................ ${COLOR_MAGENTA}${DB2_NAMESPACE}"
echo_reset_dim "Instance Config Directory ............. ${COLOR_MAGENTA}${GITOPS_INSTANCE_DIR}"
reset_colors

Copy link
Member

Choose a reason for hiding this comment

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

there is no echoed output for the db2 params

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

Copy link
Member

Choose a reason for hiding this comment

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

the password should be snipped

Comment on lines 244 to 246
echo_h2 "DB2RDS Operator" " "
echo_reset_dim "DB2_NAMESPACE .......................... ${COLOR_MAGENTA}${DB2_NAMESPACE}"
reset_colors
Copy link
Member

Choose a reason for hiding this comment

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

what is the db2 rds operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed as its not needed

Comment on lines +7 to +11
host: <path:{{ SECRETS_PATH }}:{{ HOST }}>
port: <path:{{ SECRETS_PATH }}:{{ PORT }}>
dbname: <path:{{ SECRETS_PATH }}:{{ DBNAME }}>
user: <path:{{ SECRETS_PATH }}:{{ USER }}>
password: <path:{{ SECRETS_PATH }}:{{ PASSWORD }}>
Copy link
Member

Choose a reason for hiding this comment

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

what is putting the secrets into these locations in secrets manager?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mas-aws-build repo will be populating that information .

Copy link
Member

Choose a reason for hiding this comment

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

I believe the funciton should add it if these details are passed into the function. Then all cases the function should be verifying that the secrets exist.

Copy link
Member

@whitfiea whitfiea left a comment

Choose a reason for hiding this comment

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

The PR title and description needs more details. From the code it seems this might not have been tested so we need to know what testing has been done and where the tekton changes are

Comment on lines 24 to 26
--db2_instance_name ${COLOR_YELLOW}DB2_INSTANCE_NAME${TEXT_RESET} db2rds instance name
--MAS_APP_ID ${COLOR_YELLOW}MAS_APP_ID${TEXT_RESET} db2rds mas application id
--rds_admin_db_name ${COLOR_YELLOW}RDS_ADMIN_DB_NAME{TEXT_RESET} db2rds admin db name
Copy link
Member

Choose a reason for hiding this comment

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

This still looks incorrect. it should be --db2-instance-name etc

--db2_instance_name)
export DB2_INSTANCE_NAME=$1 && shift
;;
--MAS_APP_ID)
Copy link
Member

Choose a reason for hiding this comment

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

incorrect name of variable

;;

# DB2RDS
--db2_instance_name)
Copy link
Member

Choose a reason for hiding this comment

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

incorrect use of _

[[ -z "$GITHUB_ORG" ]] && gitops_db2rds_help "GITHUB_ORG is not set"
[[ -z "$GITHUB_REPO" ]] && gitops_db2rds_help "GITHUB_REPO is not set"
[[ -z "$GIT_BRANCH" ]] && gitops_db2rds_help "GIT_BRANCH is not set"
fi
Copy link
Member

Choose a reason for hiding this comment

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

Where the checks for these DB2RDS values removed?

echo_reset_dim "DB2RDS Namespace ........................ ${COLOR_MAGENTA}${DB2_NAMESPACE}"
echo_reset_dim "Instance Config Directory ............. ${COLOR_MAGENTA}${GITOPS_INSTANCE_DIR}"
reset_colors

Copy link
Member

Choose a reason for hiding this comment

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

the password should be snipped

Comment on lines +24 to +26
--db2_instance_name ${COLOR_YELLOW}DB2_INSTANCE_NAME${TEXT_RESET} db2rds instance name
--mas_app_id ${COLOR_YELLOW}MAS_APP_ID${TEXT_RESET} db2rds mas application id
--rds_admin_db_name ${COLOR_YELLOW}RDS_ADMIN_DB_NAME{TEXT_RESET} db2rds admin db name
Copy link
Member

Choose a reason for hiding this comment

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

incorrect use of _ in the parameter name

Comment on lines +104 to +111
--db2_instance_name)
export DB2_INSTANCE_NAME=$1 && shift
;;
--MAS_APP_ID)
export MAS_APP_ID=$1 && shift
;;
--rds_admin_db_name)
export RDS_ADMIN_DB_NAME=$1 && shift
Copy link
Member

Choose a reason for hiding this comment

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

incorrect parameter names

Comment on lines +166 to +169
[[ -z "$DB2_META_STORAGE_CLASS" ]] && gitops_db2rds_database_help "DB2_META_STORAGE_CLASS is not set"
[[ -z "$DB2_DATA_STORAGE_CLASS" ]] && gitops_db2rds_database_help "DB2_DATA_STORAGE_CLASS is not set"
[[ -z "$DB2_BACKUP_STORAGE_CLASS" ]] && gitops_db2rds_database_help "DB2_BACKUP_STORAGE_CLASS is not set"
[[ -z "$DB2_LOGS_STORAGE_CLASS" ]] && gitops_db2rds_database_help "DB2_LOGS_STORAGE_CLASS is not set"
Copy link
Member

Choose a reason for hiding this comment

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

These are not valid parameters to check for this function

Comment on lines +210 to +211
export SECRET_NAME_DB2_BACKUP=${ACCOUNT_ID}${SECRETS_KEY_SEPERATOR}${CLUSTER_ID}${SECRETS_KEY_SEPERATOR}${MAS_INSTANCE_ID}${SECRETS_KEY_SEPERATOR}db2_backup
export SECRET_NAME_ICD_AUTH_KEY=${ACCOUNT_ID}${SECRETS_KEY_SEPERATOR}${CLUSTER_ID}${SECRETS_KEY_SEPERATOR}icd
Copy link
Member

Choose a reason for hiding this comment

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

why do we need these?

Comment on lines +7 to +11
host: <path:{{ SECRETS_PATH }}:{{ HOST }}>
port: <path:{{ SECRETS_PATH }}:{{ PORT }}>
dbname: <path:{{ SECRETS_PATH }}:{{ DBNAME }}>
user: <path:{{ SECRETS_PATH }}:{{ USER }}>
password: <path:{{ SECRETS_PATH }}:{{ PASSWORD }}>
Copy link
Member

Choose a reason for hiding this comment

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

I believe the funciton should add it if these details are passed into the function. Then all cases the function should be verifying that the secrets exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants