---
kind: Service
apiVersion: v1
metadata:
  name: imxc-ui-service
  namespace: imxc
spec:
  type: NodePort
  selector:
    app: imxc-ui
  ports:
  - protocol: TCP
    name: ui
    port: 80
    targetPort: 9999
    nodePort: 31080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: imxc-ui
  namespace: imxc
  labels:
    app: imxc-ui
spec:
  revisionHistoryLimit: 0
  replicas: 1
  selector:
    matchLabels:
      app: imxc-ui
  template:
    metadata:
      labels:
        app: imxc-ui
    spec:
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            preference:
              matchExpressions:
              - key: cmoa
                operator: In
                values:
                - worker2
      containers:
      - name: imxc-ui
        image: {{ .Values.global.IMXC_IN_REGISTRY }}/ui-server:{{ .Values.global.UI_SERVER_VERSION }}
        resources:
          requests:
            cpu: 100m
            memory: 50Mi
          limits:
            cpu: 200m
            memory: 100Mi
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        volumeMounts:
          - name: config-profile
            mountPath: /usr/src/app/web/env
          - name: config-server
            mountPath: /usr/src/app/config
      volumes:
        - name: config-profile
          configMap:
            name: imxc-ui-config
            items:
              - key: "config.js"
                path: "config.js"
        - name: config-server
          configMap:
            name: imxc-ui-config
