apiVersion: apps/v1
kind: Deployment
metadata:
  name: "{{ template "harbor.portal" . }}"
  labels:
{{ include "harbor.labels" . | indent 4 }}
    component: portal
spec:
  replicas: {{ .Values.portal.replicas }}
  selector:
    matchLabels:
{{ include "harbor.matchLabels" . | indent 6 }}
      component: portal
  template:
    metadata:
      labels:
{{ include "harbor.matchLabels" . | indent 8 }}
        component: portal
      annotations:
{{- if .Values.portal.podAnnotations }}
{{ toYaml .Values.portal.podAnnotations | indent 8 }}
{{- end }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
      - name: portal
        image: {{ .Values.portal.image.repository }}:{{ .Values.portal.image.tag }}
        imagePullPolicy: {{ .Values.imagePullPolicy }}
{{- if .Values.portal.resources }}
        resources:
{{ toYaml .Values.portal.resources | indent 10 }}
{{- end }}
        livenessProbe:
          httpGet:
            path: /
            port: 8080
          initialDelaySeconds: 1
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /
            port: 8080
          initialDelaySeconds: 1
          periodSeconds: 10
        ports:
        - containerPort: 8080
    {{- with .Values.portal.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.portal.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.portal.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
