apiVersion: apps/v1
kind: Deployment
metadata:
  name: $APP
  labels:
    app: $APP
spec:
  replicas: 2
  selector:
    matchLabels:
      app: $APP
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  template:
    metadata:
      labels:
        app: $APP
    spec:
      containers:
        - name: $APP
          image: $IMAGE
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: 200m
              memory: 200Mi
            limits:
              cpu: 300m
              memory: 400Mi
          ports:
            - containerPort: 8080
          livenessProbe:
            initialDelaySeconds: 30
            httpGet:
              path: /health
              port: 8080
          readinessProbe:
            initialDelaySeconds: 30
            httpGet:
              path: /health
              port: 8080
          env:
            - name: CACHE_REFRESH_INTERVAL
              value: "3600"
            - name: REDIS_URL
              value: rediss://10.37.248.211:6378
            - name: USE_MEMORY_CACHE
              value: "true"
            - name: APP_WEB_URL
              value: https://www.clinq.app/settings/integrations/oauth/callback
            - name: CLIENT_ID
              value: 36bc4ebf413cf06b
            - name: OAUTH_IDENTIFIER
              value: PIPEDRIVE
            - name: REDIRECT_URL
              value: https://$DOMAIN/oauth2/callback
            - name: CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  name: $APP
                  key: clientSecret
