---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: {{ template "cloud-controller-manager.name" . }}
  labels:
    k8s-app:  {{ template "cloud-controller-manager.name" . }}
    helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
  namespace: {{.Values.namespace}}
spec:
  selector:
    matchLabels:
      k8s-app:  {{ template "cloud-controller-manager.name" . }}
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      name: {{ template "cloud-controller-manager.name" . }}
      labels:
        k8s-app:  {{ template "cloud-controller-manager.name" . }}
    spec:
      tolerations: {{ toYaml ( .Values.tolerations | default .Values.tolerations ) | nindent 8 }}
      nodeSelector: {{ toYaml ( .Values.nodeSelector | default .Values.nodeSelector ) | nindent 8 }}
      priorityClassName: system-node-critical
      serviceAccountName: {{.Values.serviceAccountName}}
      {{- if .Values.hostNetworking }}
      hostNetwork: true
      {{- end }}
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          args:
            - --v=2
            - --cloud-provider=aws
          resources:
          {{- toYaml .Values.resources | nindent 12 }}

---