apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "vs.fullname" . }}-client
  labels:
    {{- include "vs.labels" . | nindent 4 }}
    app.kubernetes.io/service: client
spec:
  replicas: {{ .Values.client.replicaCount }}
  selector:
    matchLabels:
      {{- include "vs.selectorLabels" . | nindent 6 }}
      app.kubernetes.io/service: client
  strategy:
    rollingUpdate:
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "false"
      labels:
        {{- include "vs.selectorLabels" . | nindent 8 }}
        app.kubernetes.io/service: client
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
        - name: {{ .Chart.Name }}-client
          image: 'registry.gitlab.eox.at/esa/prism/vs/pvs_client:{{ .Values.image.tag | default .Chart.AppVersion }}'
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {{- toYaml .Values.client.resources | nindent 12 }}
          volumeMounts:
          - mountPath: /usr/share/nginx/html/index.html
            name: client
            subPath: index.html
      {{- with .Values.client.affinity | default .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      volumes:
      - configMap:
          items:
          - key: index.html
            path: index.html
          name: {{ include "vs.fullname" . }}-client
        name: client
