Skip to content

Commit

Permalink
[patch] Add optional --db2-timezone parameter to gitops-db2u-database (
Browse files Browse the repository at this point in the history
  • Loading branch information
tomklapiscak authored Aug 2, 2024
1 parent 28f8dd7 commit 5c3dc17
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
23 changes: 15 additions & 8 deletions image/cli/mascli/functions/gitops_db2u_database
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ IBM DB2U:
--db2-instance-dbm-config-yaml ${COLOR_YELLOW}DB2_INSTANCE_DBM_CONFIG_YAML${TEXT_RESET} Yaml file containing the db2ucluster instance dbm config section.
--db2-database-db-config-yaml ${COLOR_YELLOW}DB2_DATABASE_DB_CONFIG_YAML${TEXT_RESET} Yaml file containing the db2ucluster database db config section.
--db2-addons-audit-config-yaml ${COLOR_YELLOW}DB2_ADDONS_AUDIT_CONFIG_YAML${TEXT_RESET} Yaml file containing the db2ucluster addons audit config section.
--db2-timezone ${COLOR_YELLOW}DB2_TIMEZONE${TEXT_RESET} DB2 DB Timezone (optional, DB2 default of "UTC" will be used if not specified)
Secrets Manager:
--secrets-path ${COLOR_YELLOW}SECRETS_PATH${TEXT_RESET} Secrets Manager path
Expand Down Expand Up @@ -263,6 +264,10 @@ function gitops_db2u_database_noninteractive() {
--db2-tolerate-effect)
export DB2_TOLERATE_EFFECT=$1 && shift
;;
--db2-timezone)
export DB2_TIMEZONE=$1 && shift
;;


# Automatic GitHub Push
-P|--github-push)
Expand Down Expand Up @@ -303,21 +308,22 @@ function gitops_db2u_database_noninteractive() {
[[ -z "$SM_AWS_ACCESS_KEY_ID" ]] && gitops_db2u_database_help "SM_AWS_ACCESS_KEY_ID is not set"
[[ -z "$SM_AWS_SECRET_ACCESS_KEY" ]] && gitops_db2u_database_help "SM_AWS_SECRET_ACCESS_KEY is not set"
[[ -z "$SM_AWS_REGION" ]] && gitops_db2u_database_help "SM_AWS_REGION is not set"
[[ -z "$SECRETS_PATH" ]] && gitops_db2u_database_help "SECRETS_PATH is not set"

[[ -z "$GITOPS_WORKING_DIR" ]] && gitops_db2u_database_help "GITOPS_WORKING_DIR is not set"
[[ -z "$ACCOUNT_ID" ]] && gitops_db2u_database_help "ACCOUNT_ID is not set"
[[ -z "$REGION_ID" ]] && gitops_db2u_database_help "REGION_ID is not set"
[[ -z "$CLUSTER_ID" ]] && gitops_db2u_database_help "CLUSTER_ID is not set"

#db2u
[[ -z "$DB2_VERSION" ]] && gitops_db2u_help "DB2_VERSION is not set"
[[ -z "$DB2_META_STORAGE_CLASS" ]] && gitops_db2u_help "DB2_META_STORAGE_CLASS is not set"
[[ -z "$DB2_DATA_STORAGE_CLASS" ]] && gitops_db2u_help "DB2_DATA_STORAGE_CLASS is not set"
[[ -z "$DB2_BACKUP_STORAGE_CLASS" ]] && gitops_db2u_help "DB2_BACKUP_STORAGE_CLASS is not set"
[[ -z "$DB2_ARCHIVELOGS_STORAGE_CLASS" ]] && gitops_db2u_help "DB2_ARCHIVELOGS_STORAGE_CLASS is not set"
[[ -z "$DB2_LOGS_STORAGE_CLASS" ]] && gitops_db2u_help "DB2_LOGS_STORAGE_CLASS is not set"
[[ -z "$MAS_INSTANCE_ID" ]] && gitops_db2u_help "MAS_INSTANCE_ID is not set"
[[ -z "$MAS_APP_ID" ]] && gitops_db2u_help "MAS_APP_ID is not set"
[[ -z "$DB2_VERSION" ]] && gitops_db2u_database_help "DB2_VERSION is not set"
[[ -z "$DB2_META_STORAGE_CLASS" ]] && gitops_db2u_database_help "DB2_META_STORAGE_CLASS is not set"
[[ -z "$DB2_DATA_STORAGE_CLASS" ]] && gitops_db2u_database_help "DB2_DATA_STORAGE_CLASS is not set"
[[ -z "$DB2_BACKUP_STORAGE_CLASS" ]] && gitops_db2u_database_help "DB2_BACKUP_STORAGE_CLASS is not set"
[[ -z "$DB2_ARCHIVELOGS_STORAGE_CLASS" ]] && gitops_db2u_database_help "DB2_ARCHIVELOGS_STORAGE_CLASS is not set"
[[ -z "$DB2_LOGS_STORAGE_CLASS" ]] && gitops_db2u_database_help "DB2_LOGS_STORAGE_CLASS is not set"
[[ -z "$MAS_INSTANCE_ID" ]] && gitops_db2u_database_help "MAS_INSTANCE_ID is not set"
[[ -z "$MAS_APP_ID" ]] && gitops_db2u_database_help "MAS_APP_ID is not set"

#MAS
[[ -z "$MAS_INSTANCE_ID" ]] && gitops_db2u_database_help "MAS_INSTANCE_ID is not set"
Expand Down Expand Up @@ -534,6 +540,7 @@ DB2_WORKLOAD: '${DB2_WORKLOAD}'"
echo_reset_dim "db2-tolerate-key .............................. ${COLOR_MAGENTA}${DB2_TOLERATE_KEY}"
echo_reset_dim "db2-tolerate-value ............................ ${COLOR_MAGENTA}${DB2_TOLERATE_VALUE}"
echo_reset_dim "db2-tolerate-effect ........................... ${COLOR_MAGENTA}${DB2_TOLERATE_EFFECT}"
echo_reset_dim "db2-timezone .................................. ${COLOR_MAGENTA}${DB2_TIMEZONE}"
reset_colors

AVP_TYPE=aws # Support for IBM will be added later
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ db2_tolerate_value: {{DB2_TOLERATE_VALUE}}
db2_tolerate_effect: {{DB2_TOLERATE_EFFECT}}
cluster_domain: <path:{{ SECRETS_PATH }}:{{ SECRET_KEY_CLUSTER_DOMAIN }}>
mas_application_id: {{MAS_APP_ID}}

db2_timezone: {{DB2_TIMEZONE}}
7 changes: 7 additions & 0 deletions tekton/src/pipelines/gitops/gitops-mas-apps.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ spec:
- name: db2_tolerate_effect
type: string
default: ""
- name: db2_timezone
type: string
default: ""

- name: custom_labels
type: string
Expand Down Expand Up @@ -573,6 +576,8 @@ spec:
value: $(params.db2_tolerate_value)
- name: db2_tolerate_effect
value: $(params.db2_tolerate_effect)
- name: db2_timezone
value: $(params.db2_timezone)

workspaces:
- name: configs
Expand Down Expand Up @@ -728,6 +733,8 @@ spec:
value: $(params.db2_tolerate_value)
- name: db2_tolerate_effect
value: $(params.db2_tolerate_effect)
- name: db2_timezone
value: $(params.db2_timezone)

workspaces:
- name: configs
Expand Down
4 changes: 4 additions & 0 deletions tekton/src/tasks/gitops/gitops-db2u-database.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ spec:
type: string
- name: db2_tolerate_effect
type: string
- name: db2_timezone
type: string
- name: mas_instance_id
type: string
- name: mas_app_id
Expand Down Expand Up @@ -203,6 +205,8 @@ spec:
value: $(params.db2_tolerate_value)
- name: DB2_TOLERATE_EFFECT
value: $(params.db2_tolerate_effect)
- name: DB2_TIMEZONE
value: $(params.db2_timezone)
- name: MAS_APP_ID
value: $(params.mas_app_id)
envFrom:
Expand Down

0 comments on commit 5c3dc17

Please sign in to comment.