diff --git a/pkg/scalers/selenium_grid_scaler.go b/pkg/scalers/selenium_grid_scaler.go index 885a610f43a..44b758ebe77 100644 --- a/pkg/scalers/selenium_grid_scaler.go +++ b/pkg/scalers/selenium_grid_scaler.go @@ -27,13 +27,14 @@ type seleniumGridScaler struct { } type seleniumGridScalerMetadata struct { - url string - browserName string - sessionBrowserName string - targetValue int64 - browserVersion string - unsafeSsl bool - scalerIndex int + url string + browserName string + sessionBrowserName string + targetValue int64 + activationThreshold int64 + browserVersion string + unsafeSsl bool + scalerIndex int } type seleniumResponse struct { @@ -116,6 +117,15 @@ func parseSeleniumGridScalerMetadata(config *ScalerConfig) (*seleniumGridScalerM meta.sessionBrowserName = meta.browserName } + meta.activationThreshold = 0 + if val, ok := config.TriggerMetadata["activationThreshold"]; ok { + activationThreshold, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return nil, fmt.Errorf("error parsing unsafeSsl: %s", err) + } + meta.activationThreshold = activationThreshold + } + if val, ok := config.TriggerMetadata["browserVersion"]; ok && val != "" { meta.browserVersion = val } else { @@ -170,7 +180,7 @@ func (s *seleniumGridScaler) IsActive(ctx context.Context) (bool, error) { return false, err } - return v > 0, nil + return v > s.metadata.activationThreshold, nil } func (s *seleniumGridScaler) getSessionsCount(ctx context.Context) (int64, error) { diff --git a/pkg/scalers/selenium_grid_scaler_test.go b/pkg/scalers/selenium_grid_scaler_test.go index d960cc1224d..869458a9d43 100644 --- a/pkg/scalers/selenium_grid_scaler_test.go +++ b/pkg/scalers/selenium_grid_scaler_test.go @@ -424,27 +424,44 @@ func Test_parseSeleniumGridScalerMetadata(t *testing.T) { }, }, { - name: "valid url, browsername and unsafeSsl should return metadata", + name: "valid url, browsername, unsafeSsl and activationThreshold should return metadata", args: args{ config: &ScalerConfig{ TriggerMetadata: map[string]string{ - "url": "http://selenium-hub:4444/graphql", - "browserName": "chrome", - "browserVersion": "91.0", - "unsafeSsl": "true", + "url": "http://selenium-hub:4444/graphql", + "browserName": "chrome", + "browserVersion": "91.0", + "unsafeSsl": "true", + "activationThreshold": "10", }, }, }, wantErr: false, want: &seleniumGridScalerMetadata{ - url: "http://selenium-hub:4444/graphql", - browserName: "chrome", - sessionBrowserName: "chrome", - targetValue: 1, - browserVersion: "91.0", - unsafeSsl: true, + url: "http://selenium-hub:4444/graphql", + browserName: "chrome", + sessionBrowserName: "chrome", + targetValue: 1, + activationThreshold: 10, + browserVersion: "91.0", + unsafeSsl: true, }, }, + { + name: "valid url, browsername and unsafeSsl but invalid activationThreshold should throw an error", + args: args{ + config: &ScalerConfig{ + TriggerMetadata: map[string]string{ + "url": "http://selenium-hub:4444/graphql", + "browserName": "chrome", + "browserVersion": "91.0", + "unsafeSsl": "true", + "activationThreshold": "AA", + }, + }, + }, + wantErr: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/tests/scalers/selenium-grid.test.ts b/tests/scalers/selenium-grid.test.ts deleted file mode 100644 index 16f602801a1..00000000000 --- a/tests/scalers/selenium-grid.test.ts +++ /dev/null @@ -1,683 +0,0 @@ -import test from 'ava' -import * as sh from 'shelljs' -import * as tmp from 'tmp' -import * as fs from 'fs' -import { createNamespace } from './helpers'; - -const seleniumGridNamespace = 'selenium-grid'; -const seleniumGridHostName = `selenium-hub.${seleniumGridNamespace}`; -const seleniumGridPort = "4444"; -const seleniumGridGraphQLUrl = `http://${seleniumGridHostName}:${seleniumGridPort}/graphql`; -const seleniumGridTestName = 'selenium-random-tests'; - -test.before(t => { - createNamespace(seleniumGridNamespace) - - const seleniumGridDeployTmpFile = tmp.fileSync(); - fs.writeFileSync(seleniumGridDeployTmpFile.name, seleniumGridYaml.replace(/{{NAMESPACE}}/g, seleniumGridNamespace)); - - t.is(0, sh.exec(`kubectl apply --namespace ${seleniumGridNamespace} -f ${seleniumGridDeployTmpFile.name}`).code, 'creating a Selenium Grid deployment should work.') - - let seleniumHubReplicaCount = '0'; - - for (let i = 0; i < 60; i++) { - seleniumHubReplicaCount = sh.exec(`kubectl get deploy/selenium-hub -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout - if (seleniumHubReplicaCount == '1') { - break; - } - console.log('Waiting for selenium hub to be ready'); - sh.exec('sleep 5s') - } - t.is('1', seleniumHubReplicaCount, 'Selenium Hub is not in a ready state') -}); - -test.serial('should have 0 nodes at start', t => { - const scaledObjectDeployTmpFile = tmp.fileSync(); - fs.writeFileSync(scaledObjectDeployTmpFile.name, scaledObjectYaml.replace(/{{NAMESPACE}}/g, seleniumGridNamespace).replace(/{{SELENIUM_GRID_GRAPHQL_URL}}/g, seleniumGridGraphQLUrl)); - - t.is(0, sh.exec(`kubectl apply --namespace ${seleniumGridNamespace} -f ${scaledObjectDeployTmpFile.name}`).code, 'creating a Scaled Object CRD should work.') - - let seleniumChromeNodeReplicaCount = '1'; - let seleniumFireFoxReplicaCount = '1'; - let seleniumEdgeReplicaCount = '1'; - for (let i = 0; i < 60; i++) { - seleniumChromeNodeReplicaCount = sh.exec(`kubectl get deploy/selenium-chrome-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout - seleniumFireFoxReplicaCount = sh.exec(`kubectl get deploy/selenium-firefox-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout - seleniumEdgeReplicaCount = sh.exec(`kubectl get deploy/selenium-edge-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout - if (seleniumChromeNodeReplicaCount == '0' && seleniumFireFoxReplicaCount == '0' && seleniumEdgeReplicaCount == '0') { - break; - } - console.log('Waiting for chrome, firefox, and edge to scale down to 0 pods') - sh.exec('sleep 10s') - } - - t.is('0', seleniumChromeNodeReplicaCount, 'Selenium Chrome Node did not scale down to 0 pods') - t.is('0', seleniumFireFoxReplicaCount, 'Selenium Firefox Node did not scale down to 0 pods') - t.is('0', seleniumEdgeReplicaCount, 'Selenium Edge Node did not scale down to 0 pods') -}); - -test.serial('should create one chrome, firefox, and edge node', t => { - const seleniumGridTestDeployTmpFile = tmp.fileSync(); - fs.writeFileSync( - seleniumGridTestDeployTmpFile.name, - seleniumGridTestsYaml - .replace(/{{JOB_NAME}}/g, seleniumGridTestName) - .replace(/{{CONTAINER_NAME}}/g, seleniumGridTestName) - .replace(/{{HOST_NAME}}/g, seleniumGridHostName) - .replace(/{{PORT}}/g, seleniumGridPort) - .replace(/{{WITH_VERSION}}/g, "false") - ); - - t.is(0, sh.exec(`kubectl apply --namespace ${seleniumGridNamespace} -f ${seleniumGridTestDeployTmpFile.name}`).code, 'creating a Selenium Grid Tests deployment should work.'); - - let seleniumChromeNodeReplicaCount = '0'; - let seleniumFireFoxReplicaCount = '0'; - let seleniumEdgeReplicaCount = '0'; - for (let i = 0; i < 120; i++) { - seleniumChromeNodeReplicaCount = seleniumChromeNodeReplicaCount != '1' ? sh.exec(`kubectl get deploy/selenium-chrome-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumChromeNodeReplicaCount; - seleniumFireFoxReplicaCount = seleniumFireFoxReplicaCount != '1' ? sh.exec(`kubectl get deploy/selenium-firefox-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumFireFoxReplicaCount; - seleniumEdgeReplicaCount = seleniumEdgeReplicaCount != '1' ? sh.exec(`kubectl get deploy/selenium-edge-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumEdgeReplicaCount; - if (seleniumChromeNodeReplicaCount == '1' && seleniumFireFoxReplicaCount == '1' && seleniumEdgeReplicaCount == '1') { - break; - } - console.log('Waiting for chrome, firefox, and edge to scale up to 1 pod'); - sh.exec('sleep 2s') - } - - t.is('1', seleniumChromeNodeReplicaCount, 'Selenium Chrome Node did not scale up to 1 pod') - t.is('1', seleniumFireFoxReplicaCount, 'Selenium Firefox Node did not scale up to 1 pod') - t.is('1', seleniumEdgeReplicaCount, 'Selenium Edge Node did not scale up to 1 pod') - - // wait for selenium grid tests to complete - for (let i = 0; i < 120; i++) { - seleniumChromeNodeReplicaCount = seleniumChromeNodeReplicaCount != '0' ? sh.exec(`kubectl get deploy/selenium-chrome-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumChromeNodeReplicaCount; - seleniumFireFoxReplicaCount = seleniumFireFoxReplicaCount != '0' ? sh.exec(`kubectl get deploy/selenium-firefox-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumFireFoxReplicaCount; - seleniumEdgeReplicaCount = seleniumEdgeReplicaCount != '0' ? sh.exec(`kubectl get deploy/selenium-edge-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumEdgeReplicaCount; - if (seleniumChromeNodeReplicaCount == '0' && seleniumFireFoxReplicaCount == '0' && seleniumEdgeReplicaCount == '0') { - break; - } - console.log('Waiting for chrome, firefox, and edge to scale up to 0 pods'); - sh.exec('sleep 2s') - } - - sh.exec(`kubectl delete job/${seleniumGridTestName} --namespace ${seleniumGridNamespace}`) -}); - -test.serial('should scale down chrome, firefox, and edge nodes to 0', t => { - let seleniumChromeNodeReplicaCount = '1'; - let seleniumFireFoxReplicaCount = '1'; - let seleniumEdgeReplicaCount = '1'; - for (let i = 0; i < 120; i++) { - seleniumChromeNodeReplicaCount = sh.exec(`kubectl get deploy/selenium-chrome-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout; - seleniumFireFoxReplicaCount = sh.exec(`kubectl get deploy/selenium-firefox-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout; - seleniumEdgeReplicaCount = sh.exec(`kubectl get deploy/selenium-edge-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout; - if (seleniumChromeNodeReplicaCount == '0' && seleniumFireFoxReplicaCount == '0' && seleniumEdgeReplicaCount == '0') { - break; - } - console.log('Waiting for chrome, firefox,a nd edge to scale down to 0 pods'); - sh.exec('sleep 2s') - } - - t.is('0', seleniumChromeNodeReplicaCount, 'Selenium Chrome Node did not scale down to 0 pod') - t.is('0', seleniumFireFoxReplicaCount, 'Selenium Firefox Node did not scale down to 0 pod') - t.is('0', seleniumEdgeReplicaCount, 'Selenium Edge Node did not scale down to 0 pod') -}); - -test.serial('should create two chrome, one firefox, and one edge nodes', t => { - const chrome91DeployTmpFile = tmp.fileSync(); - fs.writeFileSync(chrome91DeployTmpFile.name, chrome91Yaml.replace(/{{NAMESPACE}}/g, seleniumGridNamespace).replace(/{{SELENIUM_GRID_GRAPHQL_URL}}/g, seleniumGridGraphQLUrl)); - - t.is(0, sh.exec(`kubectl apply --namespace ${seleniumGridNamespace} -f ${chrome91DeployTmpFile.name}`).code, 'creating Chrome 91 node should work.') - - let seleniumChrome91NodeReplicaCount = '1'; - for (let i = 0; i < 120; i++) { - seleniumChrome91NodeReplicaCount = sh.exec(`kubectl get deploy/selenium-chrome-node-91 -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout - if (seleniumChrome91NodeReplicaCount == '0') { - break; - } - console.log('Waiting for chrome 91 to scale down to 0 pods') - sh.exec('sleep 2s') - } - - const seleniumGridTestDeployTmpFile = tmp.fileSync(); - fs.writeFileSync( - seleniumGridTestDeployTmpFile.name, - seleniumGridTestsYaml - .replace(/{{JOB_NAME}}/g, seleniumGridTestName) - .replace(/{{CONTAINER_NAME}}/g, seleniumGridTestName) - .replace(/{{HOST_NAME}}/g, seleniumGridHostName) - .replace(/{{PORT}}/g, seleniumGridPort) - .replace(/{{WITH_VERSION}}/g, "true") - ); - - t.is(0, sh.exec(`kubectl apply --namespace ${seleniumGridNamespace} -f ${seleniumGridTestDeployTmpFile.name}`).code, 'creating a Selenium Grid Tests deployment should work.'); - - let seleniumChromeNodeReplicaCount = '0'; - let seleniumFireFoxReplicaCount = '0'; - let seleniumEdgeReplicaCount = '0'; - seleniumChrome91NodeReplicaCount = '0'; - for (let i = 0; i < 120; i++) { - seleniumChromeNodeReplicaCount = seleniumChromeNodeReplicaCount != '1' ? sh.exec(`kubectl get deploy/selenium-chrome-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumChromeNodeReplicaCount; - seleniumFireFoxReplicaCount = seleniumFireFoxReplicaCount != '1' ? sh.exec(`kubectl get deploy/selenium-firefox-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumFireFoxReplicaCount; - seleniumEdgeReplicaCount = seleniumEdgeReplicaCount != '1' ? sh.exec(`kubectl get deploy/selenium-edge-node -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumEdgeReplicaCount; - seleniumChrome91NodeReplicaCount = seleniumChrome91NodeReplicaCount != '1' ? sh.exec(`kubectl get deploy/selenium-chrome-node-91 -n ${seleniumGridNamespace} -o jsonpath='{.spec.replicas}'`).stdout : seleniumChrome91NodeReplicaCount; - if (seleniumChromeNodeReplicaCount == '1' && seleniumFireFoxReplicaCount == '1' && seleniumEdgeReplicaCount == '1' && seleniumChrome91NodeReplicaCount == '1') { - break; - } - console.log('Waiting for chrome to scale up 2 pods, firefox to 1 pod, and edge to 1 pod'); - sh.exec('sleep 2s') - } - - sh.exec(`kubectl delete job/${seleniumGridTestName} --namespace ${seleniumGridNamespace}`) - - t.is('1', seleniumChromeNodeReplicaCount, 'Selenium Chrome Node did not scale up to 1 pod') - t.is('1', seleniumChrome91NodeReplicaCount, 'Selenium Chrome 91 Node did not scale up to 1 pod') - t.is('1', seleniumFireFoxReplicaCount, 'Selenium Firefox Node did not scale up to 1 pod') - t.is('1', seleniumEdgeReplicaCount, 'Selenium Edge Node did not scale up to 1 pod') -}); - -test.after.always.cb('clean up prometheus deployment', t => { - let resources = [ - 'scaledobject.keda.sh/selenium-grid-chrome-scaledobject', - 'scaledobject.keda.sh/selenium-grid-firefox-scaledobject', - 'scaledobject.keda.sh/selenium-grid-edge-scaledobject', - 'service/selenium-chrome-node', - 'deployment.apps/selenium-chrome-node', - 'service/selenium-firefox-node', - 'deployment.apps/selenium-firefox-node', - 'service/selenium-edge-node', - 'deployment.apps/selenium-edge-node', - 'service/selenium-hub', - 'deployment.apps/selenium-hub', - `job/${seleniumGridTestName}`, - 'config/selenium-event-bus-config' - ] - - for (const resource of resources) { - sh.exec(`kubectl delete ${resource} --namespace ${seleniumGridNamespace}`) - } - sh.exec(`kubectl delete namespace ${seleniumGridNamespace}`) - - t.end() -}); - -const seleniumGridYaml = `--- -# Source: selenium-grid/templates/event-bus-configmap.yaml -apiVersion: v1 -kind: ConfigMap -metadata: - name: selenium-event-bus-config - namespace: {{NAMESPACE}} - labels: - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -data: - SE_EVENT_BUS_HOST: selenium-hub - SE_EVENT_BUS_PUBLISH_PORT: "4442" - SE_EVENT_BUS_SUBSCRIBE_PORT: "4443" ---- -# Source: selenium-grid/templates/chrome-node-service.yaml -apiVersion: v1 -kind: Service -metadata: - name: selenium-chrome-node - namespace: {{NAMESPACE}} - labels: - name: selenium-chrome-node - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - type: ClusterIP - selector: - app: selenium-chrome-node - ports: - - name: tcp-chrome - protocol: TCP - port: 6900 - targetPort: 5900 ---- -# Source: selenium-grid/templates/firefox-node-service.yaml -apiVersion: v1 -kind: Service -metadata: - name: selenium-firefox-node - namespace: {{NAMESPACE}} - labels: - name: selenium-firefox-node - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - type: ClusterIP - selector: - app: selenium-firefox-node - ports: - - name: tcp-firefox - protocol: TCP - port: 6900 - targetPort: 5900 ---- -apiVersion: v1 -kind: Service -metadata: - name: selenium-edge-node - namespace: {{NAMESPACE}} - labels: - name: selenium-edge-node - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - type: ClusterIP - selector: - app: selenium-edge-node - ports: - - name: tcp-edge - protocol: TCP - port: 6900 - targetPort: 5900 ---- -# Source: selenium-grid/templates/hub-service.yaml -apiVersion: v1 -kind: Service -metadata: - name: selenium-hub - namespace: {{NAMESPACE}} - labels: - app: selenium-hub - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - selector: - app: selenium-hub - type: NodePort - ports: - - name: http-hub - protocol: TCP - port: 4444 - targetPort: 4444 - - name: tcp-hub-pub - protocol: TCP - port: 4442 - targetPort: 4442 - - name: tcp-hub-sub - protocol: TCP - port: 4443 - targetPort: 4443 ---- -# Source: selenium-grid/templates/chrome-node-deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: selenium-chrome-node - namespace: {{NAMESPACE}} - labels: &chrome_node_labels - app: selenium-chrome-node - app.kubernetes.io/name: selenium-chrome-node - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - replicas: 0 - selector: - matchLabels: - app: selenium-chrome-node - template: - metadata: - labels: *chrome_node_labels - annotations: - checksum/event-bus-configmap: 0e5e9d25a669359a37dd0d684c485f4c05729da5a26a841ad9a2743d99460f73 - spec: - containers: - - name: selenium-chrome-node - image: selenium/node-chrome:4.0.0-rc-1-prerelease-20210618 - imagePullPolicy: IfNotPresent - envFrom: - - configMapRef: - name: selenium-event-bus-config - ports: - - containerPort: 5553 - protocol: TCP - volumeMounts: - - name: dshm - mountPath: /dev/shm - resources: - volumes: - - name: dshm - emptyDir: - medium: Memory - sizeLimit: 1Gi ---- -# Source: selenium-grid/templates/firefox-node-deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: selenium-firefox-node - namespace: {{NAMESPACE}} - labels: &firefox_node_labels - app: selenium-firefox-node - app.kubernetes.io/name: selenium-firefox-node - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - replicas: 0 - selector: - matchLabels: - app: selenium-firefox-node - template: - metadata: - labels: *firefox_node_labels - annotations: - checksum/event-bus-configmap: 0e5e9d25a669359a37dd0d684c485f4c05729da5a26a841ad9a2743d99460f73 - spec: - containers: - - name: selenium-firefox-node - image: selenium/node-firefox:4.0.0-rc-1-prerelease-20210618 - imagePullPolicy: IfNotPresent - envFrom: - - configMapRef: - name: selenium-event-bus-config - ports: - - containerPort: 5553 - protocol: TCP - volumeMounts: - - name: dshm - mountPath: /dev/shm - resources: - volumes: - - name: dshm - emptyDir: - medium: Memory - sizeLimit: 1Gi ---- -# Source: selenium-grid/templates/edge-node-deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: selenium-edge-node - namespace: {{NAMESPACE}} - labels: &edge_node_labels - app: selenium-edge-node - app.kubernetes.io/name: selenium-edge-node - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - replicas: 0 - selector: - matchLabels: - app: selenium-edge-node - template: - metadata: - labels: *edge_node_labels - annotations: - checksum/event-bus-configmap: 0e5e9d25a669359a37dd0d684c485f4c05729da5a26a841ad9a2743d99460f73 - spec: - containers: - - name: selenium-edge-node - image: selenium/node-edge:4.0.0-rc-1-prerelease-20210618 - imagePullPolicy: IfNotPresent - envFrom: - - configMapRef: - name: selenium-event-bus-config - ports: - - containerPort: 5553 - protocol: TCP - volumeMounts: - - name: dshm - mountPath: /dev/shm - resources: - volumes: - - name: dshm - emptyDir: - medium: Memory - sizeLimit: 1Gi ---- -# Source: selenium-grid/templates/hub-deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: selenium-hub - namespace: {{NAMESPACE}} - labels: &hub_labels - app: selenium-hub - app.kubernetes.io/name: selenium-hub - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - replicas: 1 - selector: - matchLabels: - app: selenium-hub - template: - metadata: - labels: *hub_labels - spec: - containers: - - name: selenium-hub - image: selenium/hub:4.0.0-rc-1-prerelease-20210618 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 4444 - protocol: TCP - - containerPort: 4442 - protocol: TCP - - containerPort: 4443 - protocol: TCP - livenessProbe: - httpGet: - path: /wd/hub/status - port: 4444 - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 10 - successThreshold: 1 - failureThreshold: 10 - readinessProbe: - httpGet: - path: /wd/hub/status - port: 4444 - initialDelaySeconds: 12 - periodSeconds: 10 - timeoutSeconds: 10 - successThreshold: 1 - failureThreshold: 10` - -const chrome91Yaml = `# Source: selenium-grid/templates/chrome-node-91-deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: selenium-chrome-node-91 - namespace: {{NAMESPACE}} - labels: &chrome_node_labels - app: selenium-chrome-node-91 - app.kubernetes.io/name: selenium-chrome-node-91 - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - replicas: 0 - selector: - matchLabels: - app: selenium-chrome-node-91 - template: - metadata: - labels: *chrome_node_labels - annotations: - checksum/event-bus-configmap: 0e5e9d25a669359a37dd0d684c485f4c05729da5a26a841ad9a2743d99460f73 - spec: - containers: - - name: selenium-chrome-node-91 - image: selenium/node-chrome:4.0.0-rc-1-prerelease-20210618 - imagePullPolicy: IfNotPresent - envFrom: - - configMapRef: - name: selenium-event-bus-config - ports: - - containerPort: 5553 - protocol: TCP - volumeMounts: - - name: dshm - mountPath: /dev/shm - resources: - volumes: - - name: dshm - emptyDir: - medium: Memory - sizeLimit: 1Gi ---- -# Source: selenium-grid/templates/chrome-node-91-service.yaml -apiVersion: v1 -kind: Service -metadata: - name: selenium-chrome-node-91 - namespace: {{NAMESPACE}} - labels: - name: selenium-chrome-node-91 - app.kubernetes.io/managed-by: helm - app.kubernetes.io/instance: selenium-hpa - app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 - app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 - helm.sh/chart: selenium-grid-0.2.0 -spec: - type: ClusterIP - selector: - app: selenium-chrome-node-91 - ports: - - name: tcp-chrome - protocol: TCP - port: 6900 - targetPort: 5900 ---- -# Source: selenium-grid/templates/chrome-node-91-hpa.yaml -apiVersion: keda.sh/v1alpha1 -kind: ScaledObject -metadata: - name: selenium-grid-chrome-91-scaledobject - namespace: {{NAMESPACE}} - labels: - deploymentName: selenium-chrome-node-91 -spec: - maxReplicaCount: 1 - pollingInterval: 5 - cooldownPeriod: 5 - scaleTargetRef: - name: selenium-chrome-node-91 - triggers: - - type: selenium-grid - metadata: - url: '{{SELENIUM_GRID_GRAPHQL_URL}}' - browserName: 'chrome' - browserVersion: '91.0' ----` - -const scaledObjectYaml = `--- -# Source: selenium-grid/templates/chrome-node-hpa.yaml -apiVersion: keda.sh/v1alpha1 -kind: ScaledObject -metadata: - name: selenium-grid-chrome-scaledobject - namespace: {{NAMESPACE}} - labels: - deploymentName: selenium-chrome-node -spec: - maxReplicaCount: 1 - pollingInterval: 5 - cooldownPeriod: 5 - scaleTargetRef: - name: selenium-chrome-node - triggers: - - type: selenium-grid - metadata: - url: '{{SELENIUM_GRID_GRAPHQL_URL}}' - browserName: 'chrome' ---- -# Source: selenium-grid/templates/firefox-node-hpa.yaml -apiVersion: keda.sh/v1alpha1 -kind: ScaledObject -metadata: - name: selenium-grid-firefox-scaledobject - namespace: {{NAMESPACE}} - labels: - deploymentName: selenium-firefox-node -spec: - maxReplicaCount: 1 - pollingInterval: 5 - cooldownPeriod: 5 - scaleTargetRef: - name: selenium-firefox-node - triggers: - - type: selenium-grid - metadata: - url: '{{SELENIUM_GRID_GRAPHQL_URL}}' - browserName: 'firefox' ---- -apiVersion: keda.sh/v1alpha1 -kind: ScaledObject -metadata: - name: selenium-grid-edge-scaledobject - namespace: {{NAMESPACE}} - labels: - deploymentName: selenium-edge-node -spec: - maxReplicaCount: 1 - pollingInterval: 5 - cooldownPeriod: 5 - scaleTargetRef: - name: selenium-edge-node - triggers: - - type: selenium-grid - metadata: - url: '{{SELENIUM_GRID_GRAPHQL_URL}}' - browserName: 'MicrosoftEdge' - sessionBrowserName: 'msedge'` - -const seleniumGridTestsYaml = `apiVersion: batch/v1 -kind: Job -metadata: - labels: - app: {{JOB_NAME}} - name: {{JOB_NAME}} -spec: - template: - metadata: - labels: - app: {{JOB_NAME}} - spec: - containers: - - name: {{CONTAINER_NAME}} - image: ghcr.io/kedacore/tests-selenium-grid - imagePullPolicy: Always - env: - - name: HOST_NAME - value: "{{HOST_NAME}}" - - name: PORT - value: "{{PORT}}" - - name: WITH_VERSION - value: "{{WITH_VERSION}}" - restartPolicy: Never` diff --git a/tests/scalers_go/selenium/selenium_test.go b/tests/scalers_go/selenium/selenium_test.go new file mode 100644 index 00000000000..0d5451bcb18 --- /dev/null +++ b/tests/scalers_go/selenium/selenium_test.go @@ -0,0 +1,550 @@ +//go:build e2e +// +build e2e + +package selenium_test + +import ( + "fmt" + "testing" + "time" + + "github.com/joho/godotenv" + "github.com/stretchr/testify/assert" + "k8s.io/client-go/kubernetes" + + . "github.com/kedacore/keda/v2/tests/helper" +) + +// Load environment variables from .env file +var _ = godotenv.Load("../../.env") + +const ( + testName = "selenium-test" +) + +var ( + testNamespace = fmt.Sprintf("%s-ns", testName) + chromeDeploymentName = fmt.Sprintf("%s-chrome", testName) + firefoxDeploymentName = fmt.Sprintf("%s-firefox", testName) + edgeDeploymentName = fmt.Sprintf("%s-edge", testName) + hubDeploymentName = fmt.Sprintf("%s-hub", testName) + scaledObjectName = fmt.Sprintf("%s-so", testName) + hubHost = fmt.Sprintf("selenium-hub.%s", testNamespace) + hubPort = 4444 + hubGraphURL = fmt.Sprintf("http://%s:%d/graphql", hubHost, hubPort) + minReplicaCount = 0 + maxReplicaCount = 1 +) + +type templateData struct { + TestNamespace string + ChromeDeploymentName string + FirefoxDeploymentName string + EdgeDeploymentName string + HubDeploymentName string + HubHost string + HubPort int + HubGraphURL string + WithVersion bool + JobName string + ScaledObjectName string + MinReplicaCount int + MaxReplicaCount int +} + +type templateValues map[string]string + +const ( + eventBusConfigTemplate = ` +apiVersion: v1 +kind: ConfigMap +metadata: + name: selenium-event-bus-config + namespace: {{.TestNamespace}} + labels: + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +data: + SE_EVENT_BUS_HOST: selenium-hub + SE_EVENT_BUS_PUBLISH_PORT: "4442" + SE_EVENT_BUS_SUBSCRIBE_PORT: "4443" +` + + chromeNodeServiceTemplate = ` +apiVersion: v1 +kind: Service +metadata: + name: selenium-chrome-node + namespace: {{.TestNamespace}} + labels: + name: selenium-chrome-node + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + type: ClusterIP + selector: + app: selenium-chrome-node + ports: + - name: tcp-chrome + protocol: TCP + port: 6900 + targetPort: 5900 +` + + chromeNodeDeploymentTemplate = ` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.ChromeDeploymentName}} + namespace: {{.TestNamespace}} + labels: &chrome_node_labels + app: selenium-chrome-node + app.kubernetes.io/name: selenium-chrome-node + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + replicas: 0 + selector: + matchLabels: + app: selenium-chrome-node + template: + metadata: + labels: *chrome_node_labels + annotations: + checksum/event-bus-configmap: 0e5e9d25a669359a37dd0d684c485f4c05729da5a26a841ad9a2743d99460f73 + spec: + containers: + - name: selenium-chrome-node + image: selenium/node-chrome:4.0.0-rc-1-prerelease-20210618 + imagePullPolicy: IfNotPresent + envFrom: + - configMapRef: + name: selenium-event-bus-config + ports: + - containerPort: 5553 + protocol: TCP + volumeMounts: + - name: dshm + mountPath: /dev/shm + resources: {} + volumes: + - name: dshm + emptyDir: + medium: Memory + sizeLimit: 1Gi +` + + chromeScaledObjectTemplate = ` +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: chrome-{{.ScaledObjectName}} + namespace: {{.TestNamespace}} +spec: + maxReplicaCount: 1 + pollingInterval: 5 + cooldownPeriod: 5 + scaleTargetRef: + name: {{.ChromeDeploymentName}} + triggers: + - type: selenium-grid + metadata: + url: '{{.HubGraphURL}}' + browserName: 'chrome' + activationThreshold: '1' +` + + firefoxNodeServiceTemplate = ` +apiVersion: v1 +kind: Service +metadata: + name: selenium-firefox-node + namespace: {{.TestNamespace}} + labels: + name: selenium-firefox-node + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + type: ClusterIP + selector: + app: selenium-firefox-node + ports: + - name: tcp-firefox + protocol: TCP + port: 6900 + targetPort: 5900` + + firefoxNodeDeploymentTemplate = ` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.FirefoxDeploymentName}} + namespace: {{.TestNamespace}} + labels: &firefox_node_labels + app: selenium-firefox-node + app.kubernetes.io/name: selenium-firefox-node + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + replicas: 0 + selector: + matchLabels: + app: selenium-firefox-node + template: + metadata: + labels: *firefox_node_labels + annotations: + checksum/event-bus-configmap: 0e5e9d25a669359a37dd0d684c485f4c05729da5a26a841ad9a2743d99460f73 + spec: + containers: + - name: selenium-firefox-node + image: selenium/node-firefox:4.0.0-rc-1-prerelease-20210618 + imagePullPolicy: IfNotPresent + envFrom: + - configMapRef: + name: selenium-event-bus-config + ports: + - containerPort: 5553 + protocol: TCP + volumeMounts: + - name: dshm + mountPath: /dev/shm + resources: {} + volumes: + - name: dshm + emptyDir: + medium: Memory + sizeLimit: 1Gi +` + + firefoxScaledObjectTemplate = ` +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: firefox-{{.ScaledObjectName}} + namespace: {{.TestNamespace}} +spec: + maxReplicaCount: 1 + pollingInterval: 5 + cooldownPeriod: 5 + scaleTargetRef: + name: {{.FirefoxDeploymentName}} + triggers: + - type: selenium-grid + metadata: + url: '{{.HubGraphURL}}' + browserName: 'firefox' + activationThreshold: '1' +` + + edgeNodeServiceTemplate = ` +apiVersion: v1 +kind: Service +metadata: + name: selenium-edge-node + namespace: {{.TestNamespace}} + labels: + name: selenium-edge-node + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + type: ClusterIP + selector: + app: selenium-edge-node + ports: + - name: tcp-edge + protocol: TCP + port: 6900 + targetPort: 5900 +` + + edgeNodeDeploymentTemplate = ` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.EdgeDeploymentName}} + namespace: {{.TestNamespace}} + labels: &edge_node_labels + app: selenium-edge-node + app.kubernetes.io/name: selenium-edge-node + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + replicas: 0 + selector: + matchLabels: + app: selenium-edge-node + template: + metadata: + labels: *edge_node_labels + annotations: + checksum/event-bus-configmap: 0e5e9d25a669359a37dd0d684c485f4c05729da5a26a841ad9a2743d99460f73 + spec: + containers: + - name: selenium-edge-node + image: selenium/node-edge:4.0.0-rc-1-prerelease-20210618 + imagePullPolicy: IfNotPresent + envFrom: + - configMapRef: + name: selenium-event-bus-config + ports: + - containerPort: 5553 + protocol: TCP + volumeMounts: + - name: dshm + mountPath: /dev/shm + resources: {} + volumes: + - name: dshm + emptyDir: + medium: Memory + sizeLimit: 1Gi +` + + edgeScaledObjectTemplate = ` +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: edge-{{.ScaledObjectName}} + namespace: {{.TestNamespace}} +spec: + maxReplicaCount: 1 + pollingInterval: 5 + cooldownPeriod: 5 + scaleTargetRef: + name: {{.EdgeDeploymentName}} + triggers: + - type: selenium-grid + metadata: + url: '{{.HubGraphURL}}' + browserName: 'MicrosoftEdge' + sessionBrowserName: 'msedge' + activationThreshold: '1' +` + + hubServiceTemplate = ` +apiVersion: v1 +kind: Service +metadata: + name: selenium-hub + namespace: {{.TestNamespace}} + labels: + app: selenium-hub + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + selector: + app: selenium-hub + type: NodePort + ports: + - name: http-hub + protocol: TCP + port: 4444 + targetPort: 4444 + - name: tcp-hub-pub + protocol: TCP + port: 4442 + targetPort: 4442 + - name: tcp-hub-sub + protocol: TCP + port: 4443 + targetPort: 4443 +` + + hubDeploymentTemplate = ` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.HubDeploymentName}} + namespace: {{.TestNamespace}} + labels: &hub_labels + app: selenium-hub + app.kubernetes.io/name: selenium-hub + app.kubernetes.io/managed-by: helm + app.kubernetes.io/instance: selenium-hpa + app.kubernetes.io/version: 4.0.0-beta-1-prerelease-20210114 + app.kubernetes.io/component: selenium-grid-4.0.0-beta-1-prerelease-20210114 + helm.sh/chart: selenium-grid-0.2.0 +spec: + replicas: 1 + selector: + matchLabels: + app: selenium-hub + template: + metadata: + labels: *hub_labels + spec: + containers: + - name: selenium-hub + image: selenium/hub:4.0.0-rc-1-prerelease-20210618 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 4444 + protocol: TCP + - containerPort: 4442 + protocol: TCP + - containerPort: 4443 + protocol: TCP + livenessProbe: + httpGet: + path: /wd/hub/status + port: 4444 + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 10 + successThreshold: 1 + failureThreshold: 10 + readinessProbe: + httpGet: + path: /wd/hub/status + port: 4444 + initialDelaySeconds: 12 + periodSeconds: 10 + timeoutSeconds: 10 + successThreshold: 1 + failureThreshold: 10 +` + + jobTemplate = ` +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app: {{.JobName}} + name: {{.JobName}} + namespace: {{.TestNamespace}} +spec: + ttlSecondsAfterFinished: 0 + template: + metadata: + labels: + app: {{.JobName}} + spec: + containers: + - name: selenium-random-tests + image: ghcr.io/kedacore/tests-selenium-grid + imagePullPolicy: Always + env: + - name: HOST_NAME + value: "{{.HubHost}}" + - name: PORT + value: "{{.HubPort}}" + - name: WITH_VERSION + value: "{{.WithVersion}}" + restartPolicy: Never +` +) + +func TestScaler(t *testing.T) { + // Create kubernetes resources + kc := GetKubernetesClient(t) + data, templates := getTemplateData() + CreateKubernetesResources(t, kc, testNamespace, data, templates) + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, hubDeploymentName, testNamespace, 1, 60, 1), + "replica count should be 1 after 1 minute") + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, chromeDeploymentName, testNamespace, minReplicaCount, 60, 1), + "replica count should be 0 after 1 minute") + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, firefoxDeploymentName, testNamespace, minReplicaCount, 60, 1), + "replica count should be 0 after 1 minute") + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, edgeDeploymentName, testNamespace, minReplicaCount, 60, 1), + "replica count should be 0 after 1 minute") + + testActivation(t, kc, data) + testScaleUp(t, kc, data) + testScaleDown(t, kc) + + // cleanup + DeleteKubernetesResources(t, kc, testNamespace, data, templates) +} + +func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { + t.Log("--- testing activation ---") + data.JobName = "activation" + data.WithVersion = false + KubectlApplyWithTemplate(t, data, "jobTemplate", jobTemplate) + + // Instead of waiting a minute with every one, we sleep the time and check them later + time.Sleep(time.Second * 60) + AssertReplicaCountNotChangeDuringTimePeriod(t, kc, chromeDeploymentName, testNamespace, minReplicaCount, 5) + AssertReplicaCountNotChangeDuringTimePeriod(t, kc, firefoxDeploymentName, testNamespace, minReplicaCount, 5) + AssertReplicaCountNotChangeDuringTimePeriod(t, kc, edgeDeploymentName, testNamespace, minReplicaCount, 5) +} + +func testScaleUp(t *testing.T, kc *kubernetes.Clientset, data templateData) { + t.Log("--- testing scale up ---") + + data.JobName = "scaleup" + data.WithVersion = false + KubectlApplyWithTemplate(t, data, "jobTemplate", jobTemplate) + + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, chromeDeploymentName, testNamespace, maxReplicaCount, 60, 1), + "replica count should be %s after 1 minute", maxReplicaCount) + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, firefoxDeploymentName, testNamespace, maxReplicaCount, 60, 1), + "replica count should be %s after 1 minute", maxReplicaCount) + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, edgeDeploymentName, testNamespace, maxReplicaCount, 60, 1), + "replica count should be %s after 1 minute", maxReplicaCount) +} + +func testScaleDown(t *testing.T, kc *kubernetes.Clientset) { + t.Log("--- testing scale down ---") + + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, chromeDeploymentName, testNamespace, minReplicaCount, 60, 3), + "replica count should be %s after 3 minutes", minReplicaCount) + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, firefoxDeploymentName, testNamespace, minReplicaCount, 60, 3), + "replica count should be %s after 3 minutes", minReplicaCount) + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, edgeDeploymentName, testNamespace, minReplicaCount, 60, 3), + "replica count should be %s after 3 minutes", minReplicaCount) +} + +func getTemplateData() (templateData, map[string]string) { + return templateData{ + TestNamespace: testNamespace, + ChromeDeploymentName: chromeDeploymentName, + FirefoxDeploymentName: firefoxDeploymentName, + EdgeDeploymentName: edgeDeploymentName, + HubDeploymentName: hubDeploymentName, + HubHost: hubHost, + HubPort: hubPort, + HubGraphURL: hubGraphURL, + ScaledObjectName: scaledObjectName, + MinReplicaCount: minReplicaCount, + MaxReplicaCount: maxReplicaCount, + }, templateValues{ + "eventBusConfigTemplate": eventBusConfigTemplate, + "hubDeploymentTemplate": hubDeploymentTemplate, + "hubServiceTemplate": hubServiceTemplate, + "chromeNodeServiceTemplate": chromeNodeServiceTemplate, + "chromeNodeDeploymentTemplate": chromeNodeDeploymentTemplate, + "chromeScaledObjectTemplate": chromeScaledObjectTemplate, + "firefoxNodeServiceTemplate": firefoxNodeServiceTemplate, + "firefoxNodeDeploymentTemplate": firefoxNodeDeploymentTemplate, + "firefoxScaledObjectTemplate": firefoxScaledObjectTemplate, + "edgeNodeServiceTemplate": edgeNodeServiceTemplate, + "edgeNodeDeploymentTemplate": edgeNodeDeploymentTemplate, + "edgeScaledObjectTemplate": edgeScaledObjectTemplate, + } +}