apiVersion: apps/v1
kind: Deployment
metadata:
  name: gisp-scraper
  labels:
    app: gisp-scraper
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gisp-scraper
  template:
    metadata:
      labels:
        app: gisp-scraper
    spec:
      containers:
      - name: gisp-scraper
        image: git.danilkolesnikov.ru/flash/gisp-scraper:latest
        env:
        - name: SELENIUM_HUB_URL
          value: "http://selenium-hub:4444/wd/hub"
        ports:
        - containerPort: 8000
---
apiVersion: v1
kind: Service
metadata:
  name: gisp-scraper
spec:
  selector:
    app: gisp-scraper
  ports:
    - protocol: TCP
      port: 8000
      targetPort: 8000
      nodePort: 30001
  type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: selenium-hub
spec:
  replicas: 1
  selector:
    matchLabels:
      app: selenium-hub
  template:
    metadata:
      labels:
        app: selenium-hub
    spec:
      containers:
      - name: selenium-hub
        image: selenium/hub:4.16.1
        ports:
        - containerPort: 4444
---
apiVersion: v1
kind: Service
metadata:
  name: selenium-hub
spec:
  selector:
    app: selenium-hub
  ports:
    - protocol: TCP
      port: 4444
      targetPort: 4444
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: selenium-node-chrome
spec:
  replicas: 1
  selector:
    matchLabels:
      app: selenium-node-chrome
  template:
    metadata:
      labels:
        app: selenium-node-chrome
    spec:
      containers:
      - name: selenium-node-chrome
        image: selenium/node-chrome:4.16.1
        env:
        - name: SE_EVENT_BUS_HOST
          value: selenium-hub
        - name: SE_EVENT_BUS_PUBLISH_PORT
          value: "4442"
        - name: SE_EVENT_BUS_SUBSCRIBE_PORT
          value: "4443"
        - name: SHM_SIZE
          value: "2g"
        volumeMounts:
        - name: dshm
          mountPath: /dev/shm
      volumes:
      - name: dshm
        emptyDir:
          medium: Memory
