################################
# Istio CA with plug-in key/certs. Run this after istio-auth.yaml
################################
apiVersion: v1
kind: ServiceAccount
metadata:
  name: istio-ca-service-account
  namespace: {ISTIO_NAMESPACE}
---
apiVersion: v1
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: istio-ca
  namespace: {ISTIO_NAMESPACE}
spec:
  replicas: 1
  template:
    metadata:
      labels:
        istio: istio-ca
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      serviceAccountName: istio-ca-service-account
      containers:
      - name: istio-ca
        image: {CA_HUB}/istio-ca:{CA_TAG}
        imagePullPolicy: IfNotPresent
        command: ["/usr/local/bin/istio_ca"]
        args:
          - --istio-ca-storage-namespace={ISTIO_NAMESPACE}
          - --grpc-port=8060
          - --grpc-hostname=istio-ca
          - --self-signed-ca=false
          - --signing-cert=/etc/cacerts/ca-cert.pem
          - --signing-key=/etc/cacerts/ca-key.pem
          - --root-cert=/etc/cacerts/root-cert.pem
          - --cert-chain=/etc/cacerts/cert-chain.pem
        volumeMounts:
        - name: cacerts
          mountPath: /etc/cacerts
          readOnly: true
      volumes:
      - name: cacerts
        secret:
          secretName: cacerts
          optional: true
---
