apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-service-account
  namespace: kubeflow
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-jupyter-notebook-role
  namespace: kubeflow
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - pods/log
  - secrets
  - services
  verbs:
  - '*'
- apiGroups:
  - ""
  - apps
  - extensions
  resources:
  - deployments
  - replicasets
  verbs:
  - '*'
- apiGroups:
  - kubeflow.org
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - batch
  resources:
  - jobs
  verbs:
  - '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-cluster-role
rules:
- apiGroups:
  - ""
  resources:
  - namespaces
  verbs:
  - get
  - list
  - create
  - delete
- apiGroups:
  - kubeflow.org
  resources:
  - notebooks
  - poddefaults
  verbs:
  - get
  - list
  - create
  - delete
- apiGroups:
  - ""
  resources:
  - persistentvolumeclaims
  verbs:
  - create
  - delete
  - get
  - list
- apiGroups:
  - storage.k8s.io
  resources:
  - storageclasses
  verbs:
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-jupyter-notebook-role-binding
  namespace: kubeflow
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: jupyter-web-app-jupyter-notebook-role
subjects:
- kind: ServiceAccount
  name: jupyter-notebook
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-cluster-role-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: jupyter-web-app-cluster-role
subjects:
- kind: ServiceAccount
  name: jupyter-web-app-service-account
  namespace: kubeflow
---
apiVersion: v1
data:
  spawner_ui_config.yaml: |
    # Configuration file for the Jupyter UI.
    #
    # Each Jupyter UI option is configured by two keys: 'value' and 'readOnly'
    # - The 'value' key contains the default value
    # - The 'readOnly' key determines if the option will be available to users
    #
    # If the 'readOnly' key is present and set to 'true', the respective option
    # will be disabled for users and only set by the admin. Also when a
    # Notebook is POSTED to the API if a necessary field is not present then
    # the value from the config will be used.
    #
    # If the 'readOnly' key is missing (defaults to 'false'), the respective option
    # will be available for users to edit.
    #
    # Note that some values can be templated. Such values are the names of the
    # Volumes as well as their StorageClass
    spawnerFormDefaults:
      image:
        # The container Image for the user's Jupyter Notebook
        # If readonly, this value must be a member of the list below
        value: gcr.io/kubeflow-images-public/tensorflow-1.13.1-notebook-cpu:v0.5.0
        # The list of available standard container Images
        options:
          - gcr.io/kubeflow-images-public/tensorflow-1.5.1-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.5.1-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.6.0-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.6.0-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.7.0-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.7.0-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.8.0-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.8.0-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.9.0-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.9.0-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.10.1-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.10.1-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.11.0-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.11.0-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.12.0-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.12.0-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.13.1-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-1.13.1-notebook-gpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-2.0.0a-notebook-cpu:v0.5.0
          - gcr.io/kubeflow-images-public/tensorflow-2.0.0a-notebook-gpu:v0.5.0
        # By default, custom container Images are allowed
        # Uncomment the following line to only enable standard container Images
        readOnly: false
      cpu:
        # CPU for user's Notebook
        value: '0.5'
        readOnly: false
      memory:
        # Memory for user's Notebook
        value: 1.0Gi
        readOnly: false
      workspaceVolume:
        # Workspace Volume to be attached to user's Notebook
        # Each Workspace Volume is declared with the following attributes:
        # Type, Name, Size, MountPath and Access Mode
        value:
          type:
            # The Type of the Workspace Volume
            # Supported values: 'New', 'Existing'
            value: New
          name:
            # The Name of the Workspace Volume
            # Note that this is a templated value. Special values:
            # {notebook-name}: Replaced with the name of the Notebook. The frontend
            #                  will replace this value as the user types the name
            value: 'workspace-{notebook-name}'
          size:
            # The Size of the Workspace Volume (in Gi)
            value: '10Gi'
          mountPath:
            # The Path that the Workspace Volume will be mounted
            value: /home/jovyan
          accessModes:
            # The Access Mode of the Workspace Volume
            # Supported values: 'ReadWriteOnce', 'ReadWriteMany', 'ReadOnlyMany'
            value: ReadWriteOnce
          class:
            # The StrageClass the PVC will use if type is New. Special values are:
            # {none}: default StorageClass
            # {empty}: empty string ""
            value: '{none}'
        readOnly: false
      dataVolumes:
        # List of additional Data Volumes to be attached to the user's Notebook
        value: []
        # Each Data Volume is declared with the following attributes:
        # Type, Name, Size, MountPath and Access Mode
        #
        # For example, a list with 2 Data Volumes:
        # value:
        #   - value:
        #       type:
        #         value: New
        #       name:
        #         value: '{notebook-name}-vol-1'
        #       size:
        #         value: '10Gi'
        #       class:
        #         value: standard
        #       mountPath:
        #         value: /home/jovyan/vol-1
        #       accessModes:
        #         value: ReadWriteOnce
        #       class:
        #         value: {none}
        #   - value:
        #       type:
        #         value: New
        #       name:
        #         value: '{notebook-name}-vol-2'
        #       size:
        #         value: '10Gi'
        #       mountPath:
        #         value: /home/jovyan/vol-2
        #       accessModes:
        #         value: ReadWriteMany
        #       class:
        #         value: {none}
        readOnly: false
      extraResources:
        # Extra Resource Limits for user's Notebook
        # e.x. "{'nvidia.com/gpu': 2}"
        value: "{}"
        readOnly: false
      shm:
        value: true
        readOnly: false
      configurations:
        # List of labels to be selected, these are the labels from PodDefaults
        # value:
        #   - add-gcp-secret
        #   - default-editor
        value: []
        readOnly: false
kind: ConfigMap
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-config
  namespace: kubeflow
---
apiVersion: v1
data:
  ROK_SECRET_NAME: {{ .Values.jupyterWebApp.rokSecretName | quote }}
  UI: {{ .Values.jupyterWebApp.ui | quote }}
  clusterDomain: {{ .Values.clusterDomain | quote }}
  policy: {{ .Values.jupyterWebApp.policy | quote }}
  prefix: {{ .Values.jupyterWebApp.prefix | quote }}
  userid-header: {{ .Values.jupyterWebApp.useridHeader | quote }}
  userid-prefix: {{ .Values.jupyterWebApp.useridPrefix | quote }}
kind: ConfigMap
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-parameters
  namespace: kubeflow
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    getambassador.io/config: |-
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name: webapp_mapping
      prefix: /jupyter/
      service: jupyter-web-app-service.kubeflow
      add_request_headers:
        x-forwarded-prefix: /jupyter
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
    run: jupyter-web-app
  name: jupyter-web-app-service
  namespace: kubeflow
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 5000
  selector:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: jupyter-web-app
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
    kustomize.component: jupyter-web-app
  name: jupyter-web-app-deployment
  namespace: kubeflow
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jupyter-web-app
      app.kubernetes.io/component: jupyter
      app.kubernetes.io/instance: jupyter-web-app
      app.kubernetes.io/managed-by: kfctl
      app.kubernetes.io/name: jupyter-web-app
      app.kubernetes.io/part-of: kubeflow
      app.kubernetes.io/version: v0.6
      kustomize.component: jupyter-web-app
  template:
    metadata:
      labels:
        app: jupyter-web-app
        app.kubernetes.io/component: jupyter
        app.kubernetes.io/instance: jupyter-web-app
        app.kubernetes.io/managed-by: kfctl
        app.kubernetes.io/name: jupyter-web-app
        app.kubernetes.io/part-of: kubeflow
        app.kubernetes.io/version: v0.6
        kustomize.component: jupyter-web-app
    spec:
      containers:
      - env:
        - name: ROK_SECRET_NAME
          valueFrom:
            configMapKeyRef:
              key: ROK_SECRET_NAME
              name: jupyter-web-app-parameters
        - name: UI
          valueFrom:
            configMapKeyRef:
              key: UI
              name: jupyter-web-app-parameters
        - name: USERID_HEADER
          valueFrom:
            configMapKeyRef:
              key: userid-header
              name: jupyter-web-app-parameters
        - name: USERID_PREFIX
          valueFrom:
            configMapKeyRef:
              key: userid-prefix
              name: jupyter-web-app-parameters
        image: gcr.io/kubeflow-images-public/jupyter-web-app:9419d4d
        imagePullPolicy: Always
        name: jupyter-web-app
        ports:
        - containerPort: 5000
        volumeMounts:
        - mountPath: /etc/config
          name: config-volume
      serviceAccountName: jupyter-web-app-service-account
      volumes:
      - configMap:
          name: jupyter-web-app-config
        name: config-volume
---
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
  labels:
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
  name: jupyter-web-app
  namespace: kubeflow
spec:
  addOwnerRef: true
  componentKinds:
  - group: core
    kind: ConfigMap
  - group: apps
    kind: Deployment
  - group: rbac.authorization.k8s.io
    kind: RoleBinding
  - group: rbac.authorization.k8s.io
    kind: Role
  - group: core
    kind: ServiceAccount
  - group: networking.istio.io
    kind: VirtualService
  descriptor:
    description: Provides a UI which allows the user to create/conect/delete jupyter
      notebooks.
    keywords:
    - jupyterhub
    - jupyter ui
    - notebooks
    links:
    - description: About
      url: https://github.com/kubeflow/kubeflow/tree/master/components/jupyter-web-app
    - description: Docs
      url: https://www.kubeflow.org/docs/notebooks
    maintainers:
    - email: kimwnasptd@arrikto.com
      name: Kimonas Sotirchos
    owners:
    - email: kimwnasptd@arrikto.com
      name: Kimonas Sotirchos
    type: jupyter-web-app
    version: v0.6.2
  selector:
    matchLabels:
      app.kubernetes.io/component: jupyter
      app.kubernetes.io/instance: jupyter-web-app
      app.kubernetes.io/managed-by: kfctl
      app.kubernetes.io/name: jupyter-web-app
      app.kubernetes.io/part-of: kubeflow
      app.kubernetes.io/version: v0.6
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  labels:
    app.kubernetes.io/component: jupyter
    app.kubernetes.io/instance: jupyter-web-app
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: jupyter-web-app
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v0.6
  name: jupyter-web-app
  namespace: kubeflow
spec:
  gateways:
  - kubeflow-gateway
  hosts:
  - '*'
  http:
  - headers:
      request:
        add:
          x-forwarded-prefix: /jupyter
    match:
    - uri:
        prefix: /jupyter/
    rewrite:
      uri: /
    route:
    - destination:
        host: jupyter-web-app-service.kubeflow.svc.{{ .Values.clusterDomain }}
        port:
          number: 80
