apiVersion: apps/v1
kind: Deployment
metadata:
  name: rss-hub
  labels:
    app: rss-hub
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rss-hub
  template:
    metadata:
      labels:
        app: rss-hub
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: In
                    values:
                      - node-tokyo-0
      containers:
        - name: rss-hub
          image: diygod/rsshub:2022-04-06
          env:
            - name: NODE_ENV
              value: production
            - name: CACHE_TYPE
              value: redis
            - name: REDIS_URL
              value: redis://my-redis-master.default.svc.wdd.io:6379/
            - name: PUPPETEER_WS_ENDPOINT
              value: ws://browserless-chrome-svc.default.svc.wdd.io:3000
            - name: REQUEST_TIMEOUT
              value: "36000"
            - name: REQUEST_RETRY
              value: "5"
            - name: UA
              value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.36"
            - name: ALLOW_ORIGIN
              value: "*"
            - name: ACCESS_KEY
              value: "woshinibaba"
          ports:
            - containerPort: 1200
---
kind: Service
apiVersion: v1
metadata:
  name: rss-hub-svc
spec:
  type: ClusterIP
  selector:
    app: rss-hub
  ports:
    - protocol: TCP
      port: 1200
      targetPort: 1200
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: rss-hub-ingress
  annotations:
    cert-manager.io/cluster-issuer: "cm-cf"
    kubernetes.io/ingress.class: "traefik"
spec:
  rules:
    - host: rsshub.107421.xyz
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: rss-hub-svc
                port:
                  number: 1200
  tls:
    - hosts:
        - rsshub.107421.xyz
      secretName: rsshub.107421.xyz-tls
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: browserless-chrome
  labels:
    app: browserless-chrome
spec:
  replicas: 1
  selector:
    matchLabels:
      app: browserless-chrome
  template:
    metadata:
      labels:
        app: browserless-chrome
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: In
                    values:
                      - node-tokyo-0
      containers:
        - name: browserless-chrome
          image: browserless/chrome

          ports:
            - containerPort: 3000
---
kind: Service
apiVersion: v1
metadata:
  name: browserless-chrome-svc
spec:
  type: ClusterIP
  selector:
    app: browserless-chrome
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
