Skip to content

Commit

Permalink
Installer subchart to pick up custom artifactory credentials (pegasys…
Browse files Browse the repository at this point in the history
…tems#687)

* Adding custom artifactory creds in installer subchart
* added test

---------

Co-authored-by: degah <HeshmaReddy.Dega@in.pega.com>
  • Loading branch information
Heshma and degah authored Dec 19, 2023
1 parent a71194e commit b0518b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ spec:
{{- $d := dict "deploySecret" "deployDBSecret" "deployNonExtsecret" "deployNonExtDBSecret" "extSecretName" .root.Values.global.jdbc.external_secret_name "nonExtSecretName" "pega-db-secret-name" "context" .root -}}
{{ include "secretResolver" $d | indent 10}}

{{- $artifactoryDict := dict "deploySecret" "deployArtifactorySecret" "deployNonExtsecret" "deployNonExtArtifactorySecret" "extSecretName" .root.Values.global.customArtifactory.authentication.external_secret_name "nonExtSecretName" "pega-custom-artifactory-secret-name" "context" .root -}}
{{ include "secretResolver" $artifactoryDict | indent 10}}

# Fix it, Below peace of code always uses secret created from hz username & password. It cannot resolve hz external secret due to helm sub chart limitations. Modify it once hazelcast deployment is isolated.
{{- if ( eq .root.Values.upgrade.isHazelcastClientServer "true" ) }}
- secret:
Expand Down
13 changes: 8 additions & 5 deletions terratest/src/test/pega/pega-installer-job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type pegaDbJob struct {
}

var volDefaultMode int32 = 420
var customArtifactorySecret = "artifactory_secret"
var volDefaultModePointer = &volDefaultMode

func TestPegaInstallerJob(t *testing.T) {
Expand All @@ -36,11 +37,12 @@ func TestPegaInstallerJob(t *testing.T) {
for _, pullPolicy := range imagePullPolicy {
var options = &helm.Options{
SetValues: map[string]string{
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.imagePullPolicy": pullPolicy,
"installer.upgrade.upgradeType": "zero-downtime",
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"global.customArtifactory.authentication.external_secret_name": customArtifactorySecret,
"installer.imagePullPolicy": pullPolicy,
"installer.upgrade.upgradeType": "zero-downtime",
},
}
yamlContent := RenderTemplate(t, options, helmChartPath, []string{"charts/installer/templates/pega-installer-job.yaml"})
Expand Down Expand Up @@ -114,6 +116,7 @@ func assertJob(t *testing.T, jobYaml string, expectedJob pegaDbJob, options *hel

require.Equal(t, jobSpec.Volumes[0].Name, "pega-installer-credentials-volume")
require.Equal(t, jobSpec.Volumes[0].VolumeSource.Projected.Sources[0].Secret.Name, getObjName(options, "-db-secret"))
require.Equal(t, jobSpec.Volumes[0].VolumeSource.Projected.Sources[1].Secret.Name, customArtifactorySecret)
require.Equal(t, jobSpec.Volumes[0].VolumeSource.Projected.DefaultMode, volDefaultModePointer)
require.Equal(t, jobSpec.Volumes[1].Name, "pega-volume-installer")
if jobSpec.Volumes[1].VolumeSource.ConfigMap.LocalObjectReference.Name == "pega-install-config" {
Expand Down

0 comments on commit b0518b1

Please sign in to comment.