---
apiVersion: v1
kind: Service
metadata:
  name: authservice
  namespace: istio-system
spec:
  type: ClusterIP
  selector:
    app: authservice
  ports:
  - port: 8080
    name: http-authservice
    targetPort: http-api
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: authservice
  namespace: istio-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: authservice
  strategy:
    type: RollingUpdate
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "false"
      labels:
        app: authservice
    spec:
      volumes:
        - name: custom-ca
          secret:
            secretName: istio-ingressgateway-certs
            items:
              - key: tls.crt
                path: tls.crt
      containers:
      - name: authservice
        image: gcr.io/arrikto/kubeflow/oidc-authservice:v0.3
        imagePullPolicy: Always
        ports:
        - name: http-api
          containerPort: 8080
        volumeMounts:
          - name: custom-ca
            mountPath: /etc/custom-ca
            readOnly: true
        env:
          - name: USERID_HEADER
            value: "kubeflow-userid"
          - name: USERID_PREFIX
            value: ""
          - name: OIDC_PROVIDER_CA_FILE
            value: "/etc/custom-ca/tls.crt"
          - name: DISABLE_USERINFO
            value: "true"
          - name: PORT
            value: "8080"
          - name: OIDC_SCOPES
            value: "profile email groups"
          - name: OIDC_PROVIDER
            value: {{.OIDCEndpoint}}
          - name: SELF_URL
            value: {{.KubeflowEndpoint}}
          - name: CLIENT_ID
            value: kubeflow-authservice-oidc
          - name: CLIENT_SECRET
            value: {{.AuthServiceClientSecret}} 
