{{ if .Values.scrapper.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: scrapper
spec:
  replicas: 1
  selector:
    matchLabels:
      app: scrapper
  template:
    metadata:
      name: scrapper
      labels:
        app: scrapper
    spec:
      containers:
      - name: scrapper
        image: docker.io/goalprofit/scrapper
        imagePullPolicy: Always
        ports:
          - containerPort: 3000
        env:
          - name: NODE_TLS_REJECT_UNAUTHORIZED
            value: "0"
        readinessProbe:
          tcpSocket:
            port: 3000
          initialDelaySeconds: 5
          periodSeconds: 10
        livenessProbe:
          tcpSocket:
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 20
      imagePullSecrets:
      - name: regcred
      {{ include "app.affinity" . | nindent 6}}
---
apiVersion: v1
kind: Service
metadata:
  name: scrapper
spec:
  type: ClusterIP
  selector:
    app: scrapper
  ports:
    - name: http
      protocol: TCP
      port: 3000
      targetPort: 3000
{{ end }}