Skip to content

Commit

Permalink
Avoid jmx usage in zero downtime upgrade orchestration process (#532)
Browse files Browse the repository at this point in the history
* avoid jmx usage and leverage prpcServiceUtils for pre/post upgrade actions

* support only upgrade-deploy for zero-downtime

* Use valid UpgradeType for the UpgradeAction being performed in tests

* add testing for ZDT rest settings

---------

Co-authored-by: degah <[email protected]>
Co-authored-by: walsd1 <[email protected]>
  • Loading branch information
3 people authored Mar 6, 2023
1 parent e110e9d commit bf406d2
Show file tree
Hide file tree
Showing 20 changed files with 140 additions and 105 deletions.
1 change: 1 addition & 0 deletions charts/pega/charts/installer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{{- define "pegaDBOOPRulesUpgrade" -}}pega-db-ooprules-upgrade{{- end -}}
{{- define "pegaDBOOPDataUpgrade" -}}pega-db-oopdata-upgrade{{- end -}}
{{- define "pegaDBZDTUpgrade" -}}pega-zdt-upgrade{{- end -}}
{{- define "pegaDBOOPUpgrade" -}}pega-db-oop-upgrade{{- end -}}
{{- define "pegaDBInPlaceUpgrade" -}}pega-in-place-upgrade{{- end -}}
{{- define "installerConfig" -}}installer-config{{- end -}}
{{- define "installerJobReaderRole" -}}jobs-reader{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- if (eq (include "performOnlyUpgrade" .) "true") }}
{{- $validUpgradeType := list "in-place" "out-of-place" "zero-downtime" "custom" "out-of-place-rules" "out-of-place-data"}}
{{- $validUpgradeType := list "in-place" "out-of-place" "custom" "out-of-place-rules" "out-of-place-data"}}
{{- if not (has .Values.upgrade.upgradeType $validUpgradeType) }}
{{- fail "Upgrade Type value is not correct for upgrade action. The valid values are 'in-place' 'out-of-place' 'zero-downtime' 'custom' 'out-of-place-rules' 'out-of-place-data' " }}
{{- fail "Upgrade Type value is not correct for upgrade action. The valid values are 'in-place' 'out-of-place' 'custom' 'out-of-place-rules' 'out-of-place-data' " }}
{{- end }}
{{- end }}
{{- if (eq (include "performUpgradeAndDeployment" .) "true") }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
{{ template "pega.installer" dict "root" $ "name" (include "pegaDBZDTUpgrade" .) "action" "upgrade" "initContainers" (list "waitForPreDBUpgrade") }}
{{ template "pega.installer" dict "root" $ "name" (include "pegaPostDBUpgrade" .) "action" "post-upgrade" "initContainers" (list "waitForPegaDBZDTUpgrade" "waitForRollingUpdates") }}
{{ end }}
{{ if ( and (eq (include "performOnlyUpgrade" .) "true") (or (eq .Values.upgrade.upgradeType "zero-downtime") (eq .Values.upgrade.upgradeType "out-of-place"))) }}
{{ template "pega.installer" dict "root" $ "name" (include "pegaPreDBUpgrade" .) "action" "pre-upgrade" }}
{{ template "pega.installer" dict "root" $ "name" (include "pegaDBZDTUpgrade" .) "action" "upgrade" "initContainers" (list "waitForPreDBUpgrade") }}
{{ if ( and (eq (include "performOnlyUpgrade" .) "true") (eq .Values.upgrade.upgradeType "out-of-place")) }}
{{ template "pega.installer" dict "root" $ "name" (include "pegaDBOOPUpgrade" .) "action" "upgrade" }}
{{ end }}
{{ if ( and (eq (include "performOnlyUpgrade" .) "true") (eq .Values.upgrade.upgradeType "custom")) }}
{{ template "pega.installer" dict "root" $ "name" (include "pegaDBCustomUpgrade" .) "action" "upgrade" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ data:
# custom upgrade steps
{{- if .Values.upgrade.upgradeSteps }}
UPGRADE_STEP: {{ .Values.upgrade.upgradeSteps }}
{{- end }}
{{- if .Values.upgrade.pegaRESTServerURL }}
PEGA_REST_SERVER_URL: {{ .Values.upgrade.pegaRESTServerURL }}
{{- end }}
{{- if .Values.upgrade.pegaRESTUsername }}
PEGA_REST_USERNAME: {{ .Values.upgrade.pegaRESTUsername }}
{{- end }}
{{- if .Values.upgrade.pegaRESTPassword }}
PEGA_REST_PASSWORD: {{ .Values.upgrade.pegaRESTPassword }}
{{- end }}
# Whether this is a Multitenant System ('true' if yes, 'false' if no)
{{- if .Values.multitenant_system }}
Expand Down
4 changes: 4 additions & 0 deletions charts/pega/charts/installer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ upgrade:
runRulesetCleanup: "false"
# Rebuild Database Rules Indexes after Rules Load to improve Database Access Performance
rebuildIndexes: "false"
# Specify the server URL and the required server username and password to access a Pega REST server used to perform pre- and post-update actions during zero-downtime updates.
pegaRESTServerURL: ""
pegaRESTUsername: ""
pegaRESTPassword: ""

# Memory and CPU settings for installer
resources:
Expand Down
4 changes: 4 additions & 0 deletions charts/pega/values-large.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ installer:
# For postgres databases that you are upgrading from Pega Infinity version 8.4.0 and later
# And for Oracle databases that you are upgrading from Pega Infinity version 8.4.3 and later.
targetDataSchema: ""
# Specify the server URL and the required server username and password to access a Pega REST server used to perform pre- and post-update actions during zero-downtime updates.
pegaRESTServerURL: ""
pegaRESTUsername: ""
pegaRESTPassword: ""

# Hazelcast settings (applicable from Pega 8.6)
hazelcast:
Expand Down
4 changes: 4 additions & 0 deletions charts/pega/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ installer:
# For postgres databases that you are upgrading from Pega Infinity version 8.4.0 and later
# And for Oracle databases that you are upgrading from Pega Infinity version 8.4.3 and later.
targetDataSchema: ""
# Specify the server URL and the required server username and password to access a Pega REST server used to perform pre- and post-update actions during zero-downtime updates.
pegaRESTServerURL: ""
pegaRESTUsername: ""
pegaRESTPassword: ""

# Hazelcast settings (applicable from Pega 8.6)
hazelcast:
Expand Down
7 changes: 5 additions & 2 deletions docs/upgrading-pega-deployment-zero-downtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ To configure the parameters in the pega.yaml Helm, download the file in the char

To complete an upgrade with zero downtime, configure the following settings in your pega.yaml:

- Specify `action.execute: upgrade` to upgrade your application using the software version contained in your Pega-provided "installer" image.
- Specify `action.execute: upgrade-deploy` to upgrade your application using the software version contained in your Pega-provided "installer" image.
- Specify the source schema names in your database:
- `jdbc.rulesSchema: "YOUR_RULES_SCHEMA"`
- `jdbc.dataSchema: "YOUR_DATA_SCHEMA"`
Expand Down Expand Up @@ -138,6 +138,9 @@ You can leave the existing customized parameters as is; the upgrade process will
| installer.upgrade.upgradeType | Specify an zero-downtime upgrade to upgrade using the zero-downtime upgrade process. | upgradeType: "zero-downtime" |
| installer.upgrade.targetRulesSchema | For upgrades from 8.4.2 and later, specify a new rules schema name within the quotes that the process uses to create the schema in your existing database to support the upgrade process.| targetRulesSchema: "" |
| installer.upgrade.targetDataSchema | For upgrades from 8.4.2 and later, specify the new target data schema name within the quotes that the process uses to create the schema in your existing database to support the upgrade process. You must delete this schema from your database after you complete your upgrade. For upgrades starting at earlier versions, you can leave this value empty, as is (do not leave it blank). | targetDataSchema: "" |
| installer.upgrade.pegaRESTServerURL | For zero-downtime upgrades, specify Pega REST server URL within the quotes that the process uses to perform pre-upgrade/post-upgrade actions required for the upgrade orchestration. | pegaRESTServerURL: "" |
| installer.upgrade.pegaRESTUsername | For zero-downtime upgrades, specify username to access Pega REST server within the quotes that the process uses to perform pre-upgrade/post-upgrade actions required for the upgrade orchestration. | pegaRESTUsername: "" |
| installer.upgrade.pegaRESTPassword | For zero-downtime upgrades, specify user's password to access Pega REST server within the quotes that the process uses to perform pre-upgrade/post-upgrade actions required for the upgrade orchestration. | pegaRESTPassword: "" |

2. Save the file.

Expand Down Expand Up @@ -177,4 +180,4 @@ In this document, you specify that the Helm chart always “deploys” by using

A successful deployment does not show errors across the various workloads. The `mypega-<platform>-demo` Namespace **Overview** view shows charts of the percentage of complete tiers and resources configurations. A successful deployment has 100% complete **Workloads**.

It takes a little over an hour for the upgrade process to upgrade the applicable rules and then perform a rolling reboot of your nodes.
It takes a little over an hour for the upgrade process to upgrade the applicable rules and then perform a rolling reboot of your nodes.
2 changes: 1 addition & 1 deletion terratest/src/test/pega/pega-action-validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestPegaActonValidate_WithValidAction(t *testing.T){
SetValues: map[string]string{
"global.provider": "k8s",
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestPegaCredentialsSecretWithCassandraEncryptionPresent(t *testing.T) {
SetValues: map[string]string{
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
"dds.trustStorePassword": trustStorePassword,
"dds.keyStorePassword": keyStorePassword,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestPegaCredentialsSecretWithExternalStreamArePresent(t *testing.T) {
SetValues: map[string]string{
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
"stream.trustStorePassword": streamTrustStorePassword,
"stream.keyStorePassword": streamKeyStorePassword,
"stream.jaasConfig": jaasConfig,
Expand Down
10 changes: 5 additions & 5 deletions terratest/src/test/pega/pega-credentials-secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestPegaCredentialsSecret(t *testing.T){
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
},
}

Expand Down Expand Up @@ -63,7 +63,7 @@ func TestPegaCredentialsSecretWithArtifactoryBasicAuth(t *testing.T){
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
"global.customArtifactory.authentication.basic.username": "username",
"global.customArtifactory.authentication.basic.password": "pwd",
"global.customArtifactory.authentication.apiKey.headerName": "",
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestPegaCredentialsSecretWithNoArtifactoryBasicAuth(t *testing.T){
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
"global.customArtifactory.authentication.basic.username": "",
"global.customArtifactory.authentication.basic.password": "pwd",
"global.customArtifactory.authentication.apiKey.headerName": "",
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestPegaCredentialsSecretWithArtifactoryApiKeyAuth(t *testing.T){
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
"global.customArtifactory.authentication.apiKey.headerName": "headerName",
"global.customArtifactory.authentication.apiKey.value": "apiKey-value",
"global.customArtifactory.authentication.basic.username": "",
Expand Down Expand Up @@ -171,7 +171,7 @@ func TestPegaCredentialsSecretWithNoArtifactoryApiKeyAuth(t *testing.T){
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
"installer.upgrade.upgradeType": getUpgradeTypeForUpgradeAction(operation),
"global.customArtifactory.authentication.apiKey.headerName": "headerName",
"global.customArtifactory.authentication.apiKey.value": "",
"global.customArtifactory.authentication.basic.username": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func TestPegaInstallerAction_WithValidUpgradeType(t *testing.T) {

var supportedActions = []string{"upgrade"}
var supportedUpgradeTypes = []string{"in-place" ,"out-of-place", "zero-downtime", "custom", "out-of-place-rules" ,"out-of-place-data"}
var supportedUpgradeTypes = []string{"in-place" ,"out-of-place", "custom", "out-of-place-rules" ,"out-of-place-data"}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
require.NoError(t, err)
Expand All @@ -36,7 +36,7 @@ func TestPegaInstallerAction_WithValidUpgradeType(t *testing.T) {
func TestPegaInstallerAction_WithValidUpgradedeployType(t *testing.T) {

var supportedActions = []string{"upgrade-deploy"}
var supportedUpgradeTypes = []string{"zero-downtime" }
var supportedUpgradeTypes = []string{"zero-downtime"}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

func TestPegaInstallerConnectionPropsConfig(t *testing.T) {
var supportedVendors = []string{"k8s", "openshift", "eks", "gke", "aks", "pks"}
var supportedOperations = []string{"install", "install-deploy", "upgrade", "upgrade-deploy"}
var supportedOperations = []string{"install", "install-deploy", "upgrade-deploy"}
var supportedDbs = []string{"postgres", "mssql", "oracledate", "udb", "db2zos"}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
Expand Down
6 changes: 3 additions & 3 deletions terratest/src/test/pega/pega-installer-config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func TestPegaInstallerConfig(t *testing.T) {
var supportedVendors = []string{"k8s", "openshift", "eks", "gke", "aks", "pks"}
var supportedOperations = []string{"install", "install-deploy", "upgrade", "upgrade-deploy"}
var supportedOperations = []string{"install", "install-deploy", "upgrade-deploy"}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
require.NoError(t, err)
Expand All @@ -20,8 +20,8 @@ func TestPegaInstallerConfig(t *testing.T) {
for _, operation := range supportedOperations {
var options = &helm.Options{
SetValues: map[string]string{
"global.provider": vendor,
"global.actions.execute": operation,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
},
}
Expand Down
Loading

0 comments on commit bf406d2

Please sign in to comment.