#
#  Author: Hari Sekhon
#  Date: 2021-05-19 13:23:25 +0100 (Wed, 19 May 2021)
#
#  vim:ts=2:sts=2:sw=2:et
#
#  https://github.com/harisekhon/Kubernetes-configs
#
#  License: see accompanying Hari Sekhon LICENSE file
#
#  If you're using my code you're welcome to connect with me on LinkedIn
#  and optionally send me feedback to help improve or steer this or other code I publish
#
#  https://www.linkedin.com/in/HariSekhon
#

# ============================================================================ #
#                 S e l e n i u m   G r i d   E v e n t   B u s
# ============================================================================ #

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: selenium-event-bus
  namespace: selenium
  labels:
    app: selenium-event-bus
spec:
  replicas: 1
  selector:
    matchLabels:
      app: selenium-event-bus
  template:
    metadata:
      labels:
        app: selenium-event-bus
    spec:
      priorityClassName: high-priority
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: cloud.google.com/gke-preemptible
                    operator: DoesNotExist
                  - key: eks.amazonaws.com/capacityType
                    operator: NotIn
                    values:
                      - SPOT
                  - key: kubernetes.azure.com/scalesetpriority
                    operator: NotIn
                    values:
                      - spot
      securityContext:
        runAsNonRoot: true
      containers:
        - name: selenium-event-bus
          image: selenium/event-bus:4.0.0
          ports:
            - containerPort: 4442
            - containerPort: 4443
            - containerPort: 5557
          env:
            - name: JAVA_OPTS
              value: "-Xmx512m"
          readinessProbe:
            tcpSocket:
              port: 4442
            initialDelaySeconds: 10
          livenessProbe:
            tcpSocket:
              port: 4442
            initialDelaySeconds: 30
          resources:
            limits:
              cpu: 2
              memory: 1Gi
            requests:
              cpu: 100m
              memory: 600Mi
