diff --git a/iac/tf-anthos-gke/terraform.tfvars b/iac/tf-anthos-gke/terraform.tfvars index 92e69573d..7389863dc 100644 --- a/iac/tf-anthos-gke/terraform.tfvars +++ b/iac/tf-anthos-gke/terraform.tfvars @@ -18,6 +18,6 @@ region = "us-central1" zone = "us-central1-b" cluster_name = "anthos-sample-cluster1" sync_repo = "https://github.com/GoogleCloudPlatform/bank-of-anthos" -sync_branch = "release/v1.3.4" +sync_branch = "release/v1.5.3" sync_rev = "" policy_dir = "/kubernetes-manifests" diff --git a/kubernetes-manifests/accounts-db.yaml b/kubernetes-manifests/accounts-db.yaml index dd5abde7a..ba8ce637f 100644 --- a/kubernetes-manifests/accounts-db.yaml +++ b/kubernetes-manifests/accounts-db.yaml @@ -73,7 +73,7 @@ spec: name: accounts-db-config - configMapRef: name: demo-data-config - image: ghcr.io/splunk/bank-of-splunk/accounts-db:v1.3.4@sha256:60acf1383d6fd8d5ba3a689268a258171c8d2d240c59cee1ae636aef3f1e8d72 + image: ghcr.io/splunk/bank-of-splunk/accounts-db:v1.5.3@sha256:60acf1383d6fd8d5ba3a689268a258171c8d2d240c59cee1ae636aef3f1e8d72 name: accounts-db ports: - containerPort: 5432 diff --git a/kubernetes-manifests/balance-reader.yaml b/kubernetes-manifests/balance-reader.yaml index 79889a05b..7bd262deb 100644 --- a/kubernetes-manifests/balance-reader.yaml +++ b/kubernetes-manifests/balance-reader.yaml @@ -87,7 +87,7 @@ spec: name: ledger-db-config - configMapRef: name: demo-data-config - image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.3.4@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 + image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.5.3@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 name: postgres ports: - containerPort: 5432 @@ -165,7 +165,7 @@ spec: containers: - env: - name: VERSION - value: v1.3.4 + value: v1.5.3 - name: PORT value: "8080" - name: ENABLE_TRACING @@ -189,7 +189,7 @@ spec: name: environment-config - configMapRef: name: ledger-db-config - image: ghcr.io/splunk/bank-of-splunk/balancereader:v1.3.4@sha256:928b892a9bbe3db70e68542a7e8b72796a35870c07f4e87b287c29576ddbba30 + image: ghcr.io/splunk/bank-of-splunk/balancereader:v1.5.3@sha256:928b892a9bbe3db70e68542a7e8b72796a35870c07f4e87b287c29576ddbba30 livenessProbe: httpGet: path: /healthy diff --git a/kubernetes-manifests/contacts.yaml b/kubernetes-manifests/contacts.yaml index c821abe40..b5c9febc4 100644 --- a/kubernetes-manifests/contacts.yaml +++ b/kubernetes-manifests/contacts.yaml @@ -86,7 +86,7 @@ spec: name: accounts-db-config - configMapRef: name: demo-data-config - image: ghcr.io/splunk/bank-of-splunk/accounts-db:v1.3.4@sha256:60acf1383d6fd8d5ba3a689268a258171c8d2d240c59cee1ae636aef3f1e8d72 + image: ghcr.io/splunk/bank-of-splunk/accounts-db:v1.5.3@sha256:60acf1383d6fd8d5ba3a689268a258171c8d2d240c59cee1ae636aef3f1e8d72 name: accounts-db ports: - containerPort: 5432 @@ -159,7 +159,7 @@ spec: containers: - env: - name: VERSION - value: v1.3.4 + value: v1.5.3 - name: PORT value: "8080" - name: ENABLE_TRACING @@ -179,7 +179,7 @@ spec: name: environment-config - configMapRef: name: accounts-db-config - image: ghcr.io/splunk/bank-of-splunk/contacts:v1.3.4@sha256:bfe6d8970e967130c972779b47bef1999afc3d698cc80c56cade5a52dcc0aa64 + image: ghcr.io/splunk/bank-of-splunk/contacts:v1.5.3@sha256:bfe6d8970e967130c972779b47bef1999afc3d698cc80c56cade5a52dcc0aa64 name: contacts readinessProbe: httpGet: diff --git a/kubernetes-manifests/frontend.yaml b/kubernetes-manifests/frontend.yaml index 1060acfa7..0a088335f 100644 --- a/kubernetes-manifests/frontend.yaml +++ b/kubernetes-manifests/frontend.yaml @@ -63,7 +63,7 @@ spec: containers: - env: - name: VERSION - value: v1.3.4 + value: v1.5.3 - name: PORT value: "8080" - name: ENABLE_TRACING @@ -141,7 +141,7 @@ spec: name: environment-config - configMapRef: name: service-api-config - image: ghcr.io/splunk/bank-of-splunk/frontend:v1.3.4@sha256:b3cd2828e76ba3197e51d198cfceb09c61f387ffdb9ebace33a5410898cc2bbe + image: ghcr.io/splunk/bank-of-splunk/frontend:v1.5.3@sha256:f6f5b0d973c4c7651e1f4d2756282877ed0752225ad166179b0e90993a505312 livenessProbe: httpGet: path: /ready diff --git a/kubernetes-manifests/ledger-db.yaml b/kubernetes-manifests/ledger-db.yaml index 49874aa16..cba6c3932 100644 --- a/kubernetes-manifests/ledger-db.yaml +++ b/kubernetes-manifests/ledger-db.yaml @@ -74,7 +74,7 @@ spec: name: ledger-db-config - configMapRef: name: demo-data-config - image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.3.4@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 + image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.5.3@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 name: postgres ports: - containerPort: 5432 diff --git a/kubernetes-manifests/ledger-writer.yaml b/kubernetes-manifests/ledger-writer.yaml index 262eb3dca..7a89f75af 100644 --- a/kubernetes-manifests/ledger-writer.yaml +++ b/kubernetes-manifests/ledger-writer.yaml @@ -87,7 +87,7 @@ spec: name: ledger-db-config - configMapRef: name: demo-data-config - image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.3.4@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 + image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.5.3@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 name: postgres ports: - containerPort: 5432 @@ -165,7 +165,7 @@ spec: containers: - env: - name: VERSION - value: v1.3.4 + value: v1.5.3 - name: PORT value: "8080" - name: ENABLE_TRACING @@ -187,7 +187,7 @@ spec: name: service-api-config - configMapRef: name: ledger-db-config - image: ghcr.io/splunk/bank-of-splunk/ledgerwriter:v1.3.4@sha256:a257d61f349d13e26d1f2e556d5ff83792d388f97f7402854ce426eceac18e4c + image: ghcr.io/splunk/bank-of-splunk/ledgerwriter:v1.5.3@sha256:a257d61f349d13e26d1f2e556d5ff83792d388f97f7402854ce426eceac18e4c name: ledgerwriter readinessProbe: httpGet: diff --git a/kubernetes-manifests/loadgenerator.yaml b/kubernetes-manifests/loadgenerator.yaml index dea98c1ab..9da066e7e 100644 --- a/kubernetes-manifests/loadgenerator.yaml +++ b/kubernetes-manifests/loadgenerator.yaml @@ -45,7 +45,7 @@ spec: value: "5" - name: LOG_LEVEL value: error - image: ghcr.io/splunk/bank-of-splunk/loadgenerator:v1.3.4@sha256:d184a7ddd273161327695ed8e69dbefdd3a50eece3123203bc0bf0ef17db6fe4 + image: ghcr.io/splunk/bank-of-splunk/loadgenerator:v1.5.3@sha256:d184a7ddd273161327695ed8e69dbefdd3a50eece3123203bc0bf0ef17db6fe4 name: loadgenerator resources: limits: diff --git a/kubernetes-manifests/rum-loadgen.yaml b/kubernetes-manifests/rum-loadgen.yaml new file mode 100644 index 000000000..40cdc9d7d --- /dev/null +++ b/kubernetes-manifests/rum-loadgen.yaml @@ -0,0 +1,210 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: loadgen +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bankofsplunk-loadgen + namespace: loadgen + labels: + app: bankofsplunk-loadgen +spec: + replicas: 1 + selector: + matchLabels: + app: bankofsplunk-loadgen + template: + metadata: + labels: + app: bankofsplunk-loadgen + spec: + # If you are NOT running this from AWS, but from multipass for example set the below env variable + # set RUM_FRONTEND_IP to the IP address where you can reach your local Online Boutique + #env: + # - name: RUM_FRONTEND_IP + # value: "192.168.1.99" + containers: + - name: bankofsplunk + image: rcastley895/rumloadgen:5.5 + imagePullPolicy: Always + env: + - name: NODE_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: RUM_PROTOCOL + value: "http" + - name: RUM_PORT + value: "8083" + resources: + limits: + cpu: 800m + memory: 600Mi + requests: + cpu: 250m + memory: 200Mi + volumeMounts: + - name: puppeteer + subPath: local-file + mountPath: /puppeteer/touchwebsite.js + volumes: + - name: puppeteer + configMap: + name: scriptfile +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: bankofsplunk-loadgen-hpa + namespace: loadgen +spec: + maxReplicas: 8 + metrics: + - type: Resource + resource: + name: cpu + target: + averageUtilization: 85 + type: Utilization + - type: Resource + resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + minReplicas: 1 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: bankofsplunk-loadgen +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: scriptfile + namespace: loadgen +data: + local-file: | + const puppeteer = require('puppeteer'); + + function run() { + return new Promise(async (resolve, reject) => { + const browser = await puppeteer.launch({ + headless: true, + defaultViewport: null, + args: [ + '--no-sandbox', + '--disable-setuid-sandbox', + '--disable-dev-shm-usage', + '--disable-session-crashed-bubble', + '--disable-accelerated-2d-canvas', + '--no-first-run', + '--no-zygote', + '--single-process', + '--noerrdialogs', + '--disable-gpu' + ] + }); + const url = process.env.RUM_PROTOCOL + "://" + process.env.NODE_IP + ":" + process.env.RUM_PORT + "/"; + //const url = process.env.RUM_PROTOCOL + "://" + process.env.URL + "/"; + try { + const wait_time = 500; + const timeout = 10000; // Timeout for waiting on actions + for (let loop = 0; loop < 1; loop++) { + const page = await browser.newPage(); + + await page.setUserAgent('Mozilla/5.0 (X11; Linux x86_64; Splunk RUMLoadGen) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36'); + + // Interaction 1: Set Viewport + console.log("Set Viewport"); + await page.setViewport({ + width: 1000, + height: 600 + }); + + // Interaction 2: Go to the page and wait for navigation + console.log("Go to " + url + " and wait for navigation"); + const promises = []; + promises.push(page.waitForNavigation()); + await page.goto(`${url}`); + await Promise.all(promises); + await delay(wait_time); + + // Interaction 3: Wait for Sign In button + console.log("Waiting for 'Sign In' button"); + await page.waitForSelector('button', { timeout }); + + // Interaction 4: Click Sign In and wait for navigation + console.log("Click Sign In and wait for navigation"); + + const signInPromises = []; + const startSignInWaitingForEvents = () => { + signInPromises.push(page.waitForNavigation({ waitUntil: 'networkidle0' })); // Wait for navigation after clicking + }; + + // Wait for the "Sign In" button and click it + await page.locator('button').click({ + offset: { + x: 201.171875, + y: 24.671875, + }, + }); + + // Start waiting for navigation + startSignInWaitingForEvents(); + await Promise.all(signInPromises); // Wait for navigation to complete + await page.waitForSelector('h2', { timeout }); // Wait for the Checking Account heading after deposit + await delay(wait_time); // Adding delay after waiting for the element + + console.log("Click on Account Username"); + // Interaction: Click on Account Username + await page.locator('#account-user-name').click({ + offset: { + x: 79, + y: 6.53125, + }, + }); + await delay(wait_time); // Adding delay between actions + + console.log("Wait for Sign Out link"); + // Interaction: Wait for Sign Out link + await page.waitForSelector('li > div a', { timeout }); + + console.log("Click Sign Out and wait for navigation"); + // Interaction: Click Sign Out and wait for navigation + const signOutPromises = []; + signOutPromises.push(page.waitForNavigation({ waitUntil: 'networkidle0' })); + + await page.locator('li > div a').click({ + offset: { + x: 71.796875, + y: 22.15625, + }, + }); + + await Promise.all(signOutPromises); // Wait for navigation after clicking + console.log("Sign out completed"); + + // Adding a final delay before closing + await browser.close(); + } + } catch (e) { + console.log('{"severity":"error","msg": "' + e + '"}'); + } finally { + await browser.close(); + } + resolve('RUM Loop completed successfully'); // Return a message when resolving + await delay(10000); + }); + } + + run().then(console.log).catch(console.error); + + function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); + } \ No newline at end of file diff --git a/kubernetes-manifests/transaction-history.yaml b/kubernetes-manifests/transaction-history.yaml index 61e9a3862..240a05f99 100644 --- a/kubernetes-manifests/transaction-history.yaml +++ b/kubernetes-manifests/transaction-history.yaml @@ -87,7 +87,7 @@ spec: name: ledger-db-config - configMapRef: name: demo-data-config - image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.3.4@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 + image: ghcr.io/splunk/bank-of-splunk/ledger-db:v1.5.3@sha256:de1ae1694d03c6c368245ec88ca016476dffa1f73a5d6cd67ab949a96c93d668 name: postgres ports: - containerPort: 5432 @@ -165,7 +165,7 @@ spec: containers: - env: - name: VERSION - value: v1.3.4 + value: v1.5.3 - name: PORT value: "8080" - name: ENABLE_TRACING @@ -193,7 +193,7 @@ spec: name: environment-config - configMapRef: name: ledger-db-config - image: ghcr.io/splunk/bank-of-splunk/transactionhistory:v1.3.4@sha256:d0fbbb9fe6f3589c0372301ad159975af5cb309891f135444cca49092e66aaa6 + image: ghcr.io/splunk/bank-of-splunk/transactionhistory:v1.5.3@sha256:d0fbbb9fe6f3589c0372301ad159975af5cb309891f135444cca49092e66aaa6 livenessProbe: httpGet: path: /healthy diff --git a/kubernetes-manifests/userservice.yaml b/kubernetes-manifests/userservice.yaml index 07b6fac90..f2538399b 100644 --- a/kubernetes-manifests/userservice.yaml +++ b/kubernetes-manifests/userservice.yaml @@ -86,7 +86,7 @@ spec: name: accounts-db-config - configMapRef: name: demo-data-config - image: ghcr.io/splunk/bank-of-splunk/accounts-db:v1.3.4@sha256:60acf1383d6fd8d5ba3a689268a258171c8d2d240c59cee1ae636aef3f1e8d72 + image: ghcr.io/splunk/bank-of-splunk/accounts-db:v1.5.3@sha256:60acf1383d6fd8d5ba3a689268a258171c8d2d240c59cee1ae636aef3f1e8d72 name: accounts-db ports: - containerPort: 5432 @@ -159,7 +159,7 @@ spec: containers: - env: - name: VERSION - value: v1.3.4 + value: v1.5.3 - name: PORT value: "8080" - name: ENABLE_TRACING @@ -183,7 +183,7 @@ spec: name: environment-config - configMapRef: name: accounts-db-config - image: ghcr.io/splunk/bank-of-splunk/userservice:v1.3.4@sha256:337b10ec55610e134d7fb236c4949d73da128c0ce9b03b78cb675d723c7df9d6 + image: ghcr.io/splunk/bank-of-splunk/userservice:v1.5.3@sha256:d6d17105ec1248ebf4af6fb5021aa047ed26fcc6ae4d89c7cd018387a7e27baf name: userservice ports: - containerPort: 8080