apiVersion: v1
kind: Service
metadata:
  annotations:
    getambassador.io/config: |-
      ---
      apiVersion: ambassador/v0
      kind: Mapping
      name: tensorboard-web-app_mapping
      prefix: /tensorboard/
      service: tensorboard-web-app.kubeflow
  labels:
    run: tensorboard-web-app
  name: tensorboard-web-app
  namespace: kubeflow
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 5000
  selector:
    app: tensorboard-web-app
  type: ClusterIP
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: tensorboard-web-app
  namespace: kubeflow
spec:
  gateways:
  - kubeflow-gateway
  hosts:
  - '*'
  http:
  - headers:
    match:
    - uri:
        prefix: /tensorboard/
    rewrite:
      uri: /
    route:
    - destination:
        host: tensorboard-web-app.kubeflow.svc.cluster.local
        port:
          number: 80

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: tensorboard-web-app
  name: tensorboard-web-app
  namespace: kubeflow
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tensorboard-web-app
  template:
    metadata:
      labels:
        app: tensorboard-web-app
    spec:
      containers:
      - image: konstantinosand/twa:v1
        imagePullPolicy: Always
        name: tensorboard-web-app
        env:
          - name: USERID_HEADER
            value: kubeflow-userid
        ports:
        - containerPort: 5000
      serviceAccountName: tensorboard-web-app