Skip to content

Commit

Permalink
Fix deprecated nodeAffinity keys in ibmmq helm chart
Browse files Browse the repository at this point in the history
Signed-off-by: ayoyu <khaliayoub9@gmail.com>
  • Loading branch information
ayoyu committed Jun 4, 2024
1 parent 786c8bd commit f47cff5
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions tests/scalers/ibmmq/ibmmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package ibmmq_test
import (
"encoding/base64"
"fmt"
"os"
"testing"

"github.com/joho/godotenv"
Expand Down Expand Up @@ -329,23 +330,42 @@ func installIbmmq(t *testing.T, kc *kubernetes.Clientset, data templateData) {
_, err = ExecuteCommand("helm repo update")
require.NoErrorf(t, err, "cannot execute command - %s", err)

tempDir, err := os.MkdirTemp("", testName)
require.NoErrorf(t, err, "cannot create temp directory - %s", err)
defer os.RemoveAll(tempDir)

_, err = ExecuteCommand(fmt.Sprintf("helm pull ibm-mqadvanced-server-dev --repo %s --untar --untardir %s", ibmmqHelmRepo, tempDir))
require.NoErrorf(t, err, "cannot execute command - %s", err)
chartTempDir := fmt.Sprintf("%s/ibm-mqadvanced-server-dev", tempDir)

// Update deprecated keys for the statefulset `nodeAffinity` object: `beta.kubernetes.io/os` and `beta.kubernetes.io/arch`
// by removing the `beta` prefix if it exists.
_, err = ExecuteCommand(fmt.Sprintf("find %s/templates -type f -name '*.yaml' -exec sed -i -e s/beta.kubernetes.io\\/os/kubernetes.io\\/os/g {} ;", chartTempDir))
require.NoErrorf(t, err, "cannot execute command - %s", err)
_, err = ExecuteCommand(fmt.Sprintf("find %s/templates -type f -name '*.yaml' -exec sed -i -e s/beta.kubernetes.io\\/arch/kubernetes.io\\/arch/g {} ;", chartTempDir))
require.NoErrorf(t, err, "cannot execute command - %s", err)

// Creates the secret that contains the 'app' and 'admin' user passwords
// which will be referenced by the chart.
KubectlApplyWithTemplate(t, data, "secretTemplate", secretTemplate)

t.Logf("installing IBM MQ helm chart '%s'", ibmmqHelmChartReleaseName)
_, err = ExecuteCommand(fmt.Sprintf(
"helm install %s ibm-stable-charts/ibm-mqadvanced-server-dev "+
todebug, err := ExecuteCommand(fmt.Sprintf(
"helm install %s %s "+
"--set license=accept "+
"--set persistence.enabled=false "+
"--set persistence.useDynamicProvisioning=false "+
"--set image.tag=9.2.4.0-r1 "+
"--set queueManager.name=%s "+
"--set queueManager.multiInstance=false "+
"--set queueManager.dev.secret.name=%s "+
"--set queueManager.dev.secret.adminPasswordKey=adminPassword "+
"--set queueManager.dev.secret.appPasswordKey=appPassword "+
"--namespace %s --wait",
ibmmqHelmChartReleaseName, queueManagerName, secretName, testNamespace))
"--namespace %s --wait --debug",
ibmmqHelmChartReleaseName, chartTempDir, queueManagerName, secretName, testNamespace))
require.NoErrorf(t, err, "cannot execute command - %s", err)
// temp
t.Log(string(todebug))

KubectlApplyWithTemplate(t, data, "checkQueueManagerRunningStatusJobTemplate", checkQueueManagerRunningStatusJobTemplate)
t.Logf("waiting for the queue manager '%s' to be in a running state", queueManagerName)
Expand Down

0 comments on commit f47cff5

Please sign in to comment.