apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "dataplane-exporter.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "dataplane-exporter.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "dataplane-exporter.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "dataplane-exporter.selectorLabels" . | nindent 8 }}
        app.kubernetes.io/component: metrics-exporter
        {{- with .Values.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      serviceAccountName: {{ include "dataplane-exporter.serviceAccountName" . }}
      {{- with .Values.priorityClassName }}
      priorityClassName: {{ . | quote }}
      {{- end }}
      containers:
        - name: dataplane-exporter
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          args:
            - --listen-addr=:{{ .Values.containerPort }}
            - --metrics-path={{ .Values.args.metricsPath }}
            - --health-path={{ .Values.args.healthPath }}
          ports:
            - name: http
              containerPort: {{ .Values.containerPort }}
              protocol: TCP
          livenessProbe:
            httpGet:
              path: {{ .Values.args.healthPath }}
              port: http
          readinessProbe:
            httpGet:
              path: {{ .Values.args.healthPath }}
              port: http
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
