apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: {{ template "metrics-server.fullname" . }}
  labels:
    app: {{ template "metrics-server.name" . }}
    chart: {{ template "metrics-server.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  selector:
    matchLabels:
      app: {{ template "metrics-server.name" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "metrics-server.name" . }}
        release: {{ .Release.Name }}
    spec:
      serviceAccountName: {{ template "metrics-server.serviceAccountName" . }}
      containers:
        - name: metrics-server
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          command:
            - /metrics-server
            {{- range .Values.args }}
            - {{ . | quote }}
            {{- end }}
        {{- with .Values.resources }}
          resources:
{{ toYaml . | indent 12 }}
        {{- end }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
