apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    component: key-service
    k8s-app: key-service
    kubernetes.io/cluster-service: "true"
  name: key-service
  namespace: {{ .Release.Namespace }}
spec:
  selector:
    matchLabels:
      k8s-app: key-service
  template:
    metadata:
      labels:
        k8s-app: key-service
    spec:
      containers:
        - name: key-service
          image: {{ .Values.image | quote }}
          args:
            - --port={{ .Values.global.keyServicePort }}
          volumeMounts:
            - mountPath: {{ .Values.global.serviceBasePath | quote }}
              name: config
              readOnly: true
          resources: {}
      nodeSelector:
        node-role.kubernetes.io/control-plane: ""
      priorityClassName: system-cluster-critical
      serviceAccountName: key-service
      tolerations:
        - key: CriticalAddonsOnly
          operator: Exists
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
          operator: Exists
        - effect: NoSchedule
          key: node-role.kubernetes.io/control-plane
          operator: Exists
        - effect: NoExecute
          operator: Exists
        - effect: NoSchedule
          operator: Exists
      volumes:
        - name: config
          projected:
            sources:
              - secret:
                  items:
                    - key: {{ .Values.masterSecretKeyName | quote }}
                      path: {{ .Values.masterSecretKeyName | quote }}
                    - key: {{ .Values.saltKeyName | quote }}
                      path: {{ .Values.saltKeyName | quote }}
                  name: {{ .Values.masterSecretName | quote }}
  updateStrategy: {}
