apiVersion: apps/v1
kind: Deployment
metadata:
  name: front-door-svc
  annotations:
    monitor: monitor
    javaDebug: javaDebug
    pullSecrets: pullSecrets
spec:
  replicas: 1
  selector:
    matchLabels:
      app: front-door-svc
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: front-door-svc
    spec:
      containers:
        - image: front-door-service
          name: spring-boot-service-container
          imagePullPolicy: IfNotPresent
          livenessProbe:
            httpGet:
              path: /monitoring/health
              port: 8080
            initialDelaySeconds: 180
            periodSeconds: 31
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /monitoring/health
              port: 8080
            initialDelaySeconds: 180
            periodSeconds: 5
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 1
          env:
            - name: SPRING_APPLICATION_JSON
              valueFrom:
                configMapKeyRef:
                  name: web-config
                  key: SPRING_APPLICATION_JSON
            - name: IFS_WEB_GOOGLEANALYTICS_TRACKINGID
              valueFrom:
                configMapKeyRef:
                  name: web-config
                  key: IFS_WEB_GOOGLEANALYTICS_TRACKINGID
            - name: IFS_WEB_SYSTEM_USER_UID
              valueFrom:
                configMapKeyRef:
                  name: web-config
                  key: IFS_WEB_SYSTEM_USER_UID
            - name: NEW_RELIC_LICENSE_KEY
              valueFrom:
                configMapKeyRef:
                  name: new-relic-config
                  key: NEW_RELIC_LICENSE_KEY
            - name: NEW_RELIC_LOG
              valueFrom:
                configMapKeyRef:
                  name: new-relic-config
                  key: NEW_RELIC_LOG
            - name: IFS_SUBSIDY_CONTROL_NORTHERN_IRELAND_ENABLED
              valueFrom:
                configMapKeyRef:
                  name: feature-toggle-config
                  key: IFS_SUBSIDY_CONTROL_NORTHERN_IRELAND_ENABLED
            - name: SPRING_PROFILES_ACTIVE
              valueFrom:
                configMapKeyRef:
                  name: spring-config
                  key: SPRING_PROFILES_ACTIVE
            - name: IFS_WEB_BASEURL
              valueFrom:
                configMapKeyRef:
                  name: web-config
                  key: IFS_WEB_BASEURL
            - name: NEW_RELIC_APP_NAME
              value: "ifs-front-door-service (${openshiftEnv})"
            - name: JAVA_OPTS
              value: -Xms1000m -Xmx1000m -javaagent:/newrelic.jar
          ports:
            - containerPort: 8080
          resources:
            limits:
              cpu: 1000m
            requests:
              cpu: 100m
              memory: 1G