Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in latest updates to RHOAI template skeleton #17

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: batch/v1
kind: Job
metadata:
name: dsp-clone-job-${{ values.appName }}
spec:
template:
metadata:
name: dsp-clone-job-${{ values.appName }}
spec:
serviceAccountName: ${{ values.name }}-dsp-job
containers:
- name: initialize-dsp
image: quay.io/redhat-appstudio/appstudio-utils:5bd7d6cb0b17f9f2eab043a8ad16ba3d90551bc2@sha256:8c7fcf86af40c71aeb58e4279625c8308af5144e2f6b8e28b0ec7e795260e5f7
command:
- /bin/bash
- -c
- |
NS=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
oc wait -l statefulset=${{ values.name }} --for=condition=ready pod --timeout=300s
oc exec StatefulSet/${{ values.name }} -- git clone ${{ values.srcRepoURL }}
restartPolicy: Never
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,68 @@ rules:
apiGroups:
- ""
resources:
- namespaces
- namespaces
# The following roles are needed to ensure the dsp clone job can execute commands in the RHOAI workbench
- verbs:
- get
- list
- watch
apiGroups:
- "apps"
resources:
- statefulsets
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get", "create"]
# The following roles ensure that the DSP job can set ownerreferences on notebook CRs
- verbs:
- get
- list
- watch
- delete
- update
- patch
- create
apiGroups:
- "kubeflow.org"
resources:
- notebooks
- verbs:
- get
- list
- delete
- create
- watch
- update
- patch
apiGroups:
- ""
resources:
- serviceaccounts
- verbs:
- get
- create
- list
- delete
- update
- watch
- patch
apiGroups:
- ""
resources:
- persistentvolumeclaims
- verbs:
- get
- create
- list
- delete
- update
- watch
- patch
apiGroups:
- "batch"
resources:
- jobs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,137 @@ spec:
containers:
- name: initialize-dsp
image: quay.io/redhat-appstudio/appstudio-utils:5bd7d6cb0b17f9f2eab043a8ad16ba3d90551bc2@sha256:8c7fcf86af40c71aeb58e4279625c8308af5144e2f6b8e28b0ec7e795260e5f7

command:
- /bin/bash
- -c
- |
# Wait for the NS initialize job to finish
echo "Wait for NS Job"
oc wait --for=condition=complete job/initialize-namespace-${{ values.appName }}
echo "Done"

# Label the namespace as a DataScienceProject
NS=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
oc label ns $NS opendatahub.io/dashboard=true
oc label ns $NS opendatahub.io/dashboard=true --overwrite

# Retrieve the UID for the notebook SA, and mark the notebook as owned by it for garbage collection purposes
SA_UID=$(oc get sa ${{ values.name }}-dsp-job -o json | jq -r .metadata.uid)
echo "$SA_UID"
cat <<EOF | oc apply -f -
apiVersion: kubeflow.org/v1
kind: Notebook
metadata:
annotations:
notebooks.opendatahub.io/inject-oauth: 'true'
opendatahub.io/image-display-name: Minimal Python
opendatahub.io/accelerator-name: ''
openshift.io/description: ''
openshift.io/display-name: ${{ values.name }}
notebooks.opendatahub.io/last-image-selection: 's2i-minimal-notebook:2024.1'
notebooks.opendatahub.io/last-size-selection: Small
name: ${{ values.name }}
namespace: ${{ values.namespace }}
ownerReferences:
- apiVersion: v1
kind: ServiceAccount
name: ${{ values.name }}-dsp-job
uid: $SA_UID
labels:
app: ${{ values.name }}
opendatahub.io/dashboard: 'true'
opendatahub.io/odh-managed: 'true'
spec:
template:
spec:
affinity: {}
containers:
- resources:
limits:
cpu: '2'
memory: 8Gi
requests:
cpu: '1'
memory: 8Gi
readinessProbe:
failureThreshold: 3
httpGet:
path: /notebook/${{ values.namespace }}/${{ values.name }}/api
port: notebook-port
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
name: ${{ values.name }}
livenessProbe:
failureThreshold: 3
httpGet:
path: /notebook/${{ values.namespace }}/${{ values.name }}/api
port: notebook-port
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
env:
- name: NOTEBOOK_ARGS
value: |-
--ServerApp.port=8888
--ServerApp.token=''
--ServerApp.password=''
--ServerApp.base_url=/notebook/${{ values.namespace }}/${{ values.name }}
--ServerApp.quit_button=False
- name: JUPYTER_IMAGE
value: 'image-registry.openshift-image-registry.svc:5000/redhat-ods-applications/s2i-minimal-notebook:2024.1'
- name: MODEL_ENDPOINT
value: http://${{ values.name }}-model-server.${{ values.namespace }}.svc.cluster.local:${{ values.modelServicePort }}
{%- if values.vllmSelected %}
- name: MODEL_NAME
value: "${{ values.vllmModelName }}"
{%- endif %}
ports:
- containerPort: 8888
name: notebook-port
protocol: TCP
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/app-root/src
name: ${{ values.name }}
- mountPath: /dev/shm
name: shm
image: 'image-registry.openshift-image-registry.svc:5000/redhat-ods-applications/s2i-minimal-notebook:2024.1'
workingDir: /opt/app-root/src
enableServiceLinks: false
serviceAccountName: ${{ values.name }}
volumes:
- name: ${{ values.name }}
persistentVolumeClaim:
claimName: ${{ values.name }}-rhoai
- emptyDir:
medium: Memory
name: shm
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
annotations:
openshift.io/display-name: ${{ values.name }}-rhoai
name: ${{ values.name }}-rhoai
ownerReferences:
- apiVersion: v1
kind: ServiceAccount
name: ${{ values.name }}-dsp-job
uid: $SA_UID
labels:
opendatahub.io/dashboard: 'true'
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
volumeMode: Filesystem
EOF

restartPolicy: Never
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ resources:
- dsp-job-rb.yaml
- dsp-job-sa.yaml
- initialize-dsp.yaml
- notebook.yaml
- serviceaccount.yaml
- pvc.yaml
- dsp-clone-job.yaml
132 changes: 0 additions & 132 deletions skeleton/gitops-template/components/http/base/rhoai/notebook.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions skeleton/gitops-template/components/http/base/rhoai/pvc.yaml

This file was deleted.

Loading
Loading