---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: aap-ui
  name: '{{ ansible_operator_meta.name }}-aapui'
  namespace: '{{ ansible_operator_meta.namespace }}'
spec:
  selector:
    matchLabels:
      app: aap-ui
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: aap-ui
    spec:
{% if image_pull_secret %}
      imagePullSecrets:
        - name: {{ image_pull_secret }}
{% endif %}
      containers:
      - image: '{{ ui_image }}'
        imagePullPolicy: Always
        ports:
        - containerPort: 8081
        name: aap-ui
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - name: "{{ ansible_operator_meta.name }}-nginx-conf"
          mountPath: /etc/nginx/nginx.conf
          subPath: nginx.conf
          readOnly: true
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext:
        runAsNonRoot: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: "{{ ansible_operator_meta.name }}-nginx-conf"
        configMap:
          name: '{{ ansible_operator_meta.name }}-configmap'
          items:
            - key: nginx_conf
              path: nginx.conf
