Skip to content
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
61 changes: 61 additions & 0 deletions image/cli/mascli/functions/gitops_iac
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,16 @@ function gitops_iac_noninteractive() {
fi
;;

--rds-manage-db2-engine-version)
if [[ -n "$1" && "$1" != --* ]]; then
export RDS_MANAGE_DB2_ENGINE_VERSION=$1
shift
else
export RDS_MANAGE_DB2_ENGINE_VERSION=""
[[ $# -gt 0 ]] && shift
fi
;;

--rds-iot-db2-instance-class)
if [[ -n "$1" && "$1" != --* ]]; then
export RDS_IOT_DB2_INSTANCE_CLASS=$1
Expand Down Expand Up @@ -531,6 +541,16 @@ function gitops_iac_noninteractive() {
fi
;;

--rds-iot-db2-engine-version)
if [[ -n "$1" && "$1" != --* ]]; then
export RDS_IOT_DB2_ENGINE_VERSION=$1
shift
else
export RDS_IOT_DB2_ENGINE_VERSION=""
[[ $# -gt 0 ]] && shift
fi
;;

--rds-facilities-db2-instance-class)
if [[ -n "$1" && "$1" != --* ]]; then
export RDS_FACILITIES_DB2_INSTANCE_CLASS=$1
Expand Down Expand Up @@ -591,6 +611,16 @@ function gitops_iac_noninteractive() {
fi
;;

--rds-facilities-db2-engine-version)
if [[ -n "$1" && "$1" != --* ]]; then
export RDS_FACILITIES_DB2_ENGINE_VERSION=$1
shift
else
export RDS_FACILITIES_DB2_ENGINE_VERSION=""
[[ $# -gt 0 ]] && shift
fi
;;

# Target Cluster (Optional)
--cluster-url)
export CLUSTER_URL=$1 && shift
Expand Down Expand Up @@ -1259,7 +1289,38 @@ function gitops_iac_provision_rdsdb2(){
export RDS_APP="$app"
export RDS_S3_APP_NAME="$app"
export RDS_JDBC_CONNECTION_URL_ADDITIONAL_PARAMS=$(set_ssl_params "$additional_params")

# Set engine version based on app type
case "$app" in
manage)
export RDS_DB2_ENGINE_VERSION="${RDS_MANAGE_DB2_ENGINE_VERSION}"
;;
iot)
export RDS_DB2_ENGINE_VERSION="${RDS_IOT_DB2_ENGINE_VERSION}"
;;
facilities)
export RDS_DB2_ENGINE_VERSION="${RDS_FACILITIES_DB2_ENGINE_VERSION}"
;;
esac

# Extract major version (first two numbers, e.g., "11.5" from "11.5.9.0")
if [[ -n "${RDS_DB2_ENGINE_VERSION}" ]]; then
export RDS_DB2_MAJOR_ENGINE_VERSION=$(echo "${RDS_DB2_ENGINE_VERSION}" | cut -d'.' -f1,2)
# Create parameter group family (e.g., "db2-ae-11.5")
export RDS_DB2_PARAMETER_GROUP_FAMILY="db2-ae-${RDS_DB2_MAJOR_ENGINE_VERSION}"
# Create option group suffix (e.g., "11-5" from "11.5")
export RDS_DB2_OPTION_GROUP_SUFFIX=$(echo "${RDS_DB2_MAJOR_ENGINE_VERSION}" | tr '.' '-')
else
export RDS_DB2_MAJOR_ENGINE_VERSION=""
export RDS_DB2_PARAMETER_GROUP_FAMILY=""
export RDS_DB2_OPTION_GROUP_SUFFIX=""
fi

echo "Additional params for $app - ${RDS_JDBC_CONNECTION_URL_ADDITIONAL_PARAMS}"
echo "Engine version for $app - ${RDS_DB2_ENGINE_VERSION}"
echo "Major engine version for $app - ${RDS_DB2_MAJOR_ENGINE_VERSION}"
echo "Parameter group family for $app - ${RDS_DB2_PARAMETER_GROUP_FAMILY}"
echo "Option group suffix for $app - ${RDS_DB2_OPTION_GROUP_SUFFIX}"
echo "Generating rds-db2-$app.tf file ${GITOPS_CLUSTER_DIR}/rds-db2-$app.tf"
jinjanate_commmon $CLI_DIR/templates/gitops/appset-configs/cluster/instance/ibm-iac-rdsdb2.tf.j2 ${GITOPS_CLUSTER_DIR}/db2rds-$app.tf

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ module "db2rds-{{RDS_APP}}" {
db2_additional_security_groups = local.cluster.security_groups
region_name = "{{REGION_NAME}}"
db2_identifier = "rds"
engine_version = var.engine_version
engine_version = "{{RDS_DB2_ENGINE_VERSION}}"
multi_az = false
publicly_accessible = false
parameter_group_family = "db2-ae-11.5"
option_group_name = join("-", [var.cluster_name, var.instance_name, "{{RDS_APP}}", "db2-ae-11-5"])
parameter_group_family = "{{RDS_DB2_PARAMETER_GROUP_FAMILY}}"
option_group_name = join("-", [var.cluster_name, var.instance_name, "{{RDS_APP}}", "db2-ae-{{RDS_DB2_OPTION_GROUP_SUFFIX}}"])
db2_preferred_maintenance_window = "sun:05:00-sun:06:00"
backup_retention_period = 30
monitoring_interval = 30
Expand All @@ -49,7 +49,7 @@ module "db2rds-{{RDS_APP}}" {
db2_ssl_port = "50001"
connection_url_additional_params = "{{RDS_JDBC_CONNECTION_URL_ADDITIONAL_PARAMS}}"
db2_parameters_file_path = "./db2_parameters-{{RDS_APP}}.yaml"
major_engine_version = "11.5"
major_engine_version = "{{RDS_DB2_MAJOR_ENGINE_VERSION}}"
s3_bucket_name_for_audit_log = join("-", [var.cluster_name, var.instance_name, "rds", "auditlog", "{{RDS_APP}}"])
s3_bucket_name_for_backup_restore = join("-", [var.cluster_name, var.instance_name, "{{RDS_APP}}"])
rds_admin_db_name = "rdsadmin"
Expand Down
20 changes: 17 additions & 3 deletions tekton/src/pipelines/gitops/gitops-iac-pipeline.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ spec:
type: string
default: ''

- name: rds_manage_db2_engine_version
type: string
default: ''

# iac-rdsdb2 iot params
- name: rds_iot_db2_instance_class
type: string
Expand All @@ -225,6 +229,10 @@ spec:
type: string
default: ''

- name: rds_iot_db2_engine_version
type: string
default: ''

# iac-rdsdb2 facilities params
- name: rds_facilities_db2_instance_class
type: string
Expand All @@ -250,7 +258,9 @@ spec:
type: string
default: ''


- name: rds_facilities_db2_engine_version
type: string
default: ''

workspaces:
- name: configs
Expand Down Expand Up @@ -509,6 +519,8 @@ spec:
value: $(params.rds_manage_replica_db)
- name: rds_db2_config_manage_yaml
value: $(params.rds_db2_config_manage_yaml)
- name: rds_manage_db2_engine_version
value: $(params.rds_manage_db2_engine_version)

# iac-rdsdb2 iot params
- name: rds_iot_db2_instance_class
Expand All @@ -523,6 +535,8 @@ spec:
value: $(params.rds_iot_replica_db)
- name: rds_db2_config_iot_yaml
value: $(params.rds_db2_config_iot_yaml)
- name: rds_iot_db2_engine_version
value: $(params.rds_iot_db2_engine_version)

# iac-rdsdb2 facilities params
- name: rds_facilities_db2_instance_class
Expand All @@ -537,8 +551,8 @@ spec:
value: $(params.rds_facilities_replica_db)
- name: rds_db2_config_facilities_yaml
value: $(params.rds_db2_config_facilities_yaml)


- name: rds_facilities_db2_engine_version
value: $(params.rds_facilities_db2_engine_version)

# Task 5: Generate Common Files (Runs after EFS/S3/MSK/RDS-DB2 tasks complete/skip)
# -------------------------------------------------------------------------
Expand Down
16 changes: 15 additions & 1 deletion tekton/src/tasks/gitops/gitops-iac-provision-rdsdb2.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ spec:
- name: rds_db2_config_manage_yaml
type: string
default: ""
- name: rds_manage_db2_engine_version
type: string
default: ""

- name: rds_iot_db2_instance_class
type: string
Expand All @@ -73,7 +76,9 @@ spec:
- name: rds_db2_config_iot_yaml
type: string
default: ''

- name: rds_iot_db2_engine_version
type: string
default: ""

- name: rds_facilities_db2_instance_class
type: string
Expand All @@ -93,6 +98,9 @@ spec:
- name: rds_db2_config_facilities_yaml
type: string
default: ''
- name: rds_facilities_db2_engine_version
type: string
default: ""

stepTemplate:
env:
Expand Down Expand Up @@ -134,6 +142,8 @@ spec:
value: $(params.rds_manage_replica_db)
- name: RDS_DB2_CONFIG_MANAGE_YAML
value: $(params.rds_db2_config_manage_yaml)
- name: RDS_MANAGE_DB2_ENGINE_VERSION
value: $(params.rds_manage_db2_engine_version)

- name: RDS_IOT_DB2_INSTANCE_CLASS
value: $(params.rds_iot_db2_instance_class)
Expand All @@ -147,6 +157,8 @@ spec:
value: $(params.rds_iot_replica_db)
- name: RDS_DB2_CONFIG_IOT_YAML
value: $(params.rds_db2_config_iot_yaml)
- name: RDS_IOT_DB2_ENGINE_VERSION
value: $(params.rds_iot_db2_engine_version)

- name: RDS_FACILITIES_DB2_INSTANCE_CLASS
value: $(params.rds_facilities_db2_instance_class)
Expand All @@ -160,6 +172,8 @@ spec:
value: $(params.rds_facilities_replica_db)
- name: RDS_DB2_CONFIG_FACILITIES_YAML
value: $(params.rds_db2_config_facilities_yaml)
- name: RDS_FACILITIES_DB2_ENGINE_VERSION
value: $(params.rds_facilities_db2_engine_version)
envFrom:
- configMapRef:
name: environment-properties
Expand Down
Loading