From 25d48ee8cc51fcebfa233d1ff0f050c15a73fe9a Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Wed, 26 Aug 2026 14:47:25 +0530 Subject: [PATCH 01/18] raise sync-wave priority for Manage over other apps --- ...505-ibm-mas-masapp-facilities-install.yaml | 2 +- .../510-550-ibm-mas-masapp-configs.yaml | 22 +++++++++---------- .../510-ibm-mas-masapp-assist-install.yaml | 2 +- .../510-ibm-mas-masapp-iot-install.yaml | 4 ++-- ...m-mas-masapp-visualinspection-install.yaml | 2 +- .../520-ibm-mas-masapp-health-install.yaml | 2 +- .../520-ibm-mas-masapp-monitor-install.yaml | 4 ++-- .../520-ibm-mas-masapp-optimizer-install.yaml | 2 +- .../540-ibm-mas-masapp-predict-install.yaml | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml index 0bcce1153..dbb1e9def 100644 --- a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'facilities' annotations: - argocd.argoproj.io/sync-wave: "505" + argocd.argoproj.io/sync-wave: "510" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml index 0a997ba01..24e6f3f31 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml @@ -26,31 +26,31 @@ metadata: namespace: {{ $.Values.argo.namespace }} annotations: {{- if eq $value.mas_app_id "assist" }} - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "520" {{- else if eq $value.mas_app_id "facilities" }} - argocd.argoproj.io/sync-wave: "510" + argocd.argoproj.io/sync-wave: "515" {{- else if eq $value.mas_app_id "iot" }} {{- if $iot_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "530" + argocd.argoproj.io/sync-wave: "535" {{- else }} - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "525" {{- end }} {{- else if eq $value.mas_app_id "manage" }} - argocd.argoproj.io/sync-wave: "510" + argocd.argoproj.io/sync-wave: "505" {{- else if eq $value.mas_app_id "visualinspection" }} - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "520" {{- else if eq $value.mas_app_id "health" }} - argocd.argoproj.io/sync-wave: "530" + argocd.argoproj.io/sync-wave: "535" {{- else if eq $value.mas_app_id "monitor" }} {{- if $monitor_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "525" {{- else }} - argocd.argoproj.io/sync-wave: "530" + argocd.argoproj.io/sync-wave: "535" {{- end }} {{- else if eq $value.mas_app_id "optimizer" }} - argocd.argoproj.io/sync-wave: "530" + argocd.argoproj.io/sync-wave: "535" {{- else if eq $value.mas_app_id "predict" }} - argocd.argoproj.io/sync-wave: "550" + argocd.argoproj.io/sync-wave: "555" {{- end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml index 6f13fd6f5..f1171b653 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'assist' annotations: - argocd.argoproj.io/sync-wave: "510" + argocd.argoproj.io/sync-wave: "515" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml index 32b160caf..9c3a9ef28 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml @@ -1,6 +1,6 @@ {{- if not (empty .Values.ibm_suite_app_iot_install) }} {{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "510" -}} +{{- $syncwave := "520" -}} {{- if .Values.ibm_suite_app_iot_install.mas_app_channel -}} {{- $channel := .Values.ibm_suite_app_iot_install.mas_app_channel | toString -}} {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} @@ -10,7 +10,7 @@ {{- $minor := index $parts 1 | int -}} {{- /* Use sync wave 520 for version >= 9.2, otherwise 510 */ -}} {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "520" -}} + {{- $syncwave = "530" -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml index 40c24c1d3..3c2fa0989 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'visualinspection' annotations: - argocd.argoproj.io/sync-wave: "510" + argocd.argoproj.io/sync-wave: "515" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml index f6c65862a..abd42dc9b 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'health' annotations: - argocd.argoproj.io/sync-wave: "520" + argocd.argoproj.io/sync-wave: "530" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml index ff75b7346..d5a182516 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml @@ -1,6 +1,6 @@ {{- if not (empty .Values.ibm_suite_app_monitor_install) }} {{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "520" -}} +{{- $syncwave := "530" -}} {{- if .Values.ibm_suite_app_monitor_install.mas_app_channel -}} {{- $channel := .Values.ibm_suite_app_monitor_install.mas_app_channel | toString -}} {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} @@ -10,7 +10,7 @@ {{- $minor := index $parts 1 | int -}} {{- /* Use sync wave 510 for version >= 9.2, otherwise 520 */ -}} {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "510" -}} + {{- $syncwave = "520" -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml index ddfd2995c..bcdb3f8e3 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'optimizer' annotations: - argocd.argoproj.io/sync-wave: "520" + argocd.argoproj.io/sync-wave: "530" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml index 746a1e85c..1599d9af8 100644 --- a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'predict' annotations: - argocd.argoproj.io/sync-wave: "540" + argocd.argoproj.io/sync-wave: "545" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} From dc834e550d5282c8cfc2ba7f0086702957ace61c Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Wed, 26 Aug 2026 21:49:02 +0530 Subject: [PATCH 02/18] fix: set sync-wave order for SDB and Backup job --- .../120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml | 2 ++ .../ibm-mas-instance-root/templates/120-db2-databases-app.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml b/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml index 9fbc12cba..5cd5b486c 100644 --- a/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml @@ -12,6 +12,8 @@ apiVersion: batch/v1 metadata: name: "db2-backup-job-v1-{{ .Values.db2_instance_name }}" namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/sync-wave: "515" labels: parent: cronjob cosBucket: "{{ .Values.db2_backup_bucket_name }}" diff --git a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml index af6b2ce05..291a1a43a 100644 --- a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml @@ -22,7 +22,7 @@ metadata: {{ if not (contains "sdb" $value.db2_instance_name) }} argocd.argoproj.io/sync-wave: "120" {{ else }} - argocd.argoproj.io/sync-wave: "121" + argocd.argoproj.io/sync-wave: "520" {{ end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} From 60f2758e4f5266cd836727cf08a7f1d01ee264c5 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 28 Aug 2026 13:03:54 +0530 Subject: [PATCH 03/18] fix: update sync-wave for 04-db2u-Backup_Cron.yaml --- .../120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml b/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml index 5cd5b486c..c7bf323de 100644 --- a/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/04-db2u-Backup_Cron.yaml @@ -13,7 +13,7 @@ metadata: name: "db2-backup-job-v1-{{ .Values.db2_instance_name }}" namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "525" labels: parent: cronjob cosBucket: "{{ .Values.db2_backup_bucket_name }}" From 1360db6dfa5d17208171faee489a9f05fb433446 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 18 Sep 2026 14:40:15 +0530 Subject: [PATCH 04/18] update to sync-wave --- .../ibm-mas-instance-root/README.md | 26 +++++++++++-------- ...505-ibm-mas-masapp-facilities-install.yaml | 2 +- .../510-550-ibm-mas-masapp-configs.yaml | 20 +++++++------- .../510-ibm-mas-masapp-assist-install.yaml | 2 +- .../510-ibm-mas-masapp-iot-install.yaml | 6 ++--- ...m-mas-masapp-visualinspection-install.yaml | 2 +- .../520-ibm-mas-masapp-health-install.yaml | 2 +- .../520-ibm-mas-masapp-monitor-install.yaml | 7 ++--- .../520-ibm-mas-masapp-optimizer-install.yaml | 2 +- .../540-ibm-mas-masapp-predict-install.yaml | 2 +- .../templates/550-ibm-mas-addons-config.yaml | 2 +- 11 files changed, 39 insertions(+), 34 deletions(-) diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index dbcf0beb6..8a9561a30 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -61,7 +61,11 @@ Applications are deployed in the following order (controlled by sync-wave annota 2. **100-121: Dependencies** - SLS, Db2, CP4D, databases, and CP4D services 3. **130: MAS Suite** - Core MAS suite installation and configurations 4. **200: Workspaces** - MAS workspace creation -5. **500-550: Applications** - MAS application installations and configurations +5. **500-560: Applications** - MAS application installations and configurations + - **500**: Manage install (highest priority among MAS apps) + - **505**: Manage config + - **520**: SDB (Standby DB2/HADR) — after Manage, before all other app installs + - **521-560**: All other MAS app installs and configs (Facilities, Assist, VisualInspection, IoT, Health, Monitor, Optimizer, Predict, Addons) 6. **600: RBAC & Post-Sync** - RBAC setup and post-deployment validation ## Configuration Files @@ -218,16 +222,16 @@ The following table lists all ArgoCD applications defined in the templates folde | [`130-ibm-mas-suite-configs-app.yaml`](templates/130-ibm-mas-suite-configs-app.yaml) | mas_config_name | | ✓ | | 130 | | [`200-ibm-mas-workspaces.yaml`](templates/200-ibm-mas-workspaces.yaml) | workspace | | ✓ | | 200 | | [`500-ibm-mas-masapp-manage-install.yaml`](templates/500-ibm-mas-masapp-manage-install.yaml) | manage | | | ✓ | 500 | -| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 505 | -| [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | 510 | -| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 510 | -| [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | 510 | -| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 510-550 | -| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 520 | -| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 520 | -| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 520 | -| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 540 | -| [`550-ibm-mas-addons-config.yaml`](templates/550-ibm-mas-addons-config.yaml) | addons | | ✓ | | 550 | +| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 521 | +| [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | 525 | +| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 530 (540 for channel ≥9.2) | +| [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | 525 | +| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 505-558 | +| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 540 | +| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 540 (525 for channel ≥9.2, aligns with Assist) | +| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 540 | +| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 555 | +| [`550-ibm-mas-addons-config.yaml`](templates/550-ibm-mas-addons-config.yaml) | addons | | ✓ | | 560 | | [`600-application-admin-rbac-app.yaml`](templates/600-application-admin-rbac-app.yaml) | application-admin-rbac | | ✓ | | 600 | | [`600-ibm-post-sync-jobs.yaml`](templates/600-ibm-post-sync-jobs.yaml) | postsyncjobs | | | ✓ | 600 | diff --git a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml index dbb1e9def..c54e51212 100644 --- a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'facilities' annotations: - argocd.argoproj.io/sync-wave: "510" + argocd.argoproj.io/sync-wave: "521" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml index c5d3b093e..b45b0e655 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml @@ -26,31 +26,31 @@ metadata: namespace: {{ $.Values.argo.namespace }} annotations: {{- if eq $value.mas_app_id "assist" }} - argocd.argoproj.io/sync-wave: "520" + argocd.argoproj.io/sync-wave: "527" {{- else if eq $value.mas_app_id "facilities" }} - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "522" {{- else if eq $value.mas_app_id "iot" }} {{- if $iot_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "535" + argocd.argoproj.io/sync-wave: "543" {{- else }} - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "533" {{- end }} {{- else if eq $value.mas_app_id "manage" }} argocd.argoproj.io/sync-wave: "505" {{- else if eq $value.mas_app_id "visualinspection" }} - argocd.argoproj.io/sync-wave: "520" + argocd.argoproj.io/sync-wave: "527" {{- else if eq $value.mas_app_id "health" }} - argocd.argoproj.io/sync-wave: "535" + argocd.argoproj.io/sync-wave: "545" {{- else if eq $value.mas_app_id "monitor" }} {{- if $monitor_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "527" {{- else }} - argocd.argoproj.io/sync-wave: "535" + argocd.argoproj.io/sync-wave: "545" {{- end }} {{- else if eq $value.mas_app_id "optimizer" }} - argocd.argoproj.io/sync-wave: "535" + argocd.argoproj.io/sync-wave: "545" {{- else if eq $value.mas_app_id "predict" }} - argocd.argoproj.io/sync-wave: "555" + argocd.argoproj.io/sync-wave: "558" {{- end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml index f1171b653..bfa5c5239 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'assist' annotations: - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "525" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml index 9c3a9ef28..2c56c91a0 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml @@ -1,6 +1,6 @@ {{- if not (empty .Values.ibm_suite_app_iot_install) }} {{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "520" -}} +{{- $syncwave := "530" -}} {{- if .Values.ibm_suite_app_iot_install.mas_app_channel -}} {{- $channel := .Values.ibm_suite_app_iot_install.mas_app_channel | toString -}} {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} @@ -8,9 +8,9 @@ {{- $parts := splitList "." $version -}} {{- $major := index $parts 0 | int -}} {{- $minor := index $parts 1 | int -}} - {{- /* Use sync wave 520 for version >= 9.2, otherwise 510 */ -}} + {{- /* Use sync wave 540 for version >= 9.2, otherwise 530 */ -}} {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "530" -}} + {{- $syncwave = "540" -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml index 3c2fa0989..5773c3d32 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'visualinspection' annotations: - argocd.argoproj.io/sync-wave: "515" + argocd.argoproj.io/sync-wave: "525" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml index abd42dc9b..e6c75b629 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'health' annotations: - argocd.argoproj.io/sync-wave: "530" + argocd.argoproj.io/sync-wave: "540" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml index d5a182516..98eff80cf 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml @@ -1,6 +1,7 @@ {{- if not (empty .Values.ibm_suite_app_monitor_install) }} {{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "530" -}} +{{- $syncwave := "540" -}} +{{- /* Note: the >=9.2 wave (525) intentionally matches Assist install wave */ -}} {{- if .Values.ibm_suite_app_monitor_install.mas_app_channel -}} {{- $channel := .Values.ibm_suite_app_monitor_install.mas_app_channel | toString -}} {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} @@ -8,9 +9,9 @@ {{- $parts := splitList "." $version -}} {{- $major := index $parts 0 | int -}} {{- $minor := index $parts 1 | int -}} - {{- /* Use sync wave 510 for version >= 9.2, otherwise 520 */ -}} + {{- /* Use sync wave 525 for version >= 9.2 (aligns with Assist), otherwise 540 */ -}} {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "520" -}} + {{- $syncwave = "525" -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml index bcdb3f8e3..d2aca64d8 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'optimizer' annotations: - argocd.argoproj.io/sync-wave: "530" + argocd.argoproj.io/sync-wave: "540" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml index 1599d9af8..a7ee237cc 100644 --- a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'predict' annotations: - argocd.argoproj.io/sync-wave: "545" + argocd.argoproj.io/sync-wave: "555" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml b/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml index e5d9611a9..74f5b9ba5 100644 --- a/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml +++ b/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml @@ -17,7 +17,7 @@ metadata: {{- end }} instance: '{{ .Values.instance.id }}' annotations: - argocd.argoproj.io/sync-wave: "551" + argocd.argoproj.io/sync-wave: "560" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} From 853538e49eb33d4ceab975e2b05767c5cc333676 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 18 Sep 2026 15:05:45 +0530 Subject: [PATCH 05/18] fix: update --- .../templates/510-ibm-mas-masapp-iot-install.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml index 2c56c91a0..ba1751073 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml @@ -1,6 +1,6 @@ {{- if not (empty .Values.ibm_suite_app_iot_install) }} {{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "530" -}} +{{- $syncwave := "525" -}} {{- if .Values.ibm_suite_app_iot_install.mas_app_channel -}} {{- $channel := .Values.ibm_suite_app_iot_install.mas_app_channel | toString -}} {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} From 19e50225ce5d9d7b616d62b174589642f9b9f870 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 18 Sep 2026 15:28:29 +0530 Subject: [PATCH 06/18] fix: updates --- root-applications/ibm-mas-instance-root/README.md | 4 ++-- .../templates/510-ibm-mas-masapp-iot-install.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index 8a9561a30..d0b3d1045 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -224,11 +224,11 @@ The following table lists all ArgoCD applications defined in the templates folde | [`500-ibm-mas-masapp-manage-install.yaml`](templates/500-ibm-mas-masapp-manage-install.yaml) | manage | | | ✓ | 500 | | [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 521 | | [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | 525 | -| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 530 (540 for channel ≥9.2) | +| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 525 (540 for channel ≥9.2) | | [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | 525 | | [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 505-558 | | [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 540 | -| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 540 (525 for channel ≥9.2, aligns with Assist) | +| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 540 (525 for channel ≥9.2, co-wave with Assist and IoT default) | | [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 540 | | [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 555 | | [`550-ibm-mas-addons-config.yaml`](templates/550-ibm-mas-addons-config.yaml) | addons | | ✓ | | 560 | diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml index ba1751073..261982d11 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml @@ -8,7 +8,7 @@ {{- $parts := splitList "." $version -}} {{- $major := index $parts 0 | int -}} {{- $minor := index $parts 1 | int -}} - {{- /* Use sync wave 540 for version >= 9.2, otherwise 530 */ -}} + {{- /* Use sync wave 540 for version >= 9.2, otherwise 525 */ -}} {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} {{- $syncwave = "540" -}} {{- end -}} From 886a10590c223d52704bee375480f68e453f7576 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 18 Sep 2026 15:32:06 +0530 Subject: [PATCH 07/18] update for co-wave grouping --- .../templates/510-550-ibm-mas-masapp-configs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml index b45b0e655..015880041 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml @@ -31,9 +31,9 @@ metadata: argocd.argoproj.io/sync-wave: "522" {{- else if eq $value.mas_app_id "iot" }} {{- if $iot_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "543" + argocd.argoproj.io/sync-wave: "545" {{- else }} - argocd.argoproj.io/sync-wave: "533" + argocd.argoproj.io/sync-wave: "527" {{- end }} {{- else if eq $value.mas_app_id "manage" }} argocd.argoproj.io/sync-wave: "505" From 4db8ab3a7cf7ca8a57d98193e43b1b0477609ae7 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Mon, 12 Oct 2026 16:56:12 +0530 Subject: [PATCH 08/18] update the sync wave for secondary db --- .../120-ibm-db2u-database/templates/01-db2_Issuer.yaml | 2 +- .../templates/02-db2_Certificate.yaml | 2 +- .../120-ibm-db2u-database/templates/03-db2uinstance.yaml | 4 ++-- .../120-ibm-db2u-database/templates/06-tlsroute.yaml | 2 +- .../templates/08-postdelete-db2-user-job-rbac.yaml | 4 ++-- .../120-ibm-db2u-database/templates/09-hadr_services.yaml | 4 ++++ .../templates/10-postsync-setup-hadr.yaml | 8 ++++---- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/instance-applications/120-ibm-db2u-database/templates/01-db2_Issuer.yaml b/instance-applications/120-ibm-db2u-database/templates/01-db2_Issuer.yaml index a012b7520..cdee11114 100644 --- a/instance-applications/120-ibm-db2u-database/templates/01-db2_Issuer.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/01-db2_Issuer.yaml @@ -6,7 +6,7 @@ metadata: name: "db2u-issuer-{{ .Values.db2_instance_name }}" namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "120" + argocd.argoproj.io/sync-wave: {{ add 120 (ternary 600 0 (contains "sdb" .Values.db2_instance_name)) | quote }} {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} diff --git a/instance-applications/120-ibm-db2u-database/templates/02-db2_Certificate.yaml b/instance-applications/120-ibm-db2u-database/templates/02-db2_Certificate.yaml index 242359e4d..004f4bd89 100644 --- a/instance-applications/120-ibm-db2u-database/templates/02-db2_Certificate.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/02-db2_Certificate.yaml @@ -6,7 +6,7 @@ metadata: name: "db2u-certificate-{{ .Values.db2_instance_name }}" namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "121" + argocd.argoproj.io/sync-wave: {{ add 121 (ternary 600 0 (contains "sdb" .Values.db2_instance_name)) | quote }} {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} diff --git a/instance-applications/120-ibm-db2u-database/templates/03-db2uinstance.yaml b/instance-applications/120-ibm-db2u-database/templates/03-db2uinstance.yaml index 13b0040fa..1c5186c2e 100644 --- a/instance-applications/120-ibm-db2u-database/templates/03-db2uinstance.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/03-db2uinstance.yaml @@ -6,8 +6,8 @@ metadata: name: "{{ .Values.db2_instance_name | lower }}" namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "122" - argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true + argocd.argoproj.io/sync-wave: {{ add 122 (ternary 600 0 (contains "sdb" .Values.db2_instance_name)) | quote }} + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} diff --git a/instance-applications/120-ibm-db2u-database/templates/06-tlsroute.yaml b/instance-applications/120-ibm-db2u-database/templates/06-tlsroute.yaml index 47a511e6d..ffa335a3b 100644 --- a/instance-applications/120-ibm-db2u-database/templates/06-tlsroute.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/06-tlsroute.yaml @@ -13,7 +13,7 @@ metadata: name: db2u-{{ .Values.db2_instance_name }}-tls-route namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "123" + argocd.argoproj.io/sync-wave: {{ add 123 (ternary 600 0 (contains "sdb" .Values.db2_instance_name)) | quote }} labels: formation_id: "{{ .Values.db2_instance_name | lower }}" {{- if eq .Values.jdbc_route "public" }} diff --git a/instance-applications/120-ibm-db2u-database/templates/08-postdelete-db2-user-job-rbac.yaml b/instance-applications/120-ibm-db2u-database/templates/08-postdelete-db2-user-job-rbac.yaml index 7048e5c1b..5da4161b5 100644 --- a/instance-applications/120-ibm-db2u-database/templates/08-postdelete-db2-user-job-rbac.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/08-postdelete-db2-user-job-rbac.yaml @@ -19,7 +19,7 @@ metadata: name: aws-db2-user-job-{{ .Values.instance_id }}-{{ .Values.mas_application_id }}-{{ .Values.db2_instance_name }}-role-db2 namespace: {{ .Values.db2_namespace }} annotations: - argocd.argoproj.io/sync-wave: "121" + argocd.argoproj.io/sync-wave: {{ add 121 (ternary 600 0 (contains "sdb" .Values.db2_instance_name)) | quote }} {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} @@ -59,7 +59,7 @@ metadata: name: aws-db2-user-job-{{ .Values.instance_id }}-{{ .Values.mas_application_id }}-{{ .Values.db2_instance_name }}-rolebinding-db2 namespace: {{ .Values.db2_namespace }} annotations: - argocd.argoproj.io/sync-wave: "122" + argocd.argoproj.io/sync-wave: {{ add 122 (ternary 600 0 (contains "sdb" .Values.db2_instance_name)) | quote }} {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} diff --git a/instance-applications/120-ibm-db2u-database/templates/09-hadr_services.yaml b/instance-applications/120-ibm-db2u-database/templates/09-hadr_services.yaml index f137786ed..ee8e4a1e1 100644 --- a/instance-applications/120-ibm-db2u-database/templates/09-hadr_services.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/09-hadr_services.yaml @@ -6,6 +6,8 @@ kind: Service metadata: name: c-{{ .Values.db2_instance_name }}-db2u-hadr-svc namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/sync-wave: "720" spec: selector: app: {{ .Values.db2_instance_name }} @@ -30,6 +32,8 @@ kind: NetworkPolicy metadata: name: c-{{ .Values.db2_instance_name }}-hadr-ext namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/sync-wave: "720" spec: ingress: - ports: diff --git a/instance-applications/120-ibm-db2u-database/templates/10-postsync-setup-hadr.yaml b/instance-applications/120-ibm-db2u-database/templates/10-postsync-setup-hadr.yaml index d5bbc15f2..42d86b2a2 100644 --- a/instance-applications/120-ibm-db2u-database/templates/10-postsync-setup-hadr.yaml +++ b/instance-applications/120-ibm-db2u-database/templates/10-postsync-setup-hadr.yaml @@ -67,7 +67,7 @@ metadata: name: "postsync-hadr-sa-{{ .Values.db2_instance_name }}" namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "128" + argocd.argoproj.io/sync-wave: "728" {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} @@ -81,7 +81,7 @@ metadata: name: "db2-database-postsync-hadr-sa-role-{{ .Values.db2_instance_name }}" namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "128" + argocd.argoproj.io/sync-wave: "728" {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} @@ -123,7 +123,7 @@ metadata: name: "db2-database-postsync-hadr-sa-rb-{{ .Values.db2_instance_name }}" namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "128" + argocd.argoproj.io/sync-wave: "728" {{- if .Values.custom_labels }} labels: {{ .Values.custom_labels | toYaml | indent 4 }} @@ -144,7 +144,7 @@ metadata: name: {{ $_job_name }} namespace: "{{ .Values.db2_namespace }}" annotations: - argocd.argoproj.io/sync-wave: "130" + argocd.argoproj.io/sync-wave: "730" labels: mas.ibm.com/job-cleanup-group: {{ $_job_cleanup_group }} {{- if .Values.custom_labels }} From f5576a1f736fa071460c7e6bf5855dd387cb9d11 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Wed, 21 Oct 2026 15:44:23 +0530 Subject: [PATCH 09/18] update the sync-waves --- .../ibm-mas-instance-root/README.md | 20 +++++++++++-------- .../templates/120-db2-databases-app.yaml | 2 +- ...505-ibm-mas-masapp-facilities-install.yaml | 2 +- .../510-550-ibm-mas-masapp-configs.yaml | 18 ++++------------- .../520-ibm-mas-masapp-health-install.yaml | 2 +- .../520-ibm-mas-masapp-optimizer-install.yaml | 2 +- .../540-ibm-mas-masapp-predict-install.yaml | 2 +- 7 files changed, 21 insertions(+), 27 deletions(-) diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index 0b1c35bfa..d98f8a21a 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -62,10 +62,14 @@ Applications are deployed in the following order (controlled by sync-wave annota 3. **130: MAS Suite** - Core MAS suite installation and configurations 4. **200: Workspaces** - MAS workspace creation 5. **500-560: Applications** - MAS application installations and configurations + - **120** (earlier): Primary Db2/RDS databases of every app, synced before any app - **500**: Manage install (highest priority among MAS apps) - **505**: Manage config - - **520**: SDB (Standby DB2/HADR) — after Manage, before all other app installs - - **521-560**: All other MAS app installs and configs (Facilities, Assist, VisualInspection, IoT, Health, Monitor, Optimizer, Predict, Addons) + - **525**: All other MAS app installs, in parallel (Facilities, Assist, VisualInspection, Health, Optimizer, Predict; IoT and Monitor are version dependent, see below) + - **527**: Non-Manage app configs + - **540 / 545**: Version-dependent IoT and Monitor install (540) and config (545) waves + - **550**: Secondary (SDB / standby HADR) Db2 databases, after all apps + - **560**: Addons config 6. **600: RBAC & Post-Sync** - RBAC setup and post-deployment validation ## Configuration Files @@ -223,15 +227,15 @@ The following table lists all ArgoCD applications defined in the templates folde | [`130-ibm-mas-suite-configs-app.yaml`](templates/130-ibm-mas-suite-configs-app.yaml) | mas_config_name | | ✓ | | 130 | | [`200-ibm-mas-workspaces.yaml`](templates/200-ibm-mas-workspaces.yaml) | workspace | | ✓ | | 200 | | [`500-ibm-mas-masapp-manage-install.yaml`](templates/500-ibm-mas-masapp-manage-install.yaml) | manage | | | ✓ | 500 | -| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 521 | +| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 525 | | [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | 525 | | [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 525 (540 for channel ≥9.2) | | [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | 525 | -| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 505-558 | -| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 540 | -| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 540 (525 for channel ≥9.2, co-wave with Assist and IoT default) | -| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 540 | -| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 555 | +| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 505 (manage), 527 (others); iot 527 (545 for channel ≥9.2); monitor 545 (527 for channel ≥9.2) | +| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 525 | +| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 540 (525 for channel ≥9.2) | +| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 525 | +| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 525 | | [`550-ibm-mas-addons-config.yaml`](templates/550-ibm-mas-addons-config.yaml) | addons | | ✓ | | 560 | | [`600-application-admin-rbac-app.yaml`](templates/600-application-admin-rbac-app.yaml) | application-admin-rbac | | ✓ | | 600 | | [`600-ibm-post-sync-jobs.yaml`](templates/600-ibm-post-sync-jobs.yaml) | postsyncjobs | | | ✓ | 600 | diff --git a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml index 291a1a43a..af8a549bf 100644 --- a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml @@ -22,7 +22,7 @@ metadata: {{ if not (contains "sdb" $value.db2_instance_name) }} argocd.argoproj.io/sync-wave: "120" {{ else }} - argocd.argoproj.io/sync-wave: "520" + argocd.argoproj.io/sync-wave: "550" {{ end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml index 919d11e3b..f75872d18 100644 --- a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'facilities' annotations: - argocd.argoproj.io/sync-wave: "521" + argocd.argoproj.io/sync-wave: "525" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml index c4dee7b39..6611aade9 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml @@ -25,32 +25,22 @@ metadata: name: "{{ $value.mas_workspace_id }}.{{ $value.mas_app_id }}.{{ $.Values.cluster.id }}.{{ $.Values.instance.id }}" namespace: {{ $.Values.argo.namespace }} annotations: - {{- if eq $value.mas_app_id "assist" }} - argocd.argoproj.io/sync-wave: "527" - {{- else if eq $value.mas_app_id "facilities" }} - argocd.argoproj.io/sync-wave: "522" + {{- if eq $value.mas_app_id "manage" }} + argocd.argoproj.io/sync-wave: "505" {{- else if eq $value.mas_app_id "iot" }} {{- if $iot_is_v92_or_higher }} argocd.argoproj.io/sync-wave: "545" {{- else }} argocd.argoproj.io/sync-wave: "527" {{- end }} - {{- else if eq $value.mas_app_id "manage" }} - argocd.argoproj.io/sync-wave: "505" - {{- else if eq $value.mas_app_id "visualinspection" }} - argocd.argoproj.io/sync-wave: "527" - {{- else if eq $value.mas_app_id "health" }} - argocd.argoproj.io/sync-wave: "545" {{- else if eq $value.mas_app_id "monitor" }} {{- if $monitor_is_v92_or_higher }} argocd.argoproj.io/sync-wave: "527" {{- else }} argocd.argoproj.io/sync-wave: "545" {{- end }} - {{- else if eq $value.mas_app_id "optimizer" }} - argocd.argoproj.io/sync-wave: "545" - {{- else if eq $value.mas_app_id "predict" }} - argocd.argoproj.io/sync-wave: "558" + {{- else }} + argocd.argoproj.io/sync-wave: "527" {{- end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml index e6c75b629..39fe17278 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'health' annotations: - argocd.argoproj.io/sync-wave: "540" + argocd.argoproj.io/sync-wave: "525" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml index 96dd53c30..ea18ae364 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'optimizer' annotations: - argocd.argoproj.io/sync-wave: "540" + argocd.argoproj.io/sync-wave: "525" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml index a7ee237cc..91ecc0fba 100644 --- a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'predict' annotations: - argocd.argoproj.io/sync-wave: "555" + argocd.argoproj.io/sync-wave: "525" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} From a38042c5c5f0c4b8fab31a1636e83930884761dc Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 23 Oct 2026 11:02:14 +0530 Subject: [PATCH 10/18] include presync hook for sdb --- .../120-ibm-db2u-database/README.md | 9 ++ .../00-presync-await-app-config_Job.yaml | 143 ++++++++++++++++++ .../ibm-mas-instance-root/README.md | 4 +- .../templates/120-db2-databases-app.yaml | 41 ++++- 4 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml diff --git a/instance-applications/120-ibm-db2u-database/README.md b/instance-applications/120-ibm-db2u-database/README.md index b9f489803..db56b82fc 100644 --- a/instance-applications/120-ibm-db2u-database/README.md +++ b/instance-applications/120-ibm-db2u-database/README.md @@ -10,6 +10,8 @@ This chart deploys and configures a Db2u database instance for use by a MAS appl Contains a presync hook (`00-presync-await-crd_Job.yaml`) that ensures we wait for the `db2uclusters` CRD to be installed before attempting to sync. +For secondary (`sdb`) databases it also contains a presync hook (`00-presync-await-app-config_Job.yaml`) that waits for the config Application of the owning MAS app (`await_app_config_name`) to be `Healthy`. This makes a slow app delay only its own `sdb`; the `sdb` databases of other apps are not affected. + Contains a job that runs last (`05-postsync-setup-db2_Job.yaml`). This registers the `${ACCOUNT_ID}/${CLUSTER_ID}/${MAS_INSTANCE_ID}/db2/${DB2_INSTANCE_NAME}/config` secret in the **Secrets Vault** used to share some information that is generated at runtime with other ArgoCD Applications. This job also performs some special configuration steps that are required if the Db2u database is intended for use by the Manage MAS Application. ## Resources Created @@ -32,6 +34,8 @@ Contains a job that runs last (`05-postsync-setup-db2_Job.yaml`). This registers | `Secret` | Post-sync DB2 generated secret | DB2 application namespace | Always | `application_admin_role` | | `NetworkPolicy` | HADR network policy | DB2 application namespace | When HADR is enabled | `application_admin_role` | | `Job` | Pre/post-sync DB2 setup jobs | DB2 application namespace | Always | `application_admin_role` | +| `Job` | Presync job awaiting the owning app's config Application | DB2 application namespace | `sdb` instances with `await_app_config_name` set | `application_admin_role` | +| `Role` / `RoleBinding` | Allows the presync service account to `get` the owning app's config Application | ArgoCD namespace | `sdb` instances with `await_app_config_name` set | `application_admin_role` | | `Job` | DB2 audit policy setup job | DB2 application namespace | When `mas_application_id` is `manage`, `facilities`, `monitor`, or `iot` | `application_admin_role` | ## Configuration @@ -49,6 +53,10 @@ db2_node_label: string db2_dedicated_node: string replica_db: string +# Set by ibm-mas-instance-root for sdb instances only +argo_namespace: string # ArgoCD namespace (default: openshift-gitops) +await_app_config_name: string # Name of the ArgoCD config Application of the owning app, e.g. ... + # Instance Registry Configuration db2_instance_registry: key: value @@ -340,6 +348,7 @@ cluster_domain: "" ## Troubleshooting +- **`sdb` sync waiting** — the `presync-await-app-config-` Job waits up to 60 minutes for the app config Application named in `await_app_config_name` to be `Healthy`. Check that Application in ArgoCD. - **Presync job stuck** — verify the `db2uclusters` CRD is installed by the DB2U operator before the ArgoCD sync wave reaches this chart. - **Postsync job failing** — check the job logs in the DB2 namespace; common causes are missing S3 credentials or an unreachable backup bucket. - **Audit CronJob not running** — confirm `db2_backup_bucket_name` is set and the instance name does not contain `sdb` (audit cron is disabled for SDB instances). diff --git a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml b/instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml new file mode 100644 index 000000000..f47a0caed --- /dev/null +++ b/instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml @@ -0,0 +1,143 @@ +{{- if .Values.application_admin_role }} +{{- /* +Only created for secondary (sdb) databases that belong to an app with a config Application (await_app_config_name is +set by the ibm-mas-instance-root 120-db2-databases-app.yaml template). + +The sdb Application is synced at the same wave as the config Application of its own app. This PreSync hook then holds +the sdb sync until that single config Application is Healthy. As a result a slow or failing app only delays its own +sdb; the sdb of every other app is not affected. +*/}} +{{- if and (contains "sdb" .Values.db2_instance_name) .Values.await_app_config_name }} + +{{- /* +Use the build/bin/set-cli-image-digest.sh script to update this value across all charts. +*/}} +{{- $_cli_image_digest := "sha256:d9b9e5151413d08b79a45a0b657ecf48ae4eee30cb3bc997e6ccba1a8eb8f958" }} +{{- $_argo_namespace := .Values.argo_namespace | default "openshift-gitops" }} + +--- +# Allow the presync service account to read (only) the config Application of the owning app +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: "db2-database-presync-await-app-role-{{ .Values.db2_instance_name }}" + namespace: "{{ $_argo_namespace }}" + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation +{{- if .Values.custom_labels }} + labels: +{{ .Values.custom_labels | toYaml | indent 4 }} +{{- end }} +rules: +- apiGroups: + - argoproj.io + resources: + - applications + resourceNames: + - "{{ .Values.await_app_config_name }}" + verbs: + - get + +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: "db2-database-presync-await-app-rb-{{ .Values.db2_instance_name }}" + namespace: "{{ $_argo_namespace }}" + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation +{{- if .Values.custom_labels }} + labels: +{{ .Values.custom_labels | toYaml | indent 4 }} +{{- end }} +subjects: + - kind: ServiceAccount + name: "presync-sa-{{ .Values.db2_instance_name }}" + namespace: "{{ .Values.db2_namespace }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: "db2-database-presync-await-app-role-{{ .Values.db2_instance_name }}" + +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: "presync-await-app-config-{{ .Values.db2_instance_name }}" + namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation +{{- if .Values.custom_labels }} + labels: +{{ .Values.custom_labels | toYaml | indent 4 }} +{{- end }} +spec: + template: +{{- if .Values.custom_labels }} + metadata: + labels: +{{ .Values.custom_labels | toYaml | indent 8 }} +{{- end }} + spec: + containers: + - name: run + image: {{ .Values.cli_image_repo | default "quay.io/ibmmas/cli" }}@{{ $_cli_image_digest }} + imagePullPolicy: IfNotPresent + resources: + limits: + cpu: 200m + memory: 512Mi + requests: + cpu: 10m + memory: 64Mi + env: + - name: ARGO_NAMESPACE + value: "{{ $_argo_namespace }}" + - name: APP_CONFIG_NAME + value: "{{ .Values.await_app_config_name }}" + - name: DB2_INSTANCE_NAME + value: "{{ .Values.db2_instance_name }}" + command: + - /bin/sh + - -c + - | + + set -e + + echo + echo "================================================================================" + echo "PreSync: waiting for the app config Application to be Healthy before syncing ${DB2_INSTANCE_NAME}" + echo "================================================================================" + echo "ArgoCD namespace : ${ARGO_NAMESPACE}" + echo "App config Application: ${APP_CONFIG_NAME}" + echo + + wait_period=0 + while true; do + HEALTH=$(oc get applications.argoproj.io "${APP_CONFIG_NAME}" -n "${ARGO_NAMESPACE}" -o jsonpath='{.status.health.status}' 2>/dev/null || true) + echo "Application ${APP_CONFIG_NAME} health: '${HEALTH}'" + + if [ "${HEALTH}" = "Healthy" ]; then + echo "App config Application is Healthy. Proceeding with the sync of ${DB2_INSTANCE_NAME}." + exit 0 + fi + + wait_period=$(( wait_period + 30 )) + if [ "${wait_period}" -gt 3600 ]; then + echo "Timed out after 60 minutes waiting for ${APP_CONFIG_NAME} to become Healthy." + exit 1 + fi + + echo "Waiting 30 seconds before next check..." + sleep 30 + done + + restartPolicy: Never + serviceAccountName: "presync-sa-{{ .Values.db2_instance_name }}" + volumes: [] + backoffLimit: 0 +{{- end }} +{{- end }} diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index d98f8a21a..cef692747 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -68,7 +68,7 @@ Applications are deployed in the following order (controlled by sync-wave annota - **525**: All other MAS app installs, in parallel (Facilities, Assist, VisualInspection, Health, Optimizer, Predict; IoT and Monitor are version dependent, see below) - **527**: Non-Manage app configs - **540 / 545**: Version-dependent IoT and Monitor install (540) and config (545) waves - - **550**: Secondary (SDB / standby HADR) Db2 databases, after all apps + - **527 / 545**: Secondary (SDB / standby HADR) Db2 databases sync at the wave of their own app's config (527, or 545 for IoT/Monitor depending on channel; 550 if the app has no config). A presync hook waits for that one app's config Application to be Healthy, so a slow app only delays its own SDB - **560**: Addons config 6. **600: RBAC & Post-Sync** - RBAC setup and post-deployment validation @@ -215,7 +215,7 @@ The following table lists all ArgoCD applications defined in the templates folde | [`110-ibm-cp4d-operator-app.yaml`](templates/110-ibm-cp4d-operator-app.yaml) | cp4doperator | ✓ | | | 110 | | [`110-ibm-cs-control-app.yaml`](templates/110-ibm-cs-control-app.yaml) | cscontrol | ✓ | | | 110 | | [`110-ibm-db2u-app.yaml`](templates/110-ibm-db2u-app.yaml) | db2u | ✓ | | | 110 | -| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | 120 | +| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | 120 (`sdb`: 527, 545 for IoT/Monitor depending on channel, 550 if the app has no config) | | [`120-dbs-rds-databases-app.yaml`](templates/120-dbs-rds-databases-app.yaml) | dbs-rds-db | | | ✓ | 120 | | [`120-ibm-cognos-analytics-app.yaml`](templates/120-ibm-cognos-analytics-app.yaml) | cognos | ✓ | | | 120 | | [`120-ibm-spark-app.yaml`](templates/120-ibm-spark-app.yaml) | spark | ✓ | | | 120 | diff --git a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml index af8a549bf..2f1eb6591 100644 --- a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml @@ -3,9 +3,44 @@ When inside the range loop below, make sure you prefix any references to chart v For example: {{ $.Values.account.id }} (instead of {{ .Values.account.id }} ) */}} +{{- /* Helper variables to check if app channels are >= 9.2 (same logic as 510-550-ibm-mas-masapp-configs.yaml) */ -}} +{{- $iot_is_v92_or_higher := false -}} +{{- if and .Values.ibm_suite_app_iot_install .Values.ibm_suite_app_iot_install.mas_app_channel -}} + {{- $iot_is_v92_or_higher = regexMatch "^9\\.(2|[3-9]|[1-9][0-9])\\..*" .Values.ibm_suite_app_iot_install.mas_app_channel -}} +{{- end -}} + +{{- $monitor_is_v92_or_higher := false -}} +{{- if and .Values.ibm_suite_app_monitor_install .Values.ibm_suite_app_monitor_install.mas_app_channel -}} + {{- $monitor_is_v92_or_higher = regexMatch "^9\\.(2|[3-9]|[1-9][0-9])\\..*" .Values.ibm_suite_app_monitor_install.mas_app_channel -}} +{{- end -}} + {{- range $i, $value := .Values.ibm_db2u_databases }} {{- if $.Values.application_admin_role }} {{- if not (contains "rds" $value.db2_instance_name) }} +{{- /* +Secondary (sdb) databases sync at the same wave as the config Application of the app they belong to, and a PreSync +hook in the db2u-database chart then waits for that one config Application to be Healthy. This means a slow app only +delays its own sdb; the sdb of every other app proceeds independently. +Manage and all other apps use 527 (the Manage config at 505 has already completed by then, so its gate passes immediately +and the Manage sdb does not hold up the other app installs at 525). IoT and Monitor follow their channel-based config waves. +If the app has no config Application, fall back to wave 550. +*/}} +{{- $_sdb_wave := "550" }} +{{- $_await_app_config_name := "" }} +{{- if contains "sdb" $value.db2_instance_name }} +{{- range $c := $.Values.ibm_mas_masapp_configs }} +{{- if and (eq $_await_app_config_name "") (eq $c.mas_app_id $value.mas_application_id) }} +{{- $_await_app_config_name = printf "%s.%s.%s.%s" $c.mas_workspace_id $c.mas_app_id $.Values.cluster.id $.Values.instance.id }} +{{- if eq $c.mas_app_id "iot" }} +{{- $_sdb_wave = ternary "545" "527" $iot_is_v92_or_higher }} +{{- else if eq $c.mas_app_id "monitor" }} +{{- $_sdb_wave = ternary "527" "545" $monitor_is_v92_or_higher }} +{{- else }} +{{- $_sdb_wave = "527" }} +{{- end }} +{{- end }} +{{- end }} +{{- end }} --- apiVersion: argoproj.io/v1alpha1 kind: Application @@ -22,7 +57,7 @@ metadata: {{ if not (contains "sdb" $value.db2_instance_name) }} argocd.argoproj.io/sync-wave: "120" {{ else }} - argocd.argoproj.io/sync-wave: "550" + argocd.argoproj.io/sync-wave: "{{ $_sdb_wave }}" {{ end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} @@ -71,6 +106,10 @@ spec: {{- end }} {{- end }} should_execute: {{ $_should_execute }} + argo_namespace: "{{ $.Values.argo.namespace }}" + {{- if $_await_app_config_name }} + await_app_config_name: "{{ $_await_app_config_name }}" + {{- end }} junitreporter: reporter_name: db2-db-{{ $.Values.instance.id }}-{{ $value.db2_instance_name | replace (cat "db2wh-" $.Values.instance.id "-" | replace " " "") "" }} cluster_id: "{{ $.Values.cluster.id }}" From fe1682a88a6fadfab1c60e9c5c28bef513eb6656 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 23 Oct 2026 11:11:53 +0530 Subject: [PATCH 11/18] Revert "include presync hook for sdb" This reverts commit a38042c5c5f0c4b8fab31a1636e83930884761dc. --- .../120-ibm-db2u-database/README.md | 9 -- .../00-presync-await-app-config_Job.yaml | 143 ------------------ .../ibm-mas-instance-root/README.md | 4 +- .../templates/120-db2-databases-app.yaml | 41 +---- 4 files changed, 3 insertions(+), 194 deletions(-) delete mode 100644 instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml diff --git a/instance-applications/120-ibm-db2u-database/README.md b/instance-applications/120-ibm-db2u-database/README.md index db56b82fc..b9f489803 100644 --- a/instance-applications/120-ibm-db2u-database/README.md +++ b/instance-applications/120-ibm-db2u-database/README.md @@ -10,8 +10,6 @@ This chart deploys and configures a Db2u database instance for use by a MAS appl Contains a presync hook (`00-presync-await-crd_Job.yaml`) that ensures we wait for the `db2uclusters` CRD to be installed before attempting to sync. -For secondary (`sdb`) databases it also contains a presync hook (`00-presync-await-app-config_Job.yaml`) that waits for the config Application of the owning MAS app (`await_app_config_name`) to be `Healthy`. This makes a slow app delay only its own `sdb`; the `sdb` databases of other apps are not affected. - Contains a job that runs last (`05-postsync-setup-db2_Job.yaml`). This registers the `${ACCOUNT_ID}/${CLUSTER_ID}/${MAS_INSTANCE_ID}/db2/${DB2_INSTANCE_NAME}/config` secret in the **Secrets Vault** used to share some information that is generated at runtime with other ArgoCD Applications. This job also performs some special configuration steps that are required if the Db2u database is intended for use by the Manage MAS Application. ## Resources Created @@ -34,8 +32,6 @@ Contains a job that runs last (`05-postsync-setup-db2_Job.yaml`). This registers | `Secret` | Post-sync DB2 generated secret | DB2 application namespace | Always | `application_admin_role` | | `NetworkPolicy` | HADR network policy | DB2 application namespace | When HADR is enabled | `application_admin_role` | | `Job` | Pre/post-sync DB2 setup jobs | DB2 application namespace | Always | `application_admin_role` | -| `Job` | Presync job awaiting the owning app's config Application | DB2 application namespace | `sdb` instances with `await_app_config_name` set | `application_admin_role` | -| `Role` / `RoleBinding` | Allows the presync service account to `get` the owning app's config Application | ArgoCD namespace | `sdb` instances with `await_app_config_name` set | `application_admin_role` | | `Job` | DB2 audit policy setup job | DB2 application namespace | When `mas_application_id` is `manage`, `facilities`, `monitor`, or `iot` | `application_admin_role` | ## Configuration @@ -53,10 +49,6 @@ db2_node_label: string db2_dedicated_node: string replica_db: string -# Set by ibm-mas-instance-root for sdb instances only -argo_namespace: string # ArgoCD namespace (default: openshift-gitops) -await_app_config_name: string # Name of the ArgoCD config Application of the owning app, e.g. ... - # Instance Registry Configuration db2_instance_registry: key: value @@ -348,7 +340,6 @@ cluster_domain: "" ## Troubleshooting -- **`sdb` sync waiting** — the `presync-await-app-config-` Job waits up to 60 minutes for the app config Application named in `await_app_config_name` to be `Healthy`. Check that Application in ArgoCD. - **Presync job stuck** — verify the `db2uclusters` CRD is installed by the DB2U operator before the ArgoCD sync wave reaches this chart. - **Postsync job failing** — check the job logs in the DB2 namespace; common causes are missing S3 credentials or an unreachable backup bucket. - **Audit CronJob not running** — confirm `db2_backup_bucket_name` is set and the instance name does not contain `sdb` (audit cron is disabled for SDB instances). diff --git a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml b/instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml deleted file mode 100644 index f47a0caed..000000000 --- a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-app-config_Job.yaml +++ /dev/null @@ -1,143 +0,0 @@ -{{- if .Values.application_admin_role }} -{{- /* -Only created for secondary (sdb) databases that belong to an app with a config Application (await_app_config_name is -set by the ibm-mas-instance-root 120-db2-databases-app.yaml template). - -The sdb Application is synced at the same wave as the config Application of its own app. This PreSync hook then holds -the sdb sync until that single config Application is Healthy. As a result a slow or failing app only delays its own -sdb; the sdb of every other app is not affected. -*/}} -{{- if and (contains "sdb" .Values.db2_instance_name) .Values.await_app_config_name }} - -{{- /* -Use the build/bin/set-cli-image-digest.sh script to update this value across all charts. -*/}} -{{- $_cli_image_digest := "sha256:d9b9e5151413d08b79a45a0b657ecf48ae4eee30cb3bc997e6ccba1a8eb8f958" }} -{{- $_argo_namespace := .Values.argo_namespace | default "openshift-gitops" }} - ---- -# Allow the presync service account to read (only) the config Application of the owning app -kind: Role -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: "db2-database-presync-await-app-role-{{ .Values.db2_instance_name }}" - namespace: "{{ $_argo_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -rules: -- apiGroups: - - argoproj.io - resources: - - applications - resourceNames: - - "{{ .Values.await_app_config_name }}" - verbs: - - get - ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: "db2-database-presync-await-app-rb-{{ .Values.db2_instance_name }}" - namespace: "{{ $_argo_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -subjects: - - kind: ServiceAccount - name: "presync-sa-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: "db2-database-presync-await-app-role-{{ .Values.db2_instance_name }}" - ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: "presync-await-app-config-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -spec: - template: -{{- if .Values.custom_labels }} - metadata: - labels: -{{ .Values.custom_labels | toYaml | indent 8 }} -{{- end }} - spec: - containers: - - name: run - image: {{ .Values.cli_image_repo | default "quay.io/ibmmas/cli" }}@{{ $_cli_image_digest }} - imagePullPolicy: IfNotPresent - resources: - limits: - cpu: 200m - memory: 512Mi - requests: - cpu: 10m - memory: 64Mi - env: - - name: ARGO_NAMESPACE - value: "{{ $_argo_namespace }}" - - name: APP_CONFIG_NAME - value: "{{ .Values.await_app_config_name }}" - - name: DB2_INSTANCE_NAME - value: "{{ .Values.db2_instance_name }}" - command: - - /bin/sh - - -c - - | - - set -e - - echo - echo "================================================================================" - echo "PreSync: waiting for the app config Application to be Healthy before syncing ${DB2_INSTANCE_NAME}" - echo "================================================================================" - echo "ArgoCD namespace : ${ARGO_NAMESPACE}" - echo "App config Application: ${APP_CONFIG_NAME}" - echo - - wait_period=0 - while true; do - HEALTH=$(oc get applications.argoproj.io "${APP_CONFIG_NAME}" -n "${ARGO_NAMESPACE}" -o jsonpath='{.status.health.status}' 2>/dev/null || true) - echo "Application ${APP_CONFIG_NAME} health: '${HEALTH}'" - - if [ "${HEALTH}" = "Healthy" ]; then - echo "App config Application is Healthy. Proceeding with the sync of ${DB2_INSTANCE_NAME}." - exit 0 - fi - - wait_period=$(( wait_period + 30 )) - if [ "${wait_period}" -gt 3600 ]; then - echo "Timed out after 60 minutes waiting for ${APP_CONFIG_NAME} to become Healthy." - exit 1 - fi - - echo "Waiting 30 seconds before next check..." - sleep 30 - done - - restartPolicy: Never - serviceAccountName: "presync-sa-{{ .Values.db2_instance_name }}" - volumes: [] - backoffLimit: 0 -{{- end }} -{{- end }} diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index cef692747..d98f8a21a 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -68,7 +68,7 @@ Applications are deployed in the following order (controlled by sync-wave annota - **525**: All other MAS app installs, in parallel (Facilities, Assist, VisualInspection, Health, Optimizer, Predict; IoT and Monitor are version dependent, see below) - **527**: Non-Manage app configs - **540 / 545**: Version-dependent IoT and Monitor install (540) and config (545) waves - - **527 / 545**: Secondary (SDB / standby HADR) Db2 databases sync at the wave of their own app's config (527, or 545 for IoT/Monitor depending on channel; 550 if the app has no config). A presync hook waits for that one app's config Application to be Healthy, so a slow app only delays its own SDB + - **550**: Secondary (SDB / standby HADR) Db2 databases, after all apps - **560**: Addons config 6. **600: RBAC & Post-Sync** - RBAC setup and post-deployment validation @@ -215,7 +215,7 @@ The following table lists all ArgoCD applications defined in the templates folde | [`110-ibm-cp4d-operator-app.yaml`](templates/110-ibm-cp4d-operator-app.yaml) | cp4doperator | ✓ | | | 110 | | [`110-ibm-cs-control-app.yaml`](templates/110-ibm-cs-control-app.yaml) | cscontrol | ✓ | | | 110 | | [`110-ibm-db2u-app.yaml`](templates/110-ibm-db2u-app.yaml) | db2u | ✓ | | | 110 | -| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | 120 (`sdb`: 527, 545 for IoT/Monitor depending on channel, 550 if the app has no config) | +| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | 120 | | [`120-dbs-rds-databases-app.yaml`](templates/120-dbs-rds-databases-app.yaml) | dbs-rds-db | | | ✓ | 120 | | [`120-ibm-cognos-analytics-app.yaml`](templates/120-ibm-cognos-analytics-app.yaml) | cognos | ✓ | | | 120 | | [`120-ibm-spark-app.yaml`](templates/120-ibm-spark-app.yaml) | spark | ✓ | | | 120 | diff --git a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml index 2f1eb6591..af8a549bf 100644 --- a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml @@ -3,44 +3,9 @@ When inside the range loop below, make sure you prefix any references to chart v For example: {{ $.Values.account.id }} (instead of {{ .Values.account.id }} ) */}} -{{- /* Helper variables to check if app channels are >= 9.2 (same logic as 510-550-ibm-mas-masapp-configs.yaml) */ -}} -{{- $iot_is_v92_or_higher := false -}} -{{- if and .Values.ibm_suite_app_iot_install .Values.ibm_suite_app_iot_install.mas_app_channel -}} - {{- $iot_is_v92_or_higher = regexMatch "^9\\.(2|[3-9]|[1-9][0-9])\\..*" .Values.ibm_suite_app_iot_install.mas_app_channel -}} -{{- end -}} - -{{- $monitor_is_v92_or_higher := false -}} -{{- if and .Values.ibm_suite_app_monitor_install .Values.ibm_suite_app_monitor_install.mas_app_channel -}} - {{- $monitor_is_v92_or_higher = regexMatch "^9\\.(2|[3-9]|[1-9][0-9])\\..*" .Values.ibm_suite_app_monitor_install.mas_app_channel -}} -{{- end -}} - {{- range $i, $value := .Values.ibm_db2u_databases }} {{- if $.Values.application_admin_role }} {{- if not (contains "rds" $value.db2_instance_name) }} -{{- /* -Secondary (sdb) databases sync at the same wave as the config Application of the app they belong to, and a PreSync -hook in the db2u-database chart then waits for that one config Application to be Healthy. This means a slow app only -delays its own sdb; the sdb of every other app proceeds independently. -Manage and all other apps use 527 (the Manage config at 505 has already completed by then, so its gate passes immediately -and the Manage sdb does not hold up the other app installs at 525). IoT and Monitor follow their channel-based config waves. -If the app has no config Application, fall back to wave 550. -*/}} -{{- $_sdb_wave := "550" }} -{{- $_await_app_config_name := "" }} -{{- if contains "sdb" $value.db2_instance_name }} -{{- range $c := $.Values.ibm_mas_masapp_configs }} -{{- if and (eq $_await_app_config_name "") (eq $c.mas_app_id $value.mas_application_id) }} -{{- $_await_app_config_name = printf "%s.%s.%s.%s" $c.mas_workspace_id $c.mas_app_id $.Values.cluster.id $.Values.instance.id }} -{{- if eq $c.mas_app_id "iot" }} -{{- $_sdb_wave = ternary "545" "527" $iot_is_v92_or_higher }} -{{- else if eq $c.mas_app_id "monitor" }} -{{- $_sdb_wave = ternary "527" "545" $monitor_is_v92_or_higher }} -{{- else }} -{{- $_sdb_wave = "527" }} -{{- end }} -{{- end }} -{{- end }} -{{- end }} --- apiVersion: argoproj.io/v1alpha1 kind: Application @@ -57,7 +22,7 @@ metadata: {{ if not (contains "sdb" $value.db2_instance_name) }} argocd.argoproj.io/sync-wave: "120" {{ else }} - argocd.argoproj.io/sync-wave: "{{ $_sdb_wave }}" + argocd.argoproj.io/sync-wave: "550" {{ end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} @@ -106,10 +71,6 @@ spec: {{- end }} {{- end }} should_execute: {{ $_should_execute }} - argo_namespace: "{{ $.Values.argo.namespace }}" - {{- if $_await_app_config_name }} - await_app_config_name: "{{ $_await_app_config_name }}" - {{- end }} junitreporter: reporter_name: db2-db-{{ $.Values.instance.id }}-{{ $value.db2_instance_name | replace (cat "db2wh-" $.Values.instance.id "-" | replace " " "") "" }} cluster_id: "{{ $.Values.cluster.id }}" From e0fef99e3a160ca8fcd7b682beac2d58e3db2092 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Mon, 26 Oct 2026 10:19:39 +0530 Subject: [PATCH 12/18] delete 00-presync-await-crd_Job.yaml --- .../templates/00-presync-await-crd_Job.yaml | 147 ------------------ 1 file changed, 147 deletions(-) delete mode 100644 instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml diff --git a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml b/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml deleted file mode 100644 index ed6f35f6c..000000000 --- a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml +++ /dev/null @@ -1,147 +0,0 @@ -{{- if .Values.application_admin_role }} -{{- /* -Use the build/bin/set-cli-image-digest.sh script to update this value across all charts. -*/}} -{{- $_cli_image_digest := "sha256:d9b9e5151413d08b79a45a0b657ecf48ae4eee30cb3bc997e6ccba1a8eb8f958" }} - ---- -# Service account that is authorized to read k8s secrets (needed by the job) -kind: ServiceAccount -apiVersion: v1 -metadata: - name: "presync-sa-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} - - ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: "db2-database-presync-sa-role-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -rules: -- apiGroups: - - db2u.databases.ibm.com - resources: - - db2uinstances - verbs: - - get - - list - - - ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: "db2-database-presync-sa-rb-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -subjects: - - kind: ServiceAccount - name: "presync-sa-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: "db2-database-presync-sa-role-{{ .Values.db2_instance_name }}" - ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: "presync-await-crd-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -spec: - template: -{{- if .Values.custom_labels }} - metadata: - labels: -{{ .Values.custom_labels | toYaml | indent 8 }} -{{- end }} - spec: - containers: - - name: run - image: {{ .Values.cli_image_repo | default "quay.io/ibmmas/cli" }}@{{ $_cli_image_digest }} - imagePullPolicy: IfNotPresent - resources: - limits: - cpu: 200m - memory: 512Mi - requests: - cpu: 10m - memory: 64Mi - env: [] - volumeMounts: [] - command: - - /bin/sh - - -c - - | - - set -e - - - - # Wait for DB2 CRD to be available by checking if we can query the resource - # This approach uses namespace-scoped permissions instead of cluster-scoped CRD access - wait_period=0 - - echo "Waiting for DB2 CRD (db2uinstances) to be available..." - - while true - do - wait_period=$(($wait_period+10)) - if [ $wait_period -gt 300 ];then - echo "DB2 CRD db2uinstances is not ready within 300 seconds, exiting" - exit 1 - fi - - sleep 10 - - # Try to query db2uinstances - if CRD exists, this will succeed (even if no instances exist) - # If CRD doesn't exist, we'll get an error about unknown resource type - if oc get db2uinstances -n {{ .Values.db2_namespace }} --no-headers 2>/dev/null; then - echo "DB2 CRD db2uinstances.db2u.databases.ibm.com is available" - break - fi - - echo "DB2 CRD not yet available, waiting... (${wait_period}s elapsed)" - done - - echo "DB2 CRD is ready" - - restartPolicy: Never - - # TODO: is this the correct SA to use here? - # No, probably want to add a more restricted SA that can just do things that these post-sync jobs need to do - serviceAccountName: "presync-sa-{{ .Values.db2_instance_name }}" - volumes: [] - backoffLimit: 4 -{{- end }} From 1395c7fa7f5b7e369f206ddea9c569e7fa3be544 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Thu, 29 Oct 2026 13:36:16 +0530 Subject: [PATCH 13/18] changes --- docs/orchestration.md | 2 +- .../120-ibm-db2u-database/README.md | 12 +- .../templates/00-presync-await-crd_Job.yaml | 355 ------------------ 3 files changed, 6 insertions(+), 363 deletions(-) delete mode 100644 instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml diff --git a/docs/orchestration.md b/docs/orchestration.md index 60324bbf8..a1bc4c308 100644 --- a/docs/orchestration.md +++ b/docs/orchestration.md @@ -67,7 +67,7 @@ Configuration tasks have to be performed at various points during the MAS synchr ### PreSync Hooks -Jobs that must execute **before** an Application begins syncing are defined as `PreSync` hooks. These are used, for example, to verify that cluster CRDs are present before proceeding with an installation (e.g. {{ gitops_repo_file_link("instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml", "00-presync-await-crd_Job") }}). +Jobs that must execute **before** an Application begins syncing are defined as `PreSync` hooks. These are used, for example, to perform setup before proceeding with an installation (e.g. {{ gitops_repo_file_link("instance-applications/130-ibm-jdbc-config/templates/00-presync-create-db2-user_Job.yaml", "00-presync-create-db2-user_Job") }}). ### PostSync Hooks diff --git a/instance-applications/120-ibm-db2u-database/README.md b/instance-applications/120-ibm-db2u-database/README.md index b1fc1840e..481f79824 100644 --- a/instance-applications/120-ibm-db2u-database/README.md +++ b/instance-applications/120-ibm-db2u-database/README.md @@ -8,18 +8,16 @@ Create a Db2u database for a MAS app. This chart deploys and configures a Db2u database instance for use by a MAS application. It manages the full lifecycle of the database including TLS certificates, storage, backup, audit log extraction, and HADR services. -Contains a presync hook (`00-presync-await-crd_Job.yaml`) that ensures we wait for the `db2uclusters` CRD to be installed before attempting to sync. - -Contains a job that runs last (`05-postsync-setup-db2_Job.yaml`). This registers the `${ACCOUNT_ID}/${CLUSTER_ID}/${MAS_INSTANCE_ID}/db2/${DB2_INSTANCE_NAME}/config` secret in the **Secrets Vault** used to share some information that is generated at runtime with other ArgoCD Applications. This job also performs some special configuration steps that are required if the Db2u database is intended for use by the Manage MAS Application. +Contains a job that runs last (`07-postsync-setup-db2_Job.yaml`). This registers the `${ACCOUNT_ID}/${CLUSTER_ID}/${MAS_INSTANCE_ID}/db2/${DB2_INSTANCE_NAME}/config` secret in the **Secrets Vault** used to share some information that is generated at runtime with other ArgoCD Applications. This job also performs some special configuration steps that are required if the Db2u database is intended for use by the Manage MAS Application. ## Resources Created | Resource Type | Resource Name | Namespace | Condition | Installed By | |--------------|---------------|-----------|-----------|--------------| | `StorageClass` | Db2 storage class definitions | DB2 application namespace / cluster | When storage classes are managed by this chart | `application_admin_role` | -| `ServiceAccount` | Pre/post-sync DB2 job service accounts | DB2 application namespace | Always | `application_admin_role` | -| `Role` | Pre/post-sync DB2 job roles | DB2 application namespace and related namespaces | Always | `application_admin_role` | -| `RoleBinding` | Pre/post-sync DB2 job role bindings | DB2 application namespace and related namespaces | Always | `application_admin_role` | +| `ServiceAccount` | Post-sync DB2 job service accounts | DB2 application namespace | Always | `application_admin_role` | +| `Role` | Post-sync DB2 job roles | DB2 application namespace and related namespaces | Always | `application_admin_role` | +| `RoleBinding` | Post-sync DB2 job role bindings | DB2 application namespace and related namespaces | Always | `application_admin_role` | | `Issuer` | DB2 TLS issuers | DB2 application namespace | Always | `application_admin_role` | | `Certificate` | DB2 TLS certificates | DB2 application namespace | Always | `application_admin_role` | | `Secret` | Db2 license secret | DB2 application namespace | When `db2_license_file` is provided | `application_admin_role` | @@ -32,7 +30,7 @@ Contains a job that runs last (`05-postsync-setup-db2_Job.yaml`). This registers | `Service` | Private NLB service | DB2 application namespace | When `private_nlb.enabled` is true | `application_admin_role` | | `Secret` | Post-sync DB2 generated secret | DB2 application namespace | Always | `application_admin_role` | | `NetworkPolicy` | HADR network policy | DB2 application namespace | When HADR is enabled | `application_admin_role` | -| `Job` | Pre/post-sync DB2 setup jobs | DB2 application namespace | Always | `application_admin_role` | +| `Job` | Post-sync DB2 setup jobs | DB2 application namespace | Always | `application_admin_role` | | `Job` | DB2 audit policy setup job | DB2 application namespace | When `mas_application_id` is `manage`, `facilities`, `monitor`, or `iot` | `application_admin_role` | ## Configuration diff --git a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml b/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml deleted file mode 100644 index 76c216ed5..000000000 --- a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml +++ /dev/null @@ -1,355 +0,0 @@ -{{- if .Values.application_admin_role }} -{{- /* -Use the build/bin/set-cli-image-digest.sh script to update this value across all charts. -*/}} -{{- $_cli_image_digest := "sha256:e6c8f8a02b4bd44026dac280b1d006e60d55e15ee189fce18be7c6922879f8b6" }} - ---- -# Service account that is authorized to read k8s secrets (needed by the job) -kind: ServiceAccount -apiVersion: v1 -metadata: - name: "presync-sa-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} - - ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: "db2-database-presync-sa-role-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -rules: -- apiGroups: - - db2u.databases.ibm.com - resources: - - db2uinstances - verbs: - - get - - list - - patch - - update -- apiGroups: - - "" - resources: - - pods - verbs: - - get - - list -- apiGroups: - - "" - resources: - - pods/exec - verbs: - - create - - get - - list -- apiGroups: - - "" - resources: - - configmaps - verbs: - - create - - get - - list - - update - - patch - - delete - - - ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: "db2-database-presync-sa-rb-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -subjects: - - kind: ServiceAccount - name: "presync-sa-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: "db2-database-presync-sa-role-{{ .Values.db2_instance_name }}" - ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: "presync-await-crd-{{ .Values.db2_instance_name }}" - namespace: "{{ .Values.db2_namespace }}" - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation -{{- if .Values.custom_labels }} - labels: -{{ .Values.custom_labels | toYaml | indent 4 }} -{{- end }} -spec: - template: -{{- if .Values.custom_labels }} - metadata: - labels: -{{ .Values.custom_labels | toYaml | indent 8 }} -{{- end }} - spec: - containers: - - name: run - image: {{ .Values.cli_image_repo | default "quay.io/ibmmas/cli" }}@{{ $_cli_image_digest }} - imagePullPolicy: IfNotPresent - resources: - limits: - cpu: 200m - memory: 512Mi - requests: - cpu: 10m - memory: 64Mi - env: - - name: DB2_NAMESPACE - value: "{{ .Values.db2_namespace }}" - - name: DB2_INSTANCE_NAME - value: "{{ .Values.db2_instance_name }}" - - name: TARGET_DB2_VERSION - value: "{{ .Values.db2_version }}" - - name: REPLICA_DB - value: "{{ .Values.replica_db | default false }}" - - name: DB2_DBNAME - value: "{{ .Values.db2_dbname }}" - volumeMounts: [] - command: - - /bin/sh - - -c - - | - - set -e - - # Wait for DB2 CRD to be available by checking if we can query the resource - # This approach uses namespace-scoped permissions instead of cluster-scoped CRD access - wait_period=0 - - echo "Waiting for DB2 CRD (db2uinstances) to be available..." - - while true - do - wait_period=$(($wait_period+10)) - if [ $wait_period -gt 300 ];then - echo "DB2 CRD db2uinstances is not ready within 300 seconds, exiting" - exit 1 - fi - - sleep 10 - - # Try to query db2uinstances - if CRD exists, this will succeed (even if no instances exist) - # If CRD doesn't exist, we'll get an error about unknown resource type - if oc get db2uinstances -n "${DB2_NAMESPACE}" --no-headers 2>/dev/null; then - echo "DB2 CRD db2uinstances.db2u.databases.ibm.com is available" - break - fi - - echo "DB2 CRD not yet available, waiting... (${wait_period}s elapsed)" - done - echo "DB2 CRD is ready" - - # Check if HADR Primary DB version upgrade is being initiated - if [[ "${DB2_INSTANCE_NAME}" != *"sdb"* ]] && [[ -n "${TARGET_DB2_VERSION}" ]] && [[ "${REPLICA_DB}" == "true" ]]; then - UPGRADE_CM="hadr-upgrade-in-progress-${DB2_INSTANCE_NAME}" - DB_NAME="${DB2_DBNAME:-BLUDB}" - - if oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then - CURRENT_VERSION=$(oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.spec.version}') - echo "Checking Db2 version: Current=${CURRENT_VERSION}, Target=${TARGET_DB2_VERSION}" - - if [[ -n "${CURRENT_VERSION}" ]] && [[ "${CURRENT_VERSION}" != "${TARGET_DB2_VERSION}" ]] && [[ "${TARGET_DB2_VERSION}" == "s12."* || "${TARGET_DB2_VERSION}" == "12."* ]]; then - echo "================================================================================" - echo "HADR Version drift detected. Initiating PreSync upgrade preparation..." - echo "================================================================================" - - # The primary CR is still on the old version, so the primary has not been upgraded. - # Any existing upgrade ConfigMap is stale (left over from a previous failed attempt) - # and must be cleared so the standby does not proceed on stale state. - if oc get configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then - echo "Primary is not upgraded (spec.version=${CURRENT_VERSION}). Clearing stale ConfigMap ${UPGRADE_CM}..." - oc delete configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" --ignore-not-found=true - fi - - # 1. Process Standby-specific pre-upgrade check while HADR is connected - SDB_INSTANCE_NAME="${DB2_INSTANCE_NAME}-sdb" - if oc get db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then - DB_NAME="${DB2_DBNAME:-BLUDB}" - - # Use manage_hadr -status as the authoritative check — this is the same - # command db2ckupgrade uses internally to verify standby role. - # db2pd -hadr can report a stale role even when HADR is not actively running. - echo "Checking if standby pod c-${SDB_INSTANCE_NAME}-db2u-0 is in HADR standby mode (via manage_hadr)..." - STANDBY_HADR_ROLE=$(oc exec -n "${DB2_NAMESPACE}" "c-${SDB_INSTANCE_NAME}-db2u-0" -- su - db2inst1 -c "manage_hadr -status | grep -i hadr_role | awk -F= '{print \$2}' | sed 's/^[[:space:]]*//' | tr -d '\n'" 2>/dev/null || true) - echo "Standby HADR role (manage_hadr): '${STANDBY_HADR_ROLE}'" - - if [[ "${STANDBY_HADR_ROLE}" != "STANDBY" ]]; then - echo "Standby pod is not in standby mode (role='${STANDBY_HADR_ROLE}'). Starting HADR in standby mode..." - oc exec -n "${DB2_NAMESPACE}" "c-${SDB_INSTANCE_NAME}-db2u-0" -- su - db2inst1 -c " - db2stop force || true - db2start - sleep 60 - db2 start hadr on db ${DB_NAME} as standby - " || true - - echo "HADR standby start attempted. Re-checking role via manage_hadr..." - STANDBY_HADR_ROLE=$(oc exec -n "${DB2_NAMESPACE}" "c-${SDB_INSTANCE_NAME}-db2u-0" -- su - db2inst1 -c "manage_hadr -status | grep -i hadr_role | awk -F= '{print \$2}' | sed 's/^[[:space:]]*//' | tr -d '\n'" 2>/dev/null || true) - echo "Standby HADR role after start attempt: '${STANDBY_HADR_ROLE}'" - - if [[ "${STANDBY_HADR_ROLE}" != "STANDBY" ]]; then - echo "ERROR: Standby pod is still not in standby mode after start attempt (role='${STANDBY_HADR_ROLE}'). Cannot proceed with annotation." - exit 1 - fi - else - echo "Standby pod is already in standby mode. Proceeding with annotation." - fi - - # Before annotating the standby CR for the upgrade check, in both pdb and sdb: - # - create a non-empty governor db2.yml - # - stop the wolverine service (wvcli system disable) - for UPGRADE_POD in "c-${DB2_INSTANCE_NAME}-db2u-0" "c-${SDB_INSTANCE_NAME}-db2u-0"; do - echo "Creating governor db2.yml and disabling wolverine on ${UPGRADE_POD}..." - oc exec -n "${DB2_NAMESPACE}" "${UPGRADE_POD}" -- su - db2inst1 -c " - mkdir -p /mnt/blumeta0/home/db2inst1/governor - printf '%s\n' '# Created by gitops for Db2 v11 to v12 upgrade' 'upgrade_in_progress: true' > /mnt/blumeta0/home/db2inst1/governor/db2.yml - wvcli system disable - " || exit $? - done - - MAX_UPGRADE_CHECK_RETRIES=5 - upgrade_check_attempt=0 - while true; do - upgrade_check_attempt=$((upgrade_check_attempt+1)) - echo "Annotating Standby ${SDB_INSTANCE_NAME} with db2ckupgrade_hadr=initialize (attempt ${upgrade_check_attempt}/${MAX_UPGRADE_CHECK_RETRIES})..." - oc annotate db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" \ - db2u.databases.ibm.com/db2ckupgrade_hadr=initialize --overwrite - - echo "Waiting for Standby condition Db2CheckUpgradeHadrSuccess=True..." - check_count=0 - upgrade_check_result="" - while true; do - CHECK_STATUS=$(oc get db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.conditions[?(@.type=="Db2CheckUpgradeHadrSuccess")].status}' 2>/dev/null || true) - if [ "${CHECK_STATUS}" = "True" ]; then - echo "Standby Db2CheckUpgradeHadrSuccess condition is True." - upgrade_check_result="success" - break - fi - CHECK_FAIL=$(oc get db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.conditions[?(@.type=="Db2CheckUpgradeHadrFailure")].status}' 2>/dev/null || true) - if [ "${CHECK_FAIL}" = "True" ]; then - echo "Standby upgrade check reported failure on attempt ${upgrade_check_attempt}/${MAX_UPGRADE_CHECK_RETRIES}." - upgrade_check_result="failure" - break - fi - check_count=$((check_count+1)) - if [ $check_count -gt 30 ]; then - echo "Timeout waiting for Standby Db2CheckUpgradeHadrSuccess after 300s on attempt ${upgrade_check_attempt}/${MAX_UPGRADE_CHECK_RETRIES}." - upgrade_check_result="timeout" - break - fi - echo "... waiting for Db2CheckUpgradeHadrSuccess (attempt ${check_count}/30)..." - sleep 10 - done - - if [ "${upgrade_check_result}" = "success" ]; then - break - fi - - if [ ${upgrade_check_attempt} -ge ${MAX_UPGRADE_CHECK_RETRIES} ]; then - echo "ERROR: Standby upgrade check did not succeed after ${MAX_UPGRADE_CHECK_RETRIES} attempts. Check \${SUPPORTDIR}/db2_upgrade_check.log on standby pod." - exit 1 - fi - - echo "Retrying annotation in 30s..." - sleep 30 - done - echo "Standby upgrade check step finished." - fi - - # 3. Create upgrade state ConfigMap for PostSync jobs - echo "Recording upgrade state in ConfigMap ${UPGRADE_CM}..." - oc create configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" \ - --from-literal=target_version="${TARGET_DB2_VERSION}" \ - --from-literal=primary_upgraded="false" \ - --from-literal=standby_upgraded="false" \ - --from-literal=replica_db="${REPLICA_DB}" \ - --dry-run=client -o yaml | oc apply -f - - echo "PreSync upgrade preparation completed successfully." - else - echo "Db2 version matches target (${TARGET_DB2_VERSION}). No upgrade preparation needed." - fi - fi - fi - - # If running for standby (sdb) during HADR upgrade, wait for primary database upgrade to complete - if [[ "${DB2_INSTANCE_NAME}" == *"sdb"* ]] && [[ "${REPLICA_DB}" == "true" ]] && [[ "${TARGET_DB2_VERSION}" == "s12."* || "${TARGET_DB2_VERSION}" == "12."* ]]; then - PRIMARY_DB2_INSTANCE_NAME=${DB2_INSTANCE_NAME:0:-4} - UPGRADE_CM="hadr-upgrade-in-progress-${PRIMARY_DB2_INSTANCE_NAME}" - - if oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then - CURRENT_VERSION=$(oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.spec.version}') - if [[ -n "${CURRENT_VERSION}" ]] && [[ "${CURRENT_VERSION}" == "s11."* || "${CURRENT_VERSION}" == "11."* ]] && [[ "${TARGET_DB2_VERSION}" == "s12."* || "${TARGET_DB2_VERSION}" == "12."* ]]; then - echo "================================================================================" - echo "Standby HADR upgrade detected (Current=${CURRENT_VERSION}, Target=${TARGET_DB2_VERSION})." - echo "Waiting for Primary DB (${PRIMARY_DB2_INSTANCE_NAME}) upgrade to complete..." - echo "================================================================================" - - wait_count=0 - while true; do - if oc get configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then - PRIMARY_UPGRADED=$(oc get configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" -o jsonpath='{.data.primary_upgraded}' 2>/dev/null || echo "false") - if [[ "${PRIMARY_UPGRADED}" == "true" ]]; then - PRIMARY_SPEC_VERSION=$(oc get db2uinstance "${PRIMARY_DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.spec.version}' 2>/dev/null || true) - PRIMARY_STATUS_VERSION=$(oc get db2uinstance "${PRIMARY_DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.version}' 2>/dev/null || true) - PRIMARY_STATUS_STATE=$(oc get db2uinstance "${PRIMARY_DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.state}' 2>/dev/null || true) - echo "Primary db2uinstance: spec.version=${PRIMARY_SPEC_VERSION}, status.version=${PRIMARY_STATUS_VERSION}, status.state=${PRIMARY_STATUS_STATE} (target=${TARGET_DB2_VERSION})" - if [[ "${PRIMARY_SPEC_VERSION}" == "${TARGET_DB2_VERSION}" && "${PRIMARY_SPEC_VERSION}" == "${PRIMARY_STATUS_VERSION}" && "${PRIMARY_STATUS_STATE}" == "Ready" ]]; then - echo "Primary database upgrade verified (primary_upgraded=true, version=${TARGET_DB2_VERSION}, versions in sync, state=Ready). Proceeding with Standby sync." - break - fi - fi - fi - - wait_count=$((wait_count+1)) - if [ $wait_count -gt 180 ]; then - echo "ERROR: Timeout waiting for Primary database upgrade after 1800s (30m)." - exit 1 - fi - - echo "Waiting for Primary DB upgrade / ConfigMap ${UPGRADE_CM}... (${wait_count}/180 - $((wait_count*10))s elapsed)" - sleep 10 - done - fi - fi - fi - - restartPolicy: Never - - # TODO: is this the correct SA to use here? - # No, probably want to add a more restricted SA that can just do things that these post-sync jobs need to do - serviceAccountName: "presync-sa-{{ .Values.db2_instance_name }}" - volumes: [] - backoffLimit: 4 -{{- end }} From 266d297a16cd65dca262f0b8e2761bc73e329d99 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 30 Oct 2026 16:45:43 +0530 Subject: [PATCH 14/18] update for 00-presync-await-crd --- docs/orchestration.md | 2 +- .../120-ibm-db2u-database/README.md | 14 +- .../templates/00-presync-await-crd_Job.yaml | 355 ++++++++++++++++++ 3 files changed, 364 insertions(+), 7 deletions(-) create mode 100644 instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml diff --git a/docs/orchestration.md b/docs/orchestration.md index a1bc4c308..60324bbf8 100644 --- a/docs/orchestration.md +++ b/docs/orchestration.md @@ -67,7 +67,7 @@ Configuration tasks have to be performed at various points during the MAS synchr ### PreSync Hooks -Jobs that must execute **before** an Application begins syncing are defined as `PreSync` hooks. These are used, for example, to perform setup before proceeding with an installation (e.g. {{ gitops_repo_file_link("instance-applications/130-ibm-jdbc-config/templates/00-presync-create-db2-user_Job.yaml", "00-presync-create-db2-user_Job") }}). +Jobs that must execute **before** an Application begins syncing are defined as `PreSync` hooks. These are used, for example, to verify that cluster CRDs are present before proceeding with an installation (e.g. {{ gitops_repo_file_link("instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml", "00-presync-await-crd_Job") }}). ### PostSync Hooks diff --git a/instance-applications/120-ibm-db2u-database/README.md b/instance-applications/120-ibm-db2u-database/README.md index 577578308..1c59a187c 100644 --- a/instance-applications/120-ibm-db2u-database/README.md +++ b/instance-applications/120-ibm-db2u-database/README.md @@ -8,16 +8,18 @@ Create a Db2u database for a MAS app. This chart deploys and configures a Db2u database instance for use by a MAS application. It manages the full lifecycle of the database including TLS certificates, storage, backup, audit log extraction, and HADR services. -Contains a job that runs last (`07-postsync-setup-db2_Job.yaml`). This registers the `${ACCOUNT_ID}/${CLUSTER_ID}/${MAS_INSTANCE_ID}/db2/${DB2_INSTANCE_NAME}/config` secret in the **Secrets Vault** used to share some information that is generated at runtime with other ArgoCD Applications. This job also performs some special configuration steps that are required if the Db2u database is intended for use by the Manage MAS Application. +Contains a presync hook (`00-presync-await-crd_Job.yaml`) that ensures we wait for the `db2uclusters` CRD to be installed before attempting to sync. + +Contains a job that runs last (`05-postsync-setup-db2_Job.yaml`). This registers the `${ACCOUNT_ID}/${CLUSTER_ID}/${MAS_INSTANCE_ID}/db2/${DB2_INSTANCE_NAME}/config` secret in the **Secrets Vault** used to share some information that is generated at runtime with other ArgoCD Applications. This job also performs some special configuration steps that are required if the Db2u database is intended for use by the Manage MAS Application. ## Resources Created | Resource Type | Resource Name | Namespace | Condition | Installed By | |--------------|---------------|-----------|-----------|--------------| | `StorageClass` | Db2 storage class definitions | DB2 application namespace / cluster | When storage classes are managed by this chart | `application_admin_role` | -| `ServiceAccount` | Post-sync DB2 job service accounts | DB2 application namespace | Always | `application_admin_role` | -| `Role` | Post-sync DB2 job roles | DB2 application namespace and related namespaces | Always | `application_admin_role` | -| `RoleBinding` | Post-sync DB2 job role bindings | DB2 application namespace and related namespaces | Always | `application_admin_role` | +| `ServiceAccount` | Pre/post-sync DB2 job service accounts | DB2 application namespace | Always | `application_admin_role` | +| `Role` | Pre/post-sync DB2 job roles | DB2 application namespace and related namespaces | Always | `application_admin_role` | +| `RoleBinding` | Pre/post-sync DB2 job role bindings | DB2 application namespace and related namespaces | Always | `application_admin_role` | | `Issuer` | DB2 TLS issuers | DB2 application namespace | Always | `application_admin_role` | | `Certificate` | DB2 TLS certificates | DB2 application namespace | Always | `application_admin_role` | | `Secret` | Db2 license secret | DB2 application namespace | When `db2_license_file` is provided | `application_admin_role` | @@ -30,7 +32,7 @@ Contains a job that runs last (`07-postsync-setup-db2_Job.yaml`). This registers | `Service` | Private NLB service | DB2 application namespace | When `private_nlb.enabled` is true | `application_admin_role` | | `Secret` | Post-sync DB2 generated secret | DB2 application namespace | Always | `application_admin_role` | | `NetworkPolicy` | HADR network policy | DB2 application namespace | When HADR is enabled | `application_admin_role` | -| `Job` | Post-sync DB2 setup jobs | DB2 application namespace | Always | `application_admin_role` | +| `Job` | Pre/post-sync DB2 setup jobs | DB2 application namespace | Always | `application_admin_role` | | `Job` | DB2 audit policy setup job | DB2 application namespace | When `mas_application_id` is `manage`, `facilities`, `monitor`, or `iot` | `application_admin_role` | ## Configuration @@ -349,4 +351,4 @@ cluster_domain: "" ## Related Documentation - [Instance Base Values Reference](../../docs/reference/instance-base-values.md) -- [IBM Db2u Operator Documentation](https://www.ibm.com/docs/en/db2/11.5) +- [IBM Db2u Operator Documentation](https://www.ibm.com/docs/en/db2/11.5) \ No newline at end of file diff --git a/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml b/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml new file mode 100644 index 000000000..76c216ed5 --- /dev/null +++ b/instance-applications/120-ibm-db2u-database/templates/00-presync-await-crd_Job.yaml @@ -0,0 +1,355 @@ +{{- if .Values.application_admin_role }} +{{- /* +Use the build/bin/set-cli-image-digest.sh script to update this value across all charts. +*/}} +{{- $_cli_image_digest := "sha256:e6c8f8a02b4bd44026dac280b1d006e60d55e15ee189fce18be7c6922879f8b6" }} + +--- +# Service account that is authorized to read k8s secrets (needed by the job) +kind: ServiceAccount +apiVersion: v1 +metadata: + name: "presync-sa-{{ .Values.db2_instance_name }}" + namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation +{{- if .Values.custom_labels }} + labels: +{{ .Values.custom_labels | toYaml | indent 4 }} +{{- end }} + + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: "db2-database-presync-sa-role-{{ .Values.db2_instance_name }}" + namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation +{{- if .Values.custom_labels }} + labels: +{{ .Values.custom_labels | toYaml | indent 4 }} +{{- end }} +rules: +- apiGroups: + - db2u.databases.ibm.com + resources: + - db2uinstances + verbs: + - get + - list + - patch + - update +- apiGroups: + - "" + resources: + - pods + verbs: + - get + - list +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create + - get + - list +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - get + - list + - update + - patch + - delete + + + +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: "db2-database-presync-sa-rb-{{ .Values.db2_instance_name }}" + namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation +{{- if .Values.custom_labels }} + labels: +{{ .Values.custom_labels | toYaml | indent 4 }} +{{- end }} +subjects: + - kind: ServiceAccount + name: "presync-sa-{{ .Values.db2_instance_name }}" + namespace: "{{ .Values.db2_namespace }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: "db2-database-presync-sa-role-{{ .Values.db2_instance_name }}" + +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: "presync-await-crd-{{ .Values.db2_instance_name }}" + namespace: "{{ .Values.db2_namespace }}" + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded,BeforeHookCreation +{{- if .Values.custom_labels }} + labels: +{{ .Values.custom_labels | toYaml | indent 4 }} +{{- end }} +spec: + template: +{{- if .Values.custom_labels }} + metadata: + labels: +{{ .Values.custom_labels | toYaml | indent 8 }} +{{- end }} + spec: + containers: + - name: run + image: {{ .Values.cli_image_repo | default "quay.io/ibmmas/cli" }}@{{ $_cli_image_digest }} + imagePullPolicy: IfNotPresent + resources: + limits: + cpu: 200m + memory: 512Mi + requests: + cpu: 10m + memory: 64Mi + env: + - name: DB2_NAMESPACE + value: "{{ .Values.db2_namespace }}" + - name: DB2_INSTANCE_NAME + value: "{{ .Values.db2_instance_name }}" + - name: TARGET_DB2_VERSION + value: "{{ .Values.db2_version }}" + - name: REPLICA_DB + value: "{{ .Values.replica_db | default false }}" + - name: DB2_DBNAME + value: "{{ .Values.db2_dbname }}" + volumeMounts: [] + command: + - /bin/sh + - -c + - | + + set -e + + # Wait for DB2 CRD to be available by checking if we can query the resource + # This approach uses namespace-scoped permissions instead of cluster-scoped CRD access + wait_period=0 + + echo "Waiting for DB2 CRD (db2uinstances) to be available..." + + while true + do + wait_period=$(($wait_period+10)) + if [ $wait_period -gt 300 ];then + echo "DB2 CRD db2uinstances is not ready within 300 seconds, exiting" + exit 1 + fi + + sleep 10 + + # Try to query db2uinstances - if CRD exists, this will succeed (even if no instances exist) + # If CRD doesn't exist, we'll get an error about unknown resource type + if oc get db2uinstances -n "${DB2_NAMESPACE}" --no-headers 2>/dev/null; then + echo "DB2 CRD db2uinstances.db2u.databases.ibm.com is available" + break + fi + + echo "DB2 CRD not yet available, waiting... (${wait_period}s elapsed)" + done + echo "DB2 CRD is ready" + + # Check if HADR Primary DB version upgrade is being initiated + if [[ "${DB2_INSTANCE_NAME}" != *"sdb"* ]] && [[ -n "${TARGET_DB2_VERSION}" ]] && [[ "${REPLICA_DB}" == "true" ]]; then + UPGRADE_CM="hadr-upgrade-in-progress-${DB2_INSTANCE_NAME}" + DB_NAME="${DB2_DBNAME:-BLUDB}" + + if oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then + CURRENT_VERSION=$(oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.spec.version}') + echo "Checking Db2 version: Current=${CURRENT_VERSION}, Target=${TARGET_DB2_VERSION}" + + if [[ -n "${CURRENT_VERSION}" ]] && [[ "${CURRENT_VERSION}" != "${TARGET_DB2_VERSION}" ]] && [[ "${TARGET_DB2_VERSION}" == "s12."* || "${TARGET_DB2_VERSION}" == "12."* ]]; then + echo "================================================================================" + echo "HADR Version drift detected. Initiating PreSync upgrade preparation..." + echo "================================================================================" + + # The primary CR is still on the old version, so the primary has not been upgraded. + # Any existing upgrade ConfigMap is stale (left over from a previous failed attempt) + # and must be cleared so the standby does not proceed on stale state. + if oc get configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then + echo "Primary is not upgraded (spec.version=${CURRENT_VERSION}). Clearing stale ConfigMap ${UPGRADE_CM}..." + oc delete configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" --ignore-not-found=true + fi + + # 1. Process Standby-specific pre-upgrade check while HADR is connected + SDB_INSTANCE_NAME="${DB2_INSTANCE_NAME}-sdb" + if oc get db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then + DB_NAME="${DB2_DBNAME:-BLUDB}" + + # Use manage_hadr -status as the authoritative check — this is the same + # command db2ckupgrade uses internally to verify standby role. + # db2pd -hadr can report a stale role even when HADR is not actively running. + echo "Checking if standby pod c-${SDB_INSTANCE_NAME}-db2u-0 is in HADR standby mode (via manage_hadr)..." + STANDBY_HADR_ROLE=$(oc exec -n "${DB2_NAMESPACE}" "c-${SDB_INSTANCE_NAME}-db2u-0" -- su - db2inst1 -c "manage_hadr -status | grep -i hadr_role | awk -F= '{print \$2}' | sed 's/^[[:space:]]*//' | tr -d '\n'" 2>/dev/null || true) + echo "Standby HADR role (manage_hadr): '${STANDBY_HADR_ROLE}'" + + if [[ "${STANDBY_HADR_ROLE}" != "STANDBY" ]]; then + echo "Standby pod is not in standby mode (role='${STANDBY_HADR_ROLE}'). Starting HADR in standby mode..." + oc exec -n "${DB2_NAMESPACE}" "c-${SDB_INSTANCE_NAME}-db2u-0" -- su - db2inst1 -c " + db2stop force || true + db2start + sleep 60 + db2 start hadr on db ${DB_NAME} as standby + " || true + + echo "HADR standby start attempted. Re-checking role via manage_hadr..." + STANDBY_HADR_ROLE=$(oc exec -n "${DB2_NAMESPACE}" "c-${SDB_INSTANCE_NAME}-db2u-0" -- su - db2inst1 -c "manage_hadr -status | grep -i hadr_role | awk -F= '{print \$2}' | sed 's/^[[:space:]]*//' | tr -d '\n'" 2>/dev/null || true) + echo "Standby HADR role after start attempt: '${STANDBY_HADR_ROLE}'" + + if [[ "${STANDBY_HADR_ROLE}" != "STANDBY" ]]; then + echo "ERROR: Standby pod is still not in standby mode after start attempt (role='${STANDBY_HADR_ROLE}'). Cannot proceed with annotation." + exit 1 + fi + else + echo "Standby pod is already in standby mode. Proceeding with annotation." + fi + + # Before annotating the standby CR for the upgrade check, in both pdb and sdb: + # - create a non-empty governor db2.yml + # - stop the wolverine service (wvcli system disable) + for UPGRADE_POD in "c-${DB2_INSTANCE_NAME}-db2u-0" "c-${SDB_INSTANCE_NAME}-db2u-0"; do + echo "Creating governor db2.yml and disabling wolverine on ${UPGRADE_POD}..." + oc exec -n "${DB2_NAMESPACE}" "${UPGRADE_POD}" -- su - db2inst1 -c " + mkdir -p /mnt/blumeta0/home/db2inst1/governor + printf '%s\n' '# Created by gitops for Db2 v11 to v12 upgrade' 'upgrade_in_progress: true' > /mnt/blumeta0/home/db2inst1/governor/db2.yml + wvcli system disable + " || exit $? + done + + MAX_UPGRADE_CHECK_RETRIES=5 + upgrade_check_attempt=0 + while true; do + upgrade_check_attempt=$((upgrade_check_attempt+1)) + echo "Annotating Standby ${SDB_INSTANCE_NAME} with db2ckupgrade_hadr=initialize (attempt ${upgrade_check_attempt}/${MAX_UPGRADE_CHECK_RETRIES})..." + oc annotate db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" \ + db2u.databases.ibm.com/db2ckupgrade_hadr=initialize --overwrite + + echo "Waiting for Standby condition Db2CheckUpgradeHadrSuccess=True..." + check_count=0 + upgrade_check_result="" + while true; do + CHECK_STATUS=$(oc get db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.conditions[?(@.type=="Db2CheckUpgradeHadrSuccess")].status}' 2>/dev/null || true) + if [ "${CHECK_STATUS}" = "True" ]; then + echo "Standby Db2CheckUpgradeHadrSuccess condition is True." + upgrade_check_result="success" + break + fi + CHECK_FAIL=$(oc get db2uinstance "${SDB_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.conditions[?(@.type=="Db2CheckUpgradeHadrFailure")].status}' 2>/dev/null || true) + if [ "${CHECK_FAIL}" = "True" ]; then + echo "Standby upgrade check reported failure on attempt ${upgrade_check_attempt}/${MAX_UPGRADE_CHECK_RETRIES}." + upgrade_check_result="failure" + break + fi + check_count=$((check_count+1)) + if [ $check_count -gt 30 ]; then + echo "Timeout waiting for Standby Db2CheckUpgradeHadrSuccess after 300s on attempt ${upgrade_check_attempt}/${MAX_UPGRADE_CHECK_RETRIES}." + upgrade_check_result="timeout" + break + fi + echo "... waiting for Db2CheckUpgradeHadrSuccess (attempt ${check_count}/30)..." + sleep 10 + done + + if [ "${upgrade_check_result}" = "success" ]; then + break + fi + + if [ ${upgrade_check_attempt} -ge ${MAX_UPGRADE_CHECK_RETRIES} ]; then + echo "ERROR: Standby upgrade check did not succeed after ${MAX_UPGRADE_CHECK_RETRIES} attempts. Check \${SUPPORTDIR}/db2_upgrade_check.log on standby pod." + exit 1 + fi + + echo "Retrying annotation in 30s..." + sleep 30 + done + echo "Standby upgrade check step finished." + fi + + # 3. Create upgrade state ConfigMap for PostSync jobs + echo "Recording upgrade state in ConfigMap ${UPGRADE_CM}..." + oc create configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" \ + --from-literal=target_version="${TARGET_DB2_VERSION}" \ + --from-literal=primary_upgraded="false" \ + --from-literal=standby_upgraded="false" \ + --from-literal=replica_db="${REPLICA_DB}" \ + --dry-run=client -o yaml | oc apply -f - + echo "PreSync upgrade preparation completed successfully." + else + echo "Db2 version matches target (${TARGET_DB2_VERSION}). No upgrade preparation needed." + fi + fi + fi + + # If running for standby (sdb) during HADR upgrade, wait for primary database upgrade to complete + if [[ "${DB2_INSTANCE_NAME}" == *"sdb"* ]] && [[ "${REPLICA_DB}" == "true" ]] && [[ "${TARGET_DB2_VERSION}" == "s12."* || "${TARGET_DB2_VERSION}" == "12."* ]]; then + PRIMARY_DB2_INSTANCE_NAME=${DB2_INSTANCE_NAME:0:-4} + UPGRADE_CM="hadr-upgrade-in-progress-${PRIMARY_DB2_INSTANCE_NAME}" + + if oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then + CURRENT_VERSION=$(oc get db2uinstance "${DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.spec.version}') + if [[ -n "${CURRENT_VERSION}" ]] && [[ "${CURRENT_VERSION}" == "s11."* || "${CURRENT_VERSION}" == "11."* ]] && [[ "${TARGET_DB2_VERSION}" == "s12."* || "${TARGET_DB2_VERSION}" == "12."* ]]; then + echo "================================================================================" + echo "Standby HADR upgrade detected (Current=${CURRENT_VERSION}, Target=${TARGET_DB2_VERSION})." + echo "Waiting for Primary DB (${PRIMARY_DB2_INSTANCE_NAME}) upgrade to complete..." + echo "================================================================================" + + wait_count=0 + while true; do + if oc get configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" >/dev/null 2>&1; then + PRIMARY_UPGRADED=$(oc get configmap "${UPGRADE_CM}" -n "${DB2_NAMESPACE}" -o jsonpath='{.data.primary_upgraded}' 2>/dev/null || echo "false") + if [[ "${PRIMARY_UPGRADED}" == "true" ]]; then + PRIMARY_SPEC_VERSION=$(oc get db2uinstance "${PRIMARY_DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.spec.version}' 2>/dev/null || true) + PRIMARY_STATUS_VERSION=$(oc get db2uinstance "${PRIMARY_DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.version}' 2>/dev/null || true) + PRIMARY_STATUS_STATE=$(oc get db2uinstance "${PRIMARY_DB2_INSTANCE_NAME}" -n "${DB2_NAMESPACE}" -o jsonpath='{.status.state}' 2>/dev/null || true) + echo "Primary db2uinstance: spec.version=${PRIMARY_SPEC_VERSION}, status.version=${PRIMARY_STATUS_VERSION}, status.state=${PRIMARY_STATUS_STATE} (target=${TARGET_DB2_VERSION})" + if [[ "${PRIMARY_SPEC_VERSION}" == "${TARGET_DB2_VERSION}" && "${PRIMARY_SPEC_VERSION}" == "${PRIMARY_STATUS_VERSION}" && "${PRIMARY_STATUS_STATE}" == "Ready" ]]; then + echo "Primary database upgrade verified (primary_upgraded=true, version=${TARGET_DB2_VERSION}, versions in sync, state=Ready). Proceeding with Standby sync." + break + fi + fi + fi + + wait_count=$((wait_count+1)) + if [ $wait_count -gt 180 ]; then + echo "ERROR: Timeout waiting for Primary database upgrade after 1800s (30m)." + exit 1 + fi + + echo "Waiting for Primary DB upgrade / ConfigMap ${UPGRADE_CM}... (${wait_count}/180 - $((wait_count*10))s elapsed)" + sleep 10 + done + fi + fi + fi + + restartPolicy: Never + + # TODO: is this the correct SA to use here? + # No, probably want to add a more restricted SA that can just do things that these post-sync jobs need to do + serviceAccountName: "presync-sa-{{ .Values.db2_instance_name }}" + volumes: [] + backoffLimit: 4 +{{- end }} From 92e7149eb169170a13ed3c41b61b01f4faf273dd Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 6 Nov 2026 00:39:32 +0530 Subject: [PATCH 15/18] prioritise manage PDB (120) -> Manage install (500) -> Manage config (502) -> SDB (504) -> other apps (505+) --- .../ibm-mas-instance-root/README.md | 35 +++++++++---------- .../templates/120-db2-databases-app.yaml | 2 +- ...505-ibm-mas-masapp-facilities-install.yaml | 2 +- .../510-550-ibm-mas-masapp-configs.yaml | 26 +++++++++----- .../510-ibm-mas-masapp-assist-install.yaml | 2 +- .../510-ibm-mas-masapp-iot-install.yaml | 6 ++-- ...m-mas-masapp-visualinspection-install.yaml | 2 +- .../520-ibm-mas-masapp-health-install.yaml | 2 +- .../520-ibm-mas-masapp-monitor-install.yaml | 7 ++-- .../520-ibm-mas-masapp-optimizer-install.yaml | 2 +- .../540-ibm-mas-masapp-predict-install.yaml | 2 +- .../templates/550-ibm-mas-addons-config.yaml | 2 +- 12 files changed, 48 insertions(+), 42 deletions(-) diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index d98f8a21a..f57953e3b 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -61,15 +61,12 @@ Applications are deployed in the following order (controlled by sync-wave annota 2. **100-121: Dependencies** - SLS, Db2, CP4D, databases, and CP4D services 3. **130: MAS Suite** - Core MAS suite installation and configurations 4. **200: Workspaces** - MAS workspace creation -5. **500-560: Applications** - MAS application installations and configurations - - **120** (earlier): Primary Db2/RDS databases of every app, synced before any app +5. **500-551: Applications** - MAS application installations and configurations - **500**: Manage install (highest priority among MAS apps) - - **505**: Manage config - - **525**: All other MAS app installs, in parallel (Facilities, Assist, VisualInspection, Health, Optimizer, Predict; IoT and Monitor are version dependent, see below) - - **527**: Non-Manage app configs - - **540 / 545**: Version-dependent IoT and Monitor install (540) and config (545) waves - - **550**: Secondary (SDB / standby HADR) Db2 databases, after all apps - - **560**: Addons config + - **502**: Manage config + - **504**: Secondary (SDB / standby HADR) Db2 databases, synced right after Manage and before every other app + - **505-550**: Remaining MAS apps in the `main` order (Facilities, Assist, Visual Inspection, IoT, Health, Monitor, Optimizer, Predict); IoT and Monitor order depends on channel (< 9.2 / >= 9.2) + - **551**: Addons config (same as `main`) 6. **600: RBAC & Post-Sync** - RBAC setup and post-deployment validation ## Configuration Files @@ -215,7 +212,7 @@ The following table lists all ArgoCD applications defined in the templates folde | [`110-ibm-cp4d-operator-app.yaml`](templates/110-ibm-cp4d-operator-app.yaml) | cp4doperator | ✓ | | | 110 | | [`110-ibm-cs-control-app.yaml`](templates/110-ibm-cs-control-app.yaml) | cscontrol | ✓ | | | 110 | | [`110-ibm-db2u-app.yaml`](templates/110-ibm-db2u-app.yaml) | db2u | ✓ | | | 110 | -| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | 120 | +| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | 120 (504 for `sdb` instances) | | [`120-dbs-rds-databases-app.yaml`](templates/120-dbs-rds-databases-app.yaml) | dbs-rds-db | | | ✓ | 120 | | [`120-ibm-cognos-analytics-app.yaml`](templates/120-ibm-cognos-analytics-app.yaml) | cognos | ✓ | | | 120 | | [`120-ibm-spark-app.yaml`](templates/120-ibm-spark-app.yaml) | spark | ✓ | | | 120 | @@ -227,16 +224,16 @@ The following table lists all ArgoCD applications defined in the templates folde | [`130-ibm-mas-suite-configs-app.yaml`](templates/130-ibm-mas-suite-configs-app.yaml) | mas_config_name | | ✓ | | 130 | | [`200-ibm-mas-workspaces.yaml`](templates/200-ibm-mas-workspaces.yaml) | workspace | | ✓ | | 200 | | [`500-ibm-mas-masapp-manage-install.yaml`](templates/500-ibm-mas-masapp-manage-install.yaml) | manage | | | ✓ | 500 | -| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 525 | -| [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | 525 | -| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 525 (540 for channel ≥9.2) | -| [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | 525 | -| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 505 (manage), 527 (others); iot 527 (545 for channel ≥9.2); monitor 545 (527 for channel ≥9.2) | -| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 525 | -| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 540 (525 for channel ≥9.2) | -| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 525 | -| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 525 | -| [`550-ibm-mas-addons-config.yaml`](templates/550-ibm-mas-addons-config.yaml) | addons | | ✓ | | 560 | +| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 505 | +| [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | 510 | +| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 510 | +| [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | 510 | +| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 502 (manage), 510-550 (others) | +| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 520 | +| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 520 | +| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 520 | +| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 540 | +| [`550-ibm-mas-addons-config.yaml`](templates/550-ibm-mas-addons-config.yaml) | addons | | ✓ | | 551 | | [`600-application-admin-rbac-app.yaml`](templates/600-application-admin-rbac-app.yaml) | application-admin-rbac | | ✓ | | 600 | | [`600-ibm-post-sync-jobs.yaml`](templates/600-ibm-post-sync-jobs.yaml) | postsyncjobs | | | ✓ | 600 | diff --git a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml index b55d7be66..f7b4726ee 100644 --- a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml @@ -22,7 +22,7 @@ metadata: {{ if not (contains "sdb" $value.db2_instance_name) }} argocd.argoproj.io/sync-wave: "120" {{ else }} - argocd.argoproj.io/sync-wave: "550" + argocd.argoproj.io/sync-wave: "504" {{ end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml index f75872d18..e91627a58 100644 --- a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'facilities' annotations: - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "505" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml index 6611aade9..e50540104 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml @@ -25,22 +25,32 @@ metadata: name: "{{ $value.mas_workspace_id }}.{{ $value.mas_app_id }}.{{ $.Values.cluster.id }}.{{ $.Values.instance.id }}" namespace: {{ $.Values.argo.namespace }} annotations: - {{- if eq $value.mas_app_id "manage" }} - argocd.argoproj.io/sync-wave: "505" + {{- if eq $value.mas_app_id "assist" }} + argocd.argoproj.io/sync-wave: "515" + {{- else if eq $value.mas_app_id "facilities" }} + argocd.argoproj.io/sync-wave: "510" {{- else if eq $value.mas_app_id "iot" }} {{- if $iot_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "545" + argocd.argoproj.io/sync-wave: "530" {{- else }} - argocd.argoproj.io/sync-wave: "527" + argocd.argoproj.io/sync-wave: "515" {{- end }} + {{- else if eq $value.mas_app_id "manage" }} + argocd.argoproj.io/sync-wave: "502" + {{- else if eq $value.mas_app_id "visualinspection" }} + argocd.argoproj.io/sync-wave: "515" + {{- else if eq $value.mas_app_id "health" }} + argocd.argoproj.io/sync-wave: "530" {{- else if eq $value.mas_app_id "monitor" }} {{- if $monitor_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "527" + argocd.argoproj.io/sync-wave: "515" {{- else }} - argocd.argoproj.io/sync-wave: "545" + argocd.argoproj.io/sync-wave: "530" {{- end }} - {{- else }} - argocd.argoproj.io/sync-wave: "527" + {{- else if eq $value.mas_app_id "optimizer" }} + argocd.argoproj.io/sync-wave: "530" + {{- else if eq $value.mas_app_id "predict" }} + argocd.argoproj.io/sync-wave: "550" {{- end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml index d035ba240..9bf8af15d 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'assist' annotations: - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "510" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml index ad1388db4..933b40fcd 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml @@ -1,6 +1,6 @@ {{- if not (empty .Values.ibm_suite_app_iot_install) }} {{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "525" -}} +{{- $syncwave := "510" -}} {{- if .Values.ibm_suite_app_iot_install.mas_app_channel -}} {{- $channel := .Values.ibm_suite_app_iot_install.mas_app_channel | toString -}} {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} @@ -8,9 +8,9 @@ {{- $parts := splitList "." $version -}} {{- $major := index $parts 0 | int -}} {{- $minor := index $parts 1 | int -}} - {{- /* Use sync wave 540 for version >= 9.2, otherwise 525 */ -}} + {{- /* Use sync wave 520 for version >= 9.2, otherwise 510 */ -}} {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "540" -}} + {{- $syncwave = "520" -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml index 3f0f03d17..8ce59205e 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'visualinspection' annotations: - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "510" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml index 14673495d..ccf742f6e 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'health' annotations: - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "520" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml index c74300961..a556d806d 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml @@ -1,7 +1,6 @@ {{- if not (empty .Values.ibm_suite_app_monitor_install) }} {{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "540" -}} -{{- /* Note: the >=9.2 wave (525) intentionally matches Assist install wave */ -}} +{{- $syncwave := "520" -}} {{- if .Values.ibm_suite_app_monitor_install.mas_app_channel -}} {{- $channel := .Values.ibm_suite_app_monitor_install.mas_app_channel | toString -}} {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} @@ -9,9 +8,9 @@ {{- $parts := splitList "." $version -}} {{- $major := index $parts 0 | int -}} {{- $minor := index $parts 1 | int -}} - {{- /* Use sync wave 525 for version >= 9.2 (aligns with Assist), otherwise 540 */ -}} + {{- /* Use sync wave 510 for version >= 9.2, otherwise 520 */ -}} {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "525" -}} + {{- $syncwave = "510" -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml index ea18ae364..7002ec67f 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'optimizer' annotations: - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "520" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml index 233af6781..26c1df86d 100644 --- a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'predict' annotations: - argocd.argoproj.io/sync-wave: "525" + argocd.argoproj.io/sync-wave: "540" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml b/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml index 8db4f0b02..cb179a9c1 100644 --- a/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml +++ b/root-applications/ibm-mas-instance-root/templates/550-ibm-mas-addons-config.yaml @@ -17,7 +17,7 @@ metadata: {{- end }} instance: '{{ .Values.instance.id }}' annotations: - argocd.argoproj.io/sync-wave: "560" + argocd.argoproj.io/sync-wave: "551" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} From 8b0d4013f034575ffcdb8fe2c299b55d06ceecd1 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Fri, 6 Nov 2026 12:56:56 +0530 Subject: [PATCH 16/18] per-app block changes --- .../ibm-mas-instance-root/README.md | 36 ++++++------ .../templates/120-db2-databases-app.yaml | 10 ++-- .../500-ibm-mas-masapp-manage-install.yaml | 2 +- ...505-ibm-mas-masapp-facilities-install.yaml | 2 +- .../510-550-ibm-mas-masapp-configs.yaml | 39 +------------ .../510-ibm-mas-masapp-assist-install.yaml | 2 +- .../510-ibm-mas-masapp-iot-install.yaml | 17 +----- ...m-mas-masapp-visualinspection-install.yaml | 2 +- .../520-ibm-mas-masapp-health-install.yaml | 2 +- .../520-ibm-mas-masapp-monitor-install.yaml | 17 +----- .../520-ibm-mas-masapp-optimizer-install.yaml | 2 +- .../540-ibm-mas-masapp-predict-install.yaml | 2 +- .../templates/_helpers.tpl | 57 +++++++++++++++++++ 13 files changed, 91 insertions(+), 99 deletions(-) create mode 100644 root-applications/ibm-mas-instance-root/templates/_helpers.tpl diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index f57953e3b..e0bfc0e41 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -61,12 +61,14 @@ Applications are deployed in the following order (controlled by sync-wave annota 2. **100-121: Dependencies** - SLS, Db2, CP4D, databases, and CP4D services 3. **130: MAS Suite** - Core MAS suite installation and configurations 4. **200: Workspaces** - MAS workspace creation -5. **500-551: Applications** - MAS application installations and configurations - - **500**: Manage install (highest priority among MAS apps) - - **502**: Manage config - - **504**: Secondary (SDB / standby HADR) Db2 databases, synced right after Manage and before every other app - - **505-550**: Remaining MAS apps in the `main` order (Facilities, Assist, Visual Inspection, IoT, Health, Monitor, Optimizer, Predict); IoT and Monitor order depends on channel (< 9.2 / >= 9.2) - - **551**: Addons config (same as `main`) +5. **500-551: Applications** - each MAS app is deployed as a contiguous block: primary Db2 (PDB) -> app install -> app workspace config -> standby Db2 (SDB). Waves are computed by the `ibm-mas-instance-root.syncwave` helper in [`_helpers.tpl`](templates/_helpers.tpl). + - **Manage**: PDB `120`, install `501`, workspace config `502`, SDB `503` + - **Facilities**: PDB `505`, install `506`, workspace config `507`, SDB `508` + - **Monitor / IoT**: Monitor then IoT when the Monitor or IoT channel is >= 9.2 (Monitor `510`-`513`, IoT `516`-`517`); otherwise IoT then Monitor (IoT `511`-`512`, Monitor `515`-`518`) + - **Health**: install `521`, workspace config `522` + - **Assist**: install `526`; **Visual Inspection**: install `531`; **Optimizer**: install `536` + - **Predict**: install `541`, workspace config `542` + - **551**: Addons config 6. **600: RBAC & Post-Sync** - RBAC setup and post-deployment validation ## Configuration Files @@ -212,7 +214,7 @@ The following table lists all ArgoCD applications defined in the templates folde | [`110-ibm-cp4d-operator-app.yaml`](templates/110-ibm-cp4d-operator-app.yaml) | cp4doperator | ✓ | | | 110 | | [`110-ibm-cs-control-app.yaml`](templates/110-ibm-cs-control-app.yaml) | cscontrol | ✓ | | | 110 | | [`110-ibm-db2u-app.yaml`](templates/110-ibm-db2u-app.yaml) | db2u | ✓ | | | 110 | -| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | 120 (504 for `sdb` instances) | +| [`120-db2-databases-app.yaml`](templates/120-db2-databases-app.yaml) | db2-db | | ✓ | | Per app block, see Deployment Sequence (PDB first, SDB after the workspace config) | | [`120-dbs-rds-databases-app.yaml`](templates/120-dbs-rds-databases-app.yaml) | dbs-rds-db | | | ✓ | 120 | | [`120-ibm-cognos-analytics-app.yaml`](templates/120-ibm-cognos-analytics-app.yaml) | cognos | ✓ | | | 120 | | [`120-ibm-spark-app.yaml`](templates/120-ibm-spark-app.yaml) | spark | ✓ | | | 120 | @@ -223,16 +225,16 @@ The following table lists all ArgoCD applications defined in the templates folde | [`130-ibm-mas-suite-app.yaml`](templates/130-ibm-mas-suite-app.yaml) | suite | | | ✓ | 130 | | [`130-ibm-mas-suite-configs-app.yaml`](templates/130-ibm-mas-suite-configs-app.yaml) | mas_config_name | | ✓ | | 130 | | [`200-ibm-mas-workspaces.yaml`](templates/200-ibm-mas-workspaces.yaml) | workspace | | ✓ | | 200 | -| [`500-ibm-mas-masapp-manage-install.yaml`](templates/500-ibm-mas-masapp-manage-install.yaml) | manage | | | ✓ | 500 | -| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | 505 | -| [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | 510 | -| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | 510 | -| [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | 510 | -| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | 502 (manage), 510-550 (others) | -| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | 520 | -| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | 520 | -| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | 520 | -| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | 540 | +| [`500-ibm-mas-masapp-manage-install.yaml`](templates/500-ibm-mas-masapp-manage-install.yaml) | manage | | | ✓ | Per app block, see Deployment Sequence | +| [`505-ibm-mas-masapp-facilities-install.yaml`](templates/505-ibm-mas-masapp-facilities-install.yaml) | facilities | | | ✓ | Per app block, see Deployment Sequence | +| [`510-ibm-mas-masapp-assist-install.yaml`](templates/510-ibm-mas-masapp-assist-install.yaml) | assist | | | ✓ | Per app block, see Deployment Sequence | +| [`510-ibm-mas-masapp-iot-install.yaml`](templates/510-ibm-mas-masapp-iot-install.yaml) | iot | | | ✓ | Per app block, see Deployment Sequence | +| [`510-ibm-mas-masapp-visualinspection-install.yaml`](templates/510-ibm-mas-masapp-visualinspection-install.yaml) | visualinspection | | | ✓ | Per app block, see Deployment Sequence | +| [`510-550-ibm-mas-masapp-configs.yaml`](templates/510-550-ibm-mas-masapp-configs.yaml) | masapp-config | | ✓ | | Per app block, see Deployment Sequence | +| [`520-ibm-mas-masapp-health-install.yaml`](templates/520-ibm-mas-masapp-health-install.yaml) | health | | | ✓ | Per app block, see Deployment Sequence | +| [`520-ibm-mas-masapp-monitor-install.yaml`](templates/520-ibm-mas-masapp-monitor-install.yaml) | monitor | | | ✓ | Per app block, see Deployment Sequence | +| [`520-ibm-mas-masapp-optimizer-install.yaml`](templates/520-ibm-mas-masapp-optimizer-install.yaml) | optimizer | | | ✓ | Per app block, see Deployment Sequence | +| [`540-ibm-mas-masapp-predict-install.yaml`](templates/540-ibm-mas-masapp-predict-install.yaml) | predict | | | ✓ | Per app block, see Deployment Sequence | | [`550-ibm-mas-addons-config.yaml`](templates/550-ibm-mas-addons-config.yaml) | addons | | ✓ | | 551 | | [`600-application-admin-rbac-app.yaml`](templates/600-application-admin-rbac-app.yaml) | application-admin-rbac | | ✓ | | 600 | | [`600-ibm-post-sync-jobs.yaml`](templates/600-ibm-post-sync-jobs.yaml) | postsyncjobs | | | ✓ | 600 | diff --git a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml index f7b4726ee..2e1a8e444 100644 --- a/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/120-db2-databases-app.yaml @@ -19,11 +19,11 @@ metadata: instance: '{{ $.Values.instance.id }}' appId: '{{ $value.mas_application_id }}' annotations: -{{ if not (contains "sdb" $value.db2_instance_name) }} - argocd.argoproj.io/sync-wave: "120" -{{ else }} - argocd.argoproj.io/sync-wave: "504" -{{ end }} +{{- if not (contains "sdb" $value.db2_instance_name) }} + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" $value.mas_application_id "step" "pdb") }}" +{{- else }} + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" $value.mas_application_id "step" "sdb") }}" +{{- end }} {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/500-ibm-mas-masapp-manage-install.yaml b/root-applications/ibm-mas-instance-root/templates/500-ibm-mas-masapp-manage-install.yaml index b810ecf47..6b7a112e4 100644 --- a/root-applications/ibm-mas-instance-root/templates/500-ibm-mas-masapp-manage-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/500-ibm-mas-masapp-manage-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'manage' annotations: - argocd.argoproj.io/sync-wave: "500" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "manage" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml index e91627a58..9ce4db23c 100644 --- a/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/505-ibm-mas-masapp-facilities-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'facilities' annotations: - argocd.argoproj.io/sync-wave: "505" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "facilities" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml index e50540104..ca2ec78e8 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-550-ibm-mas-masapp-configs.yaml @@ -5,17 +5,6 @@ For example: {{ $.Values.account.id }} (instead of {{ .Values.account.id }} ) {{ $app_dest_ns := printf "mas-%s-core" .Values.instance.id }} -{{- /* Helper variables to check if app versions are >= 9.2 */ -}} -{{- $iot_is_v92_or_higher := false -}} -{{- if and .Values.ibm_suite_app_iot_install .Values.ibm_suite_app_iot_install.mas_app_channel -}} - {{- $iot_is_v92_or_higher = regexMatch "^9\\.(2|[3-9]|[1-9][0-9])\\..*" .Values.ibm_suite_app_iot_install.mas_app_channel -}} -{{- end -}} - -{{- $monitor_is_v92_or_higher := false -}} -{{- if and .Values.ibm_suite_app_monitor_install .Values.ibm_suite_app_monitor_install.mas_app_channel -}} - {{- $monitor_is_v92_or_higher = regexMatch "^9\\.(2|[3-9]|[1-9][0-9])\\..*" .Values.ibm_suite_app_monitor_install.mas_app_channel -}} -{{- end -}} - {{- range $i, $value := .Values.ibm_mas_masapp_configs }} {{- if $.Values.application_admin_role }} --- @@ -25,33 +14,7 @@ metadata: name: "{{ $value.mas_workspace_id }}.{{ $value.mas_app_id }}.{{ $.Values.cluster.id }}.{{ $.Values.instance.id }}" namespace: {{ $.Values.argo.namespace }} annotations: - {{- if eq $value.mas_app_id "assist" }} - argocd.argoproj.io/sync-wave: "515" - {{- else if eq $value.mas_app_id "facilities" }} - argocd.argoproj.io/sync-wave: "510" - {{- else if eq $value.mas_app_id "iot" }} - {{- if $iot_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "530" - {{- else }} - argocd.argoproj.io/sync-wave: "515" - {{- end }} - {{- else if eq $value.mas_app_id "manage" }} - argocd.argoproj.io/sync-wave: "502" - {{- else if eq $value.mas_app_id "visualinspection" }} - argocd.argoproj.io/sync-wave: "515" - {{- else if eq $value.mas_app_id "health" }} - argocd.argoproj.io/sync-wave: "530" - {{- else if eq $value.mas_app_id "monitor" }} - {{- if $monitor_is_v92_or_higher }} - argocd.argoproj.io/sync-wave: "515" - {{- else }} - argocd.argoproj.io/sync-wave: "530" - {{- end }} - {{- else if eq $value.mas_app_id "optimizer" }} - argocd.argoproj.io/sync-wave: "530" - {{- else if eq $value.mas_app_id "predict" }} - argocd.argoproj.io/sync-wave: "550" - {{- end }} + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" $value.mas_app_id "step" "config") }}" {{- if and $.Values.notifications $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ $.Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ $.Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml index 9bf8af15d..6de89bcb1 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-assist-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'assist' annotations: - argocd.argoproj.io/sync-wave: "510" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "assist" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml index 933b40fcd..eba9be7b0 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-iot-install.yaml @@ -1,19 +1,4 @@ {{- if not (empty .Values.ibm_suite_app_iot_install) }} -{{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "510" -}} -{{- if .Values.ibm_suite_app_iot_install.mas_app_channel -}} - {{- $channel := .Values.ibm_suite_app_iot_install.mas_app_channel | toString -}} - {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} - {{- if $version -}} - {{- $parts := splitList "." $version -}} - {{- $major := index $parts 0 | int -}} - {{- $minor := index $parts 1 | int -}} - {{- /* Use sync wave 520 for version >= 9.2, otherwise 510 */ -}} - {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "520" -}} - {{- end -}} - {{- end -}} -{{- end -}} --- # IBM Maximo Operator Catalog apiVersion: argoproj.io/v1alpha1 @@ -31,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'iot' annotations: - argocd.argoproj.io/sync-wave: "{{ $syncwave }}" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "iot" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml index 8ce59205e..acf00e70a 100644 --- a/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/510-ibm-mas-masapp-visualinspection-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'visualinspection' annotations: - argocd.argoproj.io/sync-wave: "510" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "visualinspection" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml index ccf742f6e..35dd9cd3f 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-health-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'health' annotations: - argocd.argoproj.io/sync-wave: "520" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "health" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml index a556d806d..41f297536 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-monitor-install.yaml @@ -1,19 +1,4 @@ {{- if not (empty .Values.ibm_suite_app_monitor_install) }} -{{- /* Calculate sync wave based on mas_app_channel version */ -}} -{{- $syncwave := "520" -}} -{{- if .Values.ibm_suite_app_monitor_install.mas_app_channel -}} - {{- $channel := .Values.ibm_suite_app_monitor_install.mas_app_channel | toString -}} - {{- $version := regexFind `^[0-9]+\.[0-9]+` $channel -}} - {{- if $version -}} - {{- $parts := splitList "." $version -}} - {{- $major := index $parts 0 | int -}} - {{- $minor := index $parts 1 | int -}} - {{- /* Use sync wave 510 for version >= 9.2, otherwise 520 */ -}} - {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} - {{- $syncwave = "510" -}} - {{- end -}} - {{- end -}} -{{- end -}} --- # IBM Maximo Operator Catalog apiVersion: argoproj.io/v1alpha1 @@ -31,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'monitor' annotations: - argocd.argoproj.io/sync-wave: "{{ $syncwave }}" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "monitor" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml index 7002ec67f..22538ecab 100644 --- a/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/520-ibm-mas-masapp-optimizer-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'optimizer' annotations: - argocd.argoproj.io/sync-wave: "520" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "optimizer" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml index 26c1df86d..4cf6006c8 100644 --- a/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml +++ b/root-applications/ibm-mas-instance-root/templates/540-ibm-mas-masapp-predict-install.yaml @@ -16,7 +16,7 @@ metadata: instance: '{{ .Values.instance.id }}' masapp: 'predict' annotations: - argocd.argoproj.io/sync-wave: "540" + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" "predict" "step" "install") }}" {{- if and .Values.notifications .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }} notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }} diff --git a/root-applications/ibm-mas-instance-root/templates/_helpers.tpl b/root-applications/ibm-mas-instance-root/templates/_helpers.tpl new file mode 100644 index 000000000..4583bf014 --- /dev/null +++ b/root-applications/ibm-mas-instance-root/templates/_helpers.tpl @@ -0,0 +1,57 @@ +{{- /* +Returns the ArgoCD sync-wave for one step of a MAS application's "block". + +Each MAS application is deployed as a contiguous block, in this order: + pdb -> primary Db2 database (non-sdb instance) + install -> MAS application install + config -> MAS application workspace config (e.g. ManageWorkspace) + sdb -> standby Db2 database (sdb instance) +Blocks are ordered: manage, facilities, monitor/iot, health, assist, visualinspection, optimizer, predict. +Addons config (551) and RBAC / post-sync jobs (600) run after all blocks. + +Block base waves (pdb = base, install = base+1, config = base+2, sdb = base+3): + manage 500 (its pdb stays at 120 so it is ready ahead of the suite and workspaces), + facilities 505, monitor/iot 510 then 515, health 520, assist 525, visualinspection 530, + optimizer 535, predict 540 + +Monitor/iot keep the channel-aware order used on main: when the Monitor or IoT channel is >= 9.2, +Monitor goes first (510) and IoT second (515), otherwise IoT first (510) and Monitor second (515). + +Arguments (dict): root = chart root context ($), app = mas app id, step = pdb|install|config|sdb +For an app without a block: pdb returns 120, sdb returns 549 and install/config return nothing. +*/}} +{{- define "ibm-mas-instance-root.syncwave" -}} +{{- $app := .app | default "" -}} +{{- $monitorFirst := false -}} +{{- range $cfg := list .root.Values.ibm_suite_app_monitor_install .root.Values.ibm_suite_app_iot_install -}} + {{- if and $cfg $cfg.mas_app_channel -}} + {{- $version := regexFind `^[0-9]+\.[0-9]+` ($cfg.mas_app_channel | toString) -}} + {{- if $version -}} + {{- $parts := splitList "." $version -}} + {{- $major := index $parts 0 | int -}} + {{- $minor := index $parts 1 | int -}} + {{- if or (gt $major 9) (and (eq $major 9) (ge $minor 2)) -}} + {{- $monitorFirst = true -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- $bases := dict "manage" 500 "facilities" 505 "health" 520 "assist" 525 "visualinspection" 530 "optimizer" 535 "predict" 540 -}} +{{- if $monitorFirst -}} + {{- $_ := set $bases "monitor" 510 -}} + {{- $_ := set $bases "iot" 515 -}} +{{- else -}} + {{- $_ := set $bases "iot" 510 -}} + {{- $_ := set $bases "monitor" 515 -}} +{{- end -}} +{{- $offsets := dict "pdb" 0 "install" 1 "config" 2 "sdb" 3 -}} +{{- if and (eq $app "manage") (eq .step "pdb") -}} +120 +{{- else if hasKey $bases $app -}} +{{ add (get $bases $app) (get $offsets .step) }} +{{- else if eq .step "pdb" -}} +120 +{{- else if eq .step "sdb" -}} +549 +{{- end -}} +{{- end -}} From 9e59b06b8abf8a57efa668cf8c4743e9192399d8 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Sat, 7 Nov 2026 01:26:02 +0530 Subject: [PATCH 17/18] update 130-ibm-mas-suite-configs-app.yaml --- .../templates/130-ibm-mas-suite-configs-app.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml b/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml index 4e3d84ec8..d922496fc 100644 --- a/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml @@ -21,6 +21,9 @@ metadata: annotations: {{- if eq $value.mas_config_chart "ibm-mas-aicfg-config" }} argocd.argoproj.io/sync-wave: "190" + {{- else if and (eq $value.mas_config_chart "ibm-jdbc-config") (eq ($value.jdbc_type | default "") "incluster-db2") (not (empty $value.mas_application_id)) (ne $value.mas_application_id "manage") }} + {{- /* In-cluster Db2 JDBC config reads secrets written by the app's Db2 post-sync job, so it must sync after that app's PDB (install wave = PDB + 1). Manage PDB is at 120, so Manage stays at 130. */}} + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" $value.mas_application_id "step" "install") | default "130" }}" {{- else }} argocd.argoproj.io/sync-wave: "130" {{- end }} From 91309d2ebe66070cad3b302277c7bd40ae1aac72 Mon Sep 17 00:00:00 2001 From: Sagar-Talikoti Date: Sat, 7 Nov 2026 01:31:48 +0530 Subject: [PATCH 18/18] update --- root-applications/ibm-mas-instance-root/README.md | 14 +++++++------- .../templates/130-ibm-mas-suite-configs-app.yaml | 4 ++-- .../ibm-mas-instance-root/templates/_helpers.tpl | 9 +++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/root-applications/ibm-mas-instance-root/README.md b/root-applications/ibm-mas-instance-root/README.md index e0bfc0e41..83ef6c162 100644 --- a/root-applications/ibm-mas-instance-root/README.md +++ b/root-applications/ibm-mas-instance-root/README.md @@ -61,13 +61,13 @@ Applications are deployed in the following order (controlled by sync-wave annota 2. **100-121: Dependencies** - SLS, Db2, CP4D, databases, and CP4D services 3. **130: MAS Suite** - Core MAS suite installation and configurations 4. **200: Workspaces** - MAS workspace creation -5. **500-551: Applications** - each MAS app is deployed as a contiguous block: primary Db2 (PDB) -> app install -> app workspace config -> standby Db2 (SDB). Waves are computed by the `ibm-mas-instance-root.syncwave` helper in [`_helpers.tpl`](templates/_helpers.tpl). - - **Manage**: PDB `120`, install `501`, workspace config `502`, SDB `503` - - **Facilities**: PDB `505`, install `506`, workspace config `507`, SDB `508` - - **Monitor / IoT**: Monitor then IoT when the Monitor or IoT channel is >= 9.2 (Monitor `510`-`513`, IoT `516`-`517`); otherwise IoT then Monitor (IoT `511`-`512`, Monitor `515`-`518`) - - **Health**: install `521`, workspace config `522` - - **Assist**: install `526`; **Visual Inspection**: install `531`; **Optimizer**: install `536` - - **Predict**: install `541`, workspace config `542` +5. **500-551: Applications** - each MAS app is deployed as a contiguous block: primary Db2 (PDB) -> in-cluster Db2 JDBC config -> app install -> app workspace config -> standby Db2 (SDB). Waves are computed by the `ibm-mas-instance-root.syncwave` helper in [`_helpers.tpl`](templates/_helpers.tpl). The JDBC config (`130-ibm-mas-suite-configs-app.yaml`) moves into the block only for in-cluster Db2 of non-Manage apps; otherwise it stays at `130`. + - **Manage**: PDB `120`, install `502`, workspace config `503`, SDB `504` (JDBC config stays at `130`) + - **Facilities**: PDB `505`, JDBC `506`, install `507`, workspace config `508`, SDB `509` + - **Monitor / IoT**: Monitor then IoT when the Monitor or IoT channel is >= 9.2 (Monitor `510`-`514`, IoT `515`-`519`); otherwise IoT then Monitor (IoT `510`-`514`, Monitor `515`-`519`) + - **Health**: PDB `520`, JDBC `521`, install `522`, workspace config `523`, SDB `524` + - **Assist**: `525`-`529`; **Visual Inspection**: `530`-`534`; **Optimizer**: `535`-`539` + - **Predict**: PDB `540`, JDBC `541`, install `542`, workspace config `543`, SDB `544` - **551**: Addons config 6. **600: RBAC & Post-Sync** - RBAC setup and post-deployment validation diff --git a/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml b/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml index d922496fc..1f64fc922 100644 --- a/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml +++ b/root-applications/ibm-mas-instance-root/templates/130-ibm-mas-suite-configs-app.yaml @@ -22,8 +22,8 @@ metadata: {{- if eq $value.mas_config_chart "ibm-mas-aicfg-config" }} argocd.argoproj.io/sync-wave: "190" {{- else if and (eq $value.mas_config_chart "ibm-jdbc-config") (eq ($value.jdbc_type | default "") "incluster-db2") (not (empty $value.mas_application_id)) (ne $value.mas_application_id "manage") }} - {{- /* In-cluster Db2 JDBC config reads secrets written by the app's Db2 post-sync job, so it must sync after that app's PDB (install wave = PDB + 1). Manage PDB is at 120, so Manage stays at 130. */}} - argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" $value.mas_application_id "step" "install") | default "130" }}" + {{- /* In-cluster Db2 JDBC config reads secrets written by the app's Db2 post-sync job, so it must sync after that app's PDB and before the app install (jdbc wave = PDB + 1, install = PDB + 2). Manage PDB is at 120, so Manage stays at 130. */}} + argocd.argoproj.io/sync-wave: "{{ include "ibm-mas-instance-root.syncwave" (dict "root" $ "app" $value.mas_application_id "step" "jdbc") | default "130" }}" {{- else }} argocd.argoproj.io/sync-wave: "130" {{- end }} diff --git a/root-applications/ibm-mas-instance-root/templates/_helpers.tpl b/root-applications/ibm-mas-instance-root/templates/_helpers.tpl index 4583bf014..1a162b657 100644 --- a/root-applications/ibm-mas-instance-root/templates/_helpers.tpl +++ b/root-applications/ibm-mas-instance-root/templates/_helpers.tpl @@ -3,13 +3,14 @@ Returns the ArgoCD sync-wave for one step of a MAS application's "block". Each MAS application is deployed as a contiguous block, in this order: pdb -> primary Db2 database (non-sdb instance) + jdbc -> in-cluster Db2 JDBC config (JdbcCfg) of the app, so it exists before the app install install -> MAS application install config -> MAS application workspace config (e.g. ManageWorkspace) sdb -> standby Db2 database (sdb instance) Blocks are ordered: manage, facilities, monitor/iot, health, assist, visualinspection, optimizer, predict. Addons config (551) and RBAC / post-sync jobs (600) run after all blocks. -Block base waves (pdb = base, install = base+1, config = base+2, sdb = base+3): +Block base waves (pdb = base, jdbc = base+1, install = base+2, config = base+3, sdb = base+4): manage 500 (its pdb stays at 120 so it is ready ahead of the suite and workspaces), facilities 505, monitor/iot 510 then 515, health 520, assist 525, visualinspection 530, optimizer 535, predict 540 @@ -17,8 +18,8 @@ Block base waves (pdb = base, install = base+1, config = base+2, sdb = base+3): Monitor/iot keep the channel-aware order used on main: when the Monitor or IoT channel is >= 9.2, Monitor goes first (510) and IoT second (515), otherwise IoT first (510) and Monitor second (515). -Arguments (dict): root = chart root context ($), app = mas app id, step = pdb|install|config|sdb -For an app without a block: pdb returns 120, sdb returns 549 and install/config return nothing. +Arguments (dict): root = chart root context ($), app = mas app id, step = pdb|jdbc|install|config|sdb +For an app without a block: pdb returns 120, sdb returns 549 and jdbc/install/config return nothing. */}} {{- define "ibm-mas-instance-root.syncwave" -}} {{- $app := .app | default "" -}} @@ -44,7 +45,7 @@ For an app without a block: pdb returns 120, sdb returns 549 and install/config {{- $_ := set $bases "iot" 510 -}} {{- $_ := set $bases "monitor" 515 -}} {{- end -}} -{{- $offsets := dict "pdb" 0 "install" 1 "config" 2 "sdb" 3 -}} +{{- $offsets := dict "pdb" 0 "jdbc" 1 "install" 2 "config" 3 "sdb" 4 -}} {{- if and (eq $app "manage") (eq .step "pdb") -}} 120 {{- else if hasKey $bases $app -}}