Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Unable to change node stereotype #1523

Closed
Wolfe1 opened this issue Mar 9, 2022 · 5 comments
Closed

[🐛 Bug]: Unable to change node stereotype #1523

Wolfe1 opened this issue Mar 9, 2022 · 5 comments

Comments

@Wolfe1
Copy link

Wolfe1 commented Mar 9, 2022

What happened?

I am currently attempting to change the browserName stereotype of a node via the cli command:

--driver-configuration display_name='msedge' stereotype='{"browserName":"msedge"}'

The command seems to be accepted but ends up being ignored:
image

Command used to start Selenium Grid with Docker

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: selenium-node-edge
  name: selenium-edge-node-deployment
  namespace: legion-selenium-grid
spec:
  minReadySeconds: 5
  progressDeadlineSeconds: 900
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: selenium-node-edge
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: selenium-node-edge
    spec:
      nodeSelector:
        agentpool: selenium
      priorityClassName: high-priority
      terminationGracePeriodSeconds: 3600
      containers:
      - env:
          - name: SE_EVENT_BUS_HOST
            value: "selenium-grid"
          - name: SE_EVENT_BUS_SUBSCRIBE_PORT
            value: "4443"
          - name: SE_EVENT_BUS_PUBLISH_PORT
            value: "4442"
          - name: SCREEN_WIDTH
            value: "1920"
          - name: SCREEN_HEIGHT
            value: "1080"
          - name: VNC_NO_PASSWORD
            value: "1"
          - name: SE_OPTS
            value: --driver-configuration display_name='msedge' stereotype='{"browserName":"msedge"}'
        image: selenium/node-edge:latest
        imagePullPolicy: IfNotPresent
        name: selenium-node-edge
        ports:
        - containerPort: 5555
        securityContext:
          allowPrivilegeEscalation: true
          capabilities: {}
          privileged: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /dev/shm
          name: dshm
        resources:
            requests:
              memory: "1000Mi"
              cpu: "0.5"
            limits:
              cpu: "1"
        lifecycle:
          preStop:
            exec:
              command: ["/bin/sh", "-c", "tail --pid=$(pgrep -f '[o]pt/selenium/msedgedriver') -f /dev/null; curl --request POST 'localhost:5555/se/grid/node/drain' --header 'X-REGISTRATION-SECRET;'; tail --pid=$(pgrep -f '[n]ode --bind-host false --config /opt/selenium/config.toml') -f /dev/null"]
      dnsConfig: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      volumes:
      - name: dshm
        emptyDir: { "medium": "Memory" }

Relevant log output

Setting up SE_NODE_PORT...
Setting up SE_NODE_GRID_URL...
Selenium Grid Node configuration: 
[events]
publish = "tcp://selenium-grid:4442"
subscribe = "tcp://selenium-grid:4443"

[node]
session-timeout = "300"
override-max-sessions = false
detect-drivers = false
max-sessions = 1

[[node.driver-configuration]]
display-name = "MicrosoftEdge"
stereotype = '{"browserName": "MicrosoftEdge", "browserVersion": "98.0", "platformName": "Linux"}'
max-sessions = 1

Starting Selenium Grid Node...
18:55:10.839 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
18:55:10.842 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
18:55:11.042 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://selenium-grid:4442 and tcp://selenium-grid:4443
18:55:11.149 INFO [UnboundZmqEventBus.<init>] - Sockets created
18:55:12.151 INFO [UnboundZmqEventBus.<init>] - Event bus ready
18:55:12.335 INFO [NodeServer.createHandlers] - Reporting self as: http://10.196.168.15:5555
18:55:12.350 INFO [NodeOptions.getSessionFactories] - Detected 1 available processors
18:55:12.440 INFO [NodeOptions.report] - Adding MicrosoftEdge for {"browserVersion": "98.0","browserName": "MicrosoftEdge","platformName": "Linux","se:vncEnabled": true} 1 times
18:55:12.448 INFO [Node.<init>] - Binding additional locator mechanisms: id, name, relative
18:55:12.832 INFO [NodeServer$1.start] - Starting registration process for node id 7607a04c-a4ba-4f72-b1e8-ac132e6d2e35
18:55:12.833 INFO [NodeServer.execute] - Started Selenium node 4.1.2 (revision 9a5a329c5a): http://10.196.168.15:5555
18:55:12.836 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
18:55:13.681 INFO [NodeServer.lambda$createHandlers$2] - Node has been added

Operating System

AKS, Linux

Docker Selenium version (tag)

4.1.2

@diemol
Copy link
Member

diemol commented Mar 25, 2022

Most likely ends up being ignored because the configuration is read and then it looks for a driver to handle the configured browserName, and there is no driver in the Java code for msedge (rather for MicrosoftEdge).

Why do you need to match msedge?

We can also chat more in https://www.selenium.dev/support/#ChatRoom (I believe we are already in touch over there).

I will close the issue but we can continue the conversation here or in Slack.

@diemol diemol closed this as completed Mar 25, 2022
@Wolfe1
Copy link
Author

Wolfe1 commented Mar 25, 2022

@diemol I am attempting to get my grid to autoscale with keda which uses the BrowserName as a reference. Currently, I use "MicrosoftEdge" which works great for scaling the grid up as the new sessions in the queue appear as "MicrosoftEdge" as intended.

The issue appears when we want to scale down as it checks for that same BrowserName in the active sessions. Unlike chrome or firefox, this BrowserName changes for "MicrosoftEdge" to "msedge" when it is a part of an active session. This causes the scaler to think that no sessions are in use (for "MicrosoftEdge") and immediately calls for a full scale down even if tests are running.

This is explained a bit more in detail in my bug/enhancement ticket with keda I was trying to push as a workaround: kedacore/keda#2709

@Wolfe1
Copy link
Author

Wolfe1 commented May 31, 2022

Got KEDA to fix this so its no longer needed.

Documented here in case it helps anyone in the future: https://www.linkedin.com/pulse/scaling-kubernetes-selenium-grid-keda-brandon-wolfe/

@diemol
Copy link
Member

diemol commented Jun 27, 2022

@Wolfe1 great! Would you like to re-post it at the Selenium blog?
https://github.com/SeleniumHQ/seleniumhq.github.io/tree/trunk/website_and_docs/content/blog/2022

@Wolfe1
Copy link
Author

Wolfe1 commented Jun 27, 2022

@diemol

image

SeleniumHQ/seleniumhq.github.io#1062

@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants