apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: k8s-keystone-auth
  namespace: kube-system
  labels:
    k8s-app: k8s-keystone-auth
spec:
  selector:
    matchLabels:
      k8s-app: k8s-keystone-auth
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        k8s-app: k8s-keystone-auth
    spec:
      serviceAccountName: k8s-keystone
      hostNetwork: true
      nodeSelector:
        node-role.kubernetes.io/master: ""
      tolerations:
      - key: node.cloudprovider.kubernetes.io/uninitialized
        value: "true"
        effect: NoSchedule
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      containers:
        - name: k8s-keystone-auth
          image: docker.io/k8scloudprovider/k8s-keystone-auth:latest
          args:
            - /bin/k8s-keystone-auth
            - --v=10
            - --tls-cert-file
            - /etc/kubernetes/pki/apiserver.crt
            - --tls-private-key-file
            - /etc/kubernetes/pki/apiserver.key
            - --policy-configmap-name
            - k8s-auth-policy
            - --keystone-url=http://{{ keystone_auth_url }}:5000/v3
          volumeMounts:
            - mountPath: /etc/kubernetes/pki
              name: k8s-certs
              readOnly: true
            - mountPath: /etc/kubernetes/webhook
              name: k8s-webhook
              readOnly: true
            - mountPath: /etc/ssl/certs
              name: ca-certs
              readOnly: true
          resources:
            requests:
              cpu: 200m
          ports:
            - containerPort: 8443
              hostPort: 8443
              name: https
              protocol: TCP
      hostNetwork: true
      volumes:
      - hostPath:
          path: /etc/kubernetes/pki
          type: DirectoryOrCreate
        name: k8s-certs
      - hostPath:
          path: /etc/kubernetes/webhook
          type: DirectoryOrCreate
        name: k8s-webhook
      - hostPath:
          path: /etc/ssl/certs
          type: DirectoryOrCreate
        name: ca-certs
