|
| 1 | +apiVersion: template.openshift.io/v1 |
| 2 | +kind: Template |
| 3 | +parameters: |
| 4 | +- name: NOTEBOOK_NAME |
| 5 | + required: true |
| 6 | +- name: RUN_NAME |
| 7 | + required: true |
| 8 | +- name: USERNAME |
| 9 | + required: true |
| 10 | +- name: IMAGE_NAME |
| 11 | + required: true |
| 12 | +- name: NAMESPACE |
| 13 | + required: true |
| 14 | +- name: OPENSHIFT_URL |
| 15 | + required: true |
| 16 | +- name: IMAGE_REPO |
| 17 | + required: true |
| 18 | + value: "image-registry.openshift-image-registry.svc:5000/redhat-ods-applications" |
| 19 | +- name: HUB_HOST |
| 20 | + required: true |
| 21 | +- name: PVC_SIZE |
| 22 | + required: true |
| 23 | + value: "20Gi" |
| 24 | +- name: TOKEN |
| 25 | + required: false |
| 26 | +objects: |
| 27 | +- apiVersion: kubeflow.org/v1beta1 |
| 28 | + kind: Notebook |
| 29 | + metadata: |
| 30 | + annotations: |
| 31 | + notebooks.opendatahub.io/inject-oauth: 'true' |
| 32 | + notebooks.opendatahub.io/last-image-selection: ${IMAGE_NAME} |
| 33 | + notebooks.opendatahub.io/last-size-selection: Small |
| 34 | + notebooks.opendatahub.io/oauth-logout-url: >- |
| 35 | + ${OPENSHIFT_URL}/${NAMESPACE}?notebookLogout=${NOTEBOOK_NAME} |
| 36 | + opendatahub.io/username: ${USERNAME} |
| 37 | + openshift.io/description: '' |
| 38 | + openshift.io/display-name: ${NOTEBOOK_NAME} |
| 39 | + name: ${NOTEBOOK_NAME} |
| 40 | + labels: |
| 41 | + ope-run: ${RUN_NAME} |
| 42 | + app: ${NOTEBOOK_NAME} |
| 43 | + opendatahub.io/dashboard: 'true' |
| 44 | + opendatahub.io/odh-managed: 'true' |
| 45 | + opendatahub.io/user: ${USERNAME} |
| 46 | + spec: |
| 47 | + template: |
| 48 | + spec: |
| 49 | + containers: |
| 50 | + - resources: |
| 51 | + limits: |
| 52 | + cpu: '2' |
| 53 | + memory: 8Gi |
| 54 | + requests: |
| 55 | + cpu: '1' |
| 56 | + memory: 8Gi |
| 57 | + readinessProbe: |
| 58 | + failureThreshold: 3 |
| 59 | + httpGet: |
| 60 | + path: /notebook/${NAMESPACE}/${NOTEBOOK_NAME}/api |
| 61 | + port: notebook-port |
| 62 | + scheme: HTTP |
| 63 | + initialDelaySeconds: 10 |
| 64 | + periodSeconds: 5 |
| 65 | + successThreshold: 1 |
| 66 | + timeoutSeconds: 1 |
| 67 | + name: ${NOTEBOOK_NAME} |
| 68 | + livenessProbe: |
| 69 | + failureThreshold: 3 |
| 70 | + httpGet: |
| 71 | + path: /notebook/${NAMESPACE}/${NOTEBOOK_NAME}/api |
| 72 | + port: notebook-port |
| 73 | + scheme: HTTP |
| 74 | + initialDelaySeconds: 10 |
| 75 | + periodSeconds: 5 |
| 76 | + successThreshold: 1 |
| 77 | + timeoutSeconds: 1 |
| 78 | + env: |
| 79 | + - name: NOTEBOOK_ARGS |
| 80 | + value: |- |
| 81 | + --ServerApp.port=8888 |
| 82 | + --ServerApp.token=${TOKEN} |
| 83 | + --ServerApp.password='' |
| 84 | + --ServerApp.base_url=/notebook/${NAMESPACE}/${NOTEBOOK_NAME} |
| 85 | + --ServerApp.quit_button=False |
| 86 | + --ServerApp.tornado_settings={"user":"${USERNAME}","hub_host":"${HUB_HOST}","hub_prefix":"projects/${NAMESPACE}"} |
| 87 | + - name: JUPYTER_IMAGE |
| 88 | + value: >- |
| 89 | + ${IMAGE_REPO}/${IMAGE_NAME} |
| 90 | + ports: |
| 91 | + - containerPort: 8888 |
| 92 | + name: notebook-port |
| 93 | + protocol: TCP |
| 94 | + imagePullPolicy: Always |
| 95 | + volumeMounts: |
| 96 | + - mountPath: /opt/app-root/src |
| 97 | + name: ${NOTEBOOK_NAME} |
| 98 | + - mountPath: /dev/shm |
| 99 | + name: shm |
| 100 | + image: >- |
| 101 | + ${IMAGE_REPO}/${IMAGE_NAME} |
| 102 | + workingDir: /opt/app-root/src |
| 103 | + - resources: |
| 104 | + limits: |
| 105 | + cpu: 100m |
| 106 | + memory: 64Mi |
| 107 | + requests: |
| 108 | + cpu: 100m |
| 109 | + memory: 64Mi |
| 110 | + readinessProbe: |
| 111 | + failureThreshold: 3 |
| 112 | + httpGet: |
| 113 | + path: /oauth/healthz |
| 114 | + port: oauth-proxy |
| 115 | + scheme: HTTPS |
| 116 | + initialDelaySeconds: 5 |
| 117 | + periodSeconds: 5 |
| 118 | + successThreshold: 1 |
| 119 | + timeoutSeconds: 1 |
| 120 | + name: oauth-proxy |
| 121 | + livenessProbe: |
| 122 | + failureThreshold: 3 |
| 123 | + httpGet: |
| 124 | + path: /oauth/healthz |
| 125 | + port: oauth-proxy |
| 126 | + scheme: HTTPS |
| 127 | + initialDelaySeconds: 30 |
| 128 | + periodSeconds: 5 |
| 129 | + successThreshold: 1 |
| 130 | + timeoutSeconds: 1 |
| 131 | + env: |
| 132 | + - name: NAMESPACE |
| 133 | + valueFrom: |
| 134 | + fieldRef: |
| 135 | + fieldPath: metadata.namespace |
| 136 | + ports: |
| 137 | + - containerPort: 8443 |
| 138 | + name: oauth-proxy |
| 139 | + protocol: TCP |
| 140 | + imagePullPolicy: Always |
| 141 | + volumeMounts: |
| 142 | + - mountPath: /etc/oauth/config |
| 143 | + name: oauth-config |
| 144 | + - mountPath: /etc/tls/private |
| 145 | + name: tls-certificates |
| 146 | + image: >- |
| 147 | + registry.redhat.io/openshift4/ose-oauth-proxy@sha256:4bef31eb993feb6f1096b51b4876c65a6fb1f4401fee97fa4f4542b6b7c9bc46 |
| 148 | + args: |
| 149 | + - '--provider=openshift' |
| 150 | + - '--https-address=:8443' |
| 151 | + - '--http-address=' |
| 152 | + - '--openshift-service-account=${NOTEBOOK_NAME}' |
| 153 | + - '--cookie-secret-file=/etc/oauth/config/cookie_secret' |
| 154 | + - '--cookie-expire=24h0m0s' |
| 155 | + - '--tls-cert=/etc/tls/private/tls.crt' |
| 156 | + - '--tls-key=/etc/tls/private/tls.key' |
| 157 | + - '--upstream=http://localhost:8888' |
| 158 | + - '--upstream-ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt' |
| 159 | + - '--email-domain=*' |
| 160 | + - '--skip-provider-button' |
| 161 | + - >- |
| 162 | + --openshift-sar={"verb":"get","resource":"notebooks","resourceAPIGroup":"kubeflow.org","resourceName":"${NOTEBOOK_NAME}","namespace":"$(NAMESPACE)"} |
| 163 | + - >- |
| 164 | + --logout-url=${OPENSHIFT_URL}${NAMESPACE}?notebookLogout=${NOTEBOOK_NAME} |
| 165 | + enableServiceLinks: false |
| 166 | + serviceAccountName: ${NOTEBOOK_NAME} |
| 167 | + volumes: |
| 168 | + - name: ${NOTEBOOK_NAME} |
| 169 | + persistentVolumeClaim: |
| 170 | + claimName: ${NOTEBOOK_NAME} |
| 171 | + - emptyDir: |
| 172 | + medium: Memory |
| 173 | + name: shm |
| 174 | + - name: oauth-config |
| 175 | + secret: |
| 176 | + defaultMode: 420 |
| 177 | + secretName: ${NOTEBOOK_NAME}-oauth-config |
| 178 | + - name: tls-certificates |
| 179 | + secret: |
| 180 | + defaultMode: 420 |
| 181 | + secretName: ${NOTEBOOK_NAME}-tls |
| 182 | +- apiVersion: v1 |
| 183 | + kind: PersistentVolumeClaim |
| 184 | + metadata: |
| 185 | + name: ${NOTEBOOK_NAME} |
| 186 | + labels: |
| 187 | + app: ${NOTEBOOK_NAME} |
| 188 | + notebook-name: ${NOTEBOOK_NAME} |
| 189 | + ope-run: ${RUN_NAME} |
| 190 | + opendatahub.io/dashboard: 'true' |
| 191 | + spec: |
| 192 | + accessModes: |
| 193 | + - ReadWriteOnce |
| 194 | + resources: |
| 195 | + requests: |
| 196 | + storage: "${PVC_SIZE}" |
0 commit comments