apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: project-posted
  name: project-posted
  annotations:
    fluxcd.io/automated: "true"
    fluxcd.io/tag.project-posted: regex:^sha.*
  labels:
    app: project-posted
spec:
  replicas: 1
  selector:
    matchLabels:
      app: project-posted
  template:
    metadata:
      labels:
        app: project-posted
    spec:
      containers:
      - name: project-posted
        image: devlaunchers/project_posted:sha-ac630bct
        env:
        - name: MONGOURL
          valueFrom:
            secretKeyRef:
              name: project-posted
              key: mongourl
        - name: PORT
          value: "3000"
        ports:
        - containerPort: 3000
        resources:
          limits:
            cpu: 100m
            memory: 64Mi
          requests:
            cpu: 25m
            memory: 16Mi
        livenessProbe:
          httpGet:
            path: /metrics
            port: 3000
          initialDelaySeconds: 60
          periodSeconds: 10
          timeoutSeconds: 10
          failureThreshold: 5
      - name: tunnel
        image: devlaunchers/sidecar:updater2
        ports:
        - containerPort: 5000
        command: ["cloudflared", "tunnel"]
        args:
        - --url=http://localhost:3000
        - --metrics=:5000
        - --proxy-tls-timeout=60s
        - --proxy-connect-timeout=60s
        - --no-autoupdate
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: APP_NAME
          value: project-posted
        - name: TUNNEL_METRICS_URL
          value: "http://localhost:5000/metrics"
        - name: UPDATE_TIMEOUT
          value: "120s"
        - name: MAPPER_TOKEN
          valueFrom:
            secretKeyRef:
              name: project-posted-tunnel
              key: mapper-token
        - name: MAPPER_URL
          valueFrom:
            secretKeyRef:
              name: project-posted-tunnel
              key: mapper-url
        resources:
          limits:
            cpu: 40m
            memory: 64Mi
          requests:
            cpu: 20m
            memory: 32Mi
        startupProbe:
          exec:
            command:
            - /usr/local/bin/update
          initialDelaySeconds: 10
          periodSeconds: 30
          timeoutSeconds: 120
          failureThreshold: 5
        livenessProbe:
          tcpSocket:
            port: 5000
          initialDelaySeconds: 60
          periodSeconds: 20
          timeoutSeconds: 30
          failureThreshold: 5
