From 42cce2d0713e4a22a00d145fbac14f67ab3f3016 Mon Sep 17 00:00:00 2001 From: Srihari Date: Tue, 3 Oct 2023 18:28:35 +0530 Subject: [PATCH 1/4] Update SDK e2e test to reflect poetry changes Add Ingress domain for sdk e2e test Revert "Add Ingress domain for sdk e2e test" This reverts commit ffc200474502e2aeebdce1654c8c1a2bce086c25. --- test/e2e/install-codeflare-sdk.sh | 22 ++++++++++++++++++++++ test/e2e/mnist_raycluster_sdk_test.go | 14 +++++++++++++- test/e2e/support.go | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100755 test/e2e/install-codeflare-sdk.sh diff --git a/test/e2e/install-codeflare-sdk.sh b/test/e2e/install-codeflare-sdk.sh new file mode 100755 index 00000000..e90f4071 --- /dev/null +++ b/test/e2e/install-codeflare-sdk.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# go to codeflare-sdk folder and install codeflare-sdk +cd .. + +# Install Poetry and configure virtualenvs +pip install poetry +poetry config virtualenvs.create false + +cd codeflare-sdk +# Clone the CodeFlare SDK repository +git clone --branch main https://github.com/project-codeflare/codeflare-sdk.git + +cd codeflare-sdk + +# Lock dependencies and install them +poetry lock --no-update +poetry install --with test,docs + +# Return to the workdir +cd ../.. +cd workdir diff --git a/test/e2e/mnist_raycluster_sdk_test.go b/test/e2e/mnist_raycluster_sdk_test.go index 015cbfc5..be6933f6 100644 --- a/test/e2e/mnist_raycluster_sdk_test.go +++ b/test/e2e/mnist_raycluster_sdk_test.go @@ -51,6 +51,8 @@ func TestMNISTRayClusterSDK(t *testing.T) { "requirements.txt": ReadFile(test, "mnist_pip_requirements.txt"), // MNIST training script "mnist.py": ReadFile(test, "mnist.py"), + // codeflare-sdk installation script + "install-codeflare-sdk.sh": ReadFile(test, "install-codeflare-sdk.sh"), }) // Create RBAC, retrieve token for user with limited rights @@ -119,12 +121,16 @@ func TestMNISTRayClusterSDK(t *testing.T) { {Name: "PYTHONUSERBASE", Value: "/workdir"}, {Name: "RAY_IMAGE", Value: GetRayImage()}, }, - Command: []string{"/bin/sh", "-c", "pip install codeflare-sdk==" + GetCodeFlareSDKVersion() + " && cp /test/* . && python mnist_raycluster_sdk.py" + " " + namespace.Name}, + Command: []string{"/bin/sh", "-c", "cp /test/* . && chmod +x install-codeflare-sdk.sh && ./install-codeflare-sdk.sh && python mnist_raycluster_sdk.py" + " " + namespace.Name}, VolumeMounts: []corev1.VolumeMount{ { Name: "test", MountPath: "/test", }, + { + Name: "codeflare-sdk", + MountPath: "/codeflare-sdk", + }, { Name: "workdir", MountPath: "/workdir", @@ -154,6 +160,12 @@ func TestMNISTRayClusterSDK(t *testing.T) { }, }, }, + { + Name: "codeflare-sdk", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, { Name: "workdir", VolumeSource: corev1.VolumeSource{ diff --git a/test/e2e/support.go b/test/e2e/support.go index e9165688..8fc86295 100644 --- a/test/e2e/support.go +++ b/test/e2e/support.go @@ -23,7 +23,7 @@ import ( "github.com/project-codeflare/codeflare-common/support" ) -//go:embed *.py *.txt +//go:embed *.py *.txt *.sh var files embed.FS func ReadFile(t support.Test, fileName string) []byte { From ee0e762cc9f938b4931fc046b8c82e8774e77a1b Mon Sep 17 00:00:00 2001 From: Karel Suta Date: Tue, 21 Nov 2023 16:08:58 +0100 Subject: [PATCH 2/4] Add missing KubeRay version parameter for release workflow --- .github/workflows/project-codeflare-release.yml | 5 ++++- .github/workflows/tag-and-build.yml | 1 + README.md | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/project-codeflare-release.yml b/.github/workflows/project-codeflare-release.yml index 1f8bb0c7..77d0a0a1 100644 --- a/.github/workflows/project-codeflare-release.yml +++ b/.github/workflows/project-codeflare-release.yml @@ -19,6 +19,9 @@ on: instascale-version: description: 'Version of InstaScale to be released (for example: v0.0.0)' required: true + kuberay-version: + description: 'Tested version of KubeRay (for example: v0.0.0)' + required: true is-stable: description: 'Select if the built images should be tagged as stable' required: true @@ -156,7 +159,7 @@ jobs: steps: - name: Release CodeFlare operator run: | - gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field version=${{ github.event.inputs.operator-version }} --field replaces=${{ github.event.inputs.replaces }} --field mcad-version=${{ github.event.inputs.mcad-version }} --field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} --field instascale-version=${{ github.event.inputs.instascale-version }} --field quay-organization=${{ github.event.inputs.quay-organization }} --field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} --field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }} + gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field version=${{ github.event.inputs.operator-version }} --field replaces=${{ github.event.inputs.replaces }} --field mcad-version=${{ github.event.inputs.mcad-version }} --field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} --field instascale-version=${{ github.event.inputs.instascale-version }} --field kuberay-version=${{ github.event.inputs.kuberay-version }} --field quay-organization=${{ github.event.inputs.quay-organization }} --field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} --field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }} env: GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }} shell: bash diff --git a/.github/workflows/tag-and-build.yml b/.github/workflows/tag-and-build.yml index 827a33c6..b97deb33 100644 --- a/.github/workflows/tag-and-build.yml +++ b/.github/workflows/tag-and-build.yml @@ -100,6 +100,7 @@ jobs: sed -i -E "s/(.*MCAD_VERSION \?= ).*/\1${{ github.event.inputs.mcad-version }}/" Makefile sed -i -E "s/(.*MCAD_REF \?= ).*/\1release-\${MCAD_VERSION}/" Makefile sed -i -E "s/(.*INSTASCALE_VERSION \?= ).*/\1${{ github.event.inputs.instascale-version }}/" Makefile + sed -i -E "s/(.*KUBERAY_VERSION \?= ).*/\1${{ github.event.inputs.kuberay-version }}/" Makefile - name: Login to Quay.io uses: redhat-actions/podman-login@v1 diff --git a/README.md b/README.md index 7a0280fa..c3048b29 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ CodeFlare Stack Compatibility Matrix | Multi-Cluster App Dispatcher | [v1.38.1](https://github.com/project-codeflare/multi-cluster-app-dispatcher/releases/tag/v1.38.1) | | CodeFlare-SDK | [v0.12.1](https://github.com/project-codeflare/codeflare-sdk/releases/tag/v0.12.1) | | InstaScale | [v0.3.1](https://github.com/project-codeflare/instascale/releases/tag/v0.3.1) | -| KubeRay | [v0.0.0-dev](https://github.com/opendatahub-io/kuberay/releases/tag/v0.0.0-dev) | +| KubeRay | [v1.0.0-rc.0](https://github.com/opendatahub-io/kuberay/releases/tag/v1.0.0-rc.0) | ## Development From 4f04b9f18f260fc6d59506bcf5c2a244a4b7c029 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 21 Nov 2023 14:17:00 -0500 Subject: [PATCH 3/4] set klog to the controller runtime logger Signed-off-by: Kevin --- go.mod | 2 +- main.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index fd23755d..455963b0 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( k8s.io/apimachinery v0.26.3 k8s.io/client-go v0.26.3 k8s.io/component-base v0.26.2 + k8s.io/klog/v2 v2.90.1 k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 sigs.k8s.io/controller-runtime v0.14.6 sigs.k8s.io/yaml v1.3.0 @@ -114,7 +115,6 @@ require ( k8s.io/apiextensions-apiserver v0.26.1 // indirect k8s.io/apiserver v0.26.2 // indirect k8s.io/klog v1.0.0 // indirect - k8s.io/klog/v2 v2.90.1 // indirect k8s.io/kms v0.26.2 // indirect k8s.io/kube-openapi v0.0.0-20230303024457-afdc3dddf62d // indirect k8s.io/metrics v0.26.2 // indirect diff --git a/main.go b/main.go index bf7f7454..5e2bb6e3 100644 --- a/main.go +++ b/main.go @@ -42,6 +42,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" "k8s.io/client-go/rest" configv1alpha1 "k8s.io/component-base/config/v1alpha1" + "k8s.io/klog/v2" "k8s.io/utils/pointer" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/healthz" @@ -90,6 +91,8 @@ func main() { flag.Parse() ctrl.SetLogger(zap.New(zap.UseFlagOptions(&zapOptions))) + klog.SetLogger(ctrl.Log) + setupLog.Info("Build info", "operatorVersion", OperatorVersion, "mcadVersion", McadVersion, From 426a67fa701508c11aabb21dbd41eb3aa0383d75 Mon Sep 17 00:00:00 2001 From: Karel Suta Date: Thu, 23 Nov 2023 08:31:33 +0100 Subject: [PATCH 4/4] Raise SDK e2e test timeout in Python script --- test/e2e/mnist_raycluster_sdk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/mnist_raycluster_sdk.py b/test/e2e/mnist_raycluster_sdk.py index cb3c0af5..d171c9b0 100644 --- a/test/e2e/mnist_raycluster_sdk.py +++ b/test/e2e/mnist_raycluster_sdk.py @@ -62,7 +62,7 @@ done = False time = 0 -timeout = 300 +timeout = 900 while not done: status = job.status() if is_terminal(status.state):