---
apiVersion: apps/v1
kind: Deployment

metadata:
  name: sweetrpg-COMPONENT-web

spec:
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  selector:
    matchLabels:
      platform: sweetrpg
      app: COMPONENT
      component: web
  template:
    metadata:
      labels:
        platform: sweetrpg
        app: COMPONENT
        component: web
    spec:
      serviceAccountName: sweetrpg-COMPONENT-web
      imagePullSecrets:
        - name: sweetrpg-registry
      containers:
        - name: COMPONENT-web-app
          image: registry.sweetrpg.com/sweetrpg-COMPONENT-web:latest
          imagePullPolicy: Always
          envFrom:
            - configMapRef:
                name: sweetrpg-COMPONENT-web
            - configMapRef:
                name: sweetrpg-COMPONENT-web-env
            - secretRef:
                name: sweetrpg-COMPONENT-web
            - secretRef:
                name: sweetrpg-COMPONENT-web-env
          env:
            - name: NEW_RELIC_CONFIG_FILE
              value: /config/newrelic.ini
          ports:
            - containerPort: 8281
              name: http
          resources:
            requests:
              cpu: "20m"
              memory: "55M"
            limits:
              cpu: "100m"
              memory: "256M"
          livenessProbe:
            httpGet:
              path: /health/ping
              port: 8281
            initialDelaySeconds: 90
            timeoutSeconds: 10
          readinessProbe:
            httpGet:
              path: /health/ping
              port: 8281
            initialDelaySeconds: 30
            timeoutSeconds: 10
          volumeMounts:
            - mountPath: /data
              name: data
            - mountPath: /config
              name: config
      volumes:
        - name: config
          secret:
            secretName: sweetrpg-COMPONENT-web-config-env
            items:
              - key: newrelic.ini
                path: newrelic.ini
        - name: data
          emptyDir: {}
      restartPolicy: Always
