From 0d02c230d1f77a32d2b7ba3f6bc98aaafab45f86 Mon Sep 17 00:00:00 2001 From: Anish Asthana Date: Thu, 18 May 2023 13:18:28 -0400 Subject: [PATCH] Use tagged version of the CodeFlare operator (#817) * Use tagged version of the CodeFlare operator Signed-off-by: Anish Asthana * Revise resource requirements for jobs Signed-off-by: Anish Asthana --------- Signed-off-by: Anish Asthana --- ...odeflare-operator-system-dependencies.yaml | 19 +++++++++++++++++++ .../codeflare-subscription.yaml | 4 +++- .../codeflare-stack/custom-nb-small.yaml | 4 ++-- .../codeflare-stack/mnist_mcad_mini.ipynb | 2 +- .../codeflare-stack/mnist_ray_mini.ipynb | 2 +- tests/scripts/install.sh | 5 +++++ 6 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 tests/resources/codeflare-stack/codeflare-operator-system-dependencies.yaml diff --git a/tests/resources/codeflare-stack/codeflare-operator-system-dependencies.yaml b/tests/resources/codeflare-stack/codeflare-operator-system-dependencies.yaml new file mode 100644 index 000000000..46587c207 --- /dev/null +++ b/tests/resources/codeflare-stack/codeflare-operator-system-dependencies.yaml @@ -0,0 +1,19 @@ +apiVersion: operators.coreos.com/v1 +kind: OperatorGroup +metadata: + name: codeflare-operator-system +spec: + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: codeflare-operator-system-manager-edit-rolebinding +subjects: + - kind: ServiceAccount + name: codeflare-operator-controller-manager + namespace: codeflare-operator-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: edit diff --git a/tests/resources/codeflare-stack/codeflare-subscription.yaml b/tests/resources/codeflare-stack/codeflare-subscription.yaml index 798823796..524c9c698 100644 --- a/tests/resources/codeflare-stack/codeflare-subscription.yaml +++ b/tests/resources/codeflare-stack/codeflare-subscription.yaml @@ -2,9 +2,11 @@ apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: codeflare-operator - namespace: openshift-operators + namespace: codeflare-operator-system spec: channel: alpha name: codeflare-operator source: community-operators sourceNamespace: openshift-marketplace + installPlanApproval: Manual + startingCSV: codeflare-operator.v0.0.1 diff --git a/tests/resources/codeflare-stack/custom-nb-small.yaml b/tests/resources/codeflare-stack/custom-nb-small.yaml index 6e11967c7..f411a8a8c 100644 --- a/tests/resources/codeflare-stack/custom-nb-small.yaml +++ b/tests/resources/codeflare-stack/custom-nb-small.yaml @@ -76,10 +76,10 @@ spec: resources: limits: cpu: "2" - memory: 8Gi + memory: 3Gi requests: cpu: "1" - memory: 8Gi + memory: 3Gi volumeMounts: - mountPath: /opt/app-root/src name: jupyterhub-nb-kube-3aadmin-pvc diff --git a/tests/resources/codeflare-stack/mnist_mcad_mini.ipynb b/tests/resources/codeflare-stack/mnist_mcad_mini.ipynb index 6927e73f3..9e3deae84 100644 --- a/tests/resources/codeflare-stack/mnist_mcad_mini.ipynb +++ b/tests/resources/codeflare-stack/mnist_mcad_mini.ipynb @@ -21,7 +21,7 @@ "metadata": {}, "outputs": [], "source": [ - "job = DDPJobDefinition(name=\"mnistjob\", script=\"mnist.py\", scheduler_args={\"namespace\": \"opendatahub\"}, j=\"1x1\", gpu=0, cpu=1, memMB=8000, image=\"quay.io/project-codeflare/mnist-job-test:v0.0.1\").submit()" + "job = DDPJobDefinition(name=\"mnistjob\", script=\"mnist.py\", scheduler_args={\"namespace\": \"opendatahub\"}, j=\"1x1\", gpu=0, cpu=3, memMB=4000, image=\"quay.io/project-codeflare/mnist-job-test:v0.0.1\").submit()" ] }, { diff --git a/tests/resources/codeflare-stack/mnist_ray_mini.ipynb b/tests/resources/codeflare-stack/mnist_ray_mini.ipynb index c616aabf8..dfa6f3df0 100644 --- a/tests/resources/codeflare-stack/mnist_ray_mini.ipynb +++ b/tests/resources/codeflare-stack/mnist_ray_mini.ipynb @@ -25,7 +25,7 @@ "outputs": [], "source": [ "# Create our cluster and submit appwrapper\n", - "cluster = Cluster(ClusterConfiguration(namespace='opendatahub', name='mnisttest', min_worker=2, max_worker=2, min_cpus=1, max_cpus=1, min_memory=4, max_memory=4, gpu=0, instascale=False))" + "cluster = Cluster(ClusterConfiguration(namespace='opendatahub', name='mnisttest', min_worker=2, max_worker=2, min_cpus=2, max_cpus=2, min_memory=4, max_memory=4, gpu=0, instascale=False))" ] }, { diff --git a/tests/scripts/install.sh b/tests/scripts/install.sh index 81f96a25b..16af6fe26 100755 --- a/tests/scripts/install.sh +++ b/tests/scripts/install.sh @@ -53,7 +53,12 @@ done popd ## Install CodFlare Operator echo "Installing CodeFlare operator" +oc new-project codeflare-operator-system oc apply -f $HOME/peak/operator-tests/odh-manifests/resources/codeflare-stack/codeflare-subscription.yaml +oc apply -f $HOME/peak/operator-tests/odh-manifests/resources/codeflare-stack/codeflare-operator-system-dependencies.yaml +sleep 15 +# We need to manually approve the install plan for the CodeFlare operator as we want to use a tagged version of the operator +oc patch installplan $(oc get installplans -n codeflare-operator-system -o jsonpath='{.items[?(@.metadata.ownerReferences[0].name=="codeflare-operator")].metadata.name}') -n codeflare-operator-system --type merge -p '{"spec":{"approved":true}}' ## Grabbing and applying the patch in the PR we are testing pushd ~/src/odh-manifests if [ -z "$PULL_NUMBER" ]; then