From 86164e709cc69a0a7492aea7c84f208f58915602 Mon Sep 17 00:00:00 2001 From: Fiona Waters Date: Fri, 13 Oct 2023 15:48:14 +0100 Subject: [PATCH 1/6] removing support package --- test/support/batch.go | 37 -------- test/support/conditions.go | 85 ----------------- test/support/core.go | 112 ---------------------- test/support/defaults.go | 11 --- test/support/events.go | 148 ----------------------------- test/support/ingress.go | 101 -------------------- test/support/mcad.go | 56 ----------- test/support/namespace.go | 55 ----------- test/support/ocm.go | 74 --------------- test/support/openshift.go | 33 ------- test/support/ray_api.go | 45 --------- test/support/ray_cluster_client.go | 128 ------------------------- test/support/route.go | 91 ------------------ test/support/service.go | 27 ------ test/support/support.go | 76 --------------- test/support/test.go | 139 --------------------------- test/support/utils.go | 41 -------- 17 files changed, 1259 deletions(-) delete mode 100644 test/support/batch.go delete mode 100644 test/support/conditions.go delete mode 100644 test/support/core.go delete mode 100644 test/support/defaults.go delete mode 100644 test/support/events.go delete mode 100644 test/support/ingress.go delete mode 100644 test/support/mcad.go delete mode 100644 test/support/namespace.go delete mode 100644 test/support/ocm.go delete mode 100644 test/support/openshift.go delete mode 100644 test/support/ray_api.go delete mode 100644 test/support/ray_cluster_client.go delete mode 100644 test/support/route.go delete mode 100644 test/support/service.go delete mode 100644 test/support/support.go delete mode 100644 test/support/test.go delete mode 100644 test/support/utils.go diff --git a/test/support/batch.go b/test/support/batch.go deleted file mode 100644 index 2cb2d5432..000000000 --- a/test/support/batch.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "github.com/onsi/gomega" - - batchv1 "k8s.io/api/batch/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func Job(t Test, namespace, name string) func(g gomega.Gomega) *batchv1.Job { - return func(g gomega.Gomega) *batchv1.Job { - job, err := t.Client().Core().BatchV1().Jobs(namespace).Get(t.Ctx(), name, metav1.GetOptions{}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - return job - } -} - -func GetJob(t Test, namespace, name string) *batchv1.Job { - t.T().Helper() - return Job(t, namespace, name)(t) -} diff --git a/test/support/conditions.go b/test/support/conditions.go deleted file mode 100644 index 4ef4be1ee..000000000 --- a/test/support/conditions.go +++ /dev/null @@ -1,85 +0,0 @@ -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - appsv1 "k8s.io/api/apps/v1" - batchv1 "k8s.io/api/batch/v1" - corev1 "k8s.io/api/core/v1" - - routev1 "github.com/openshift/api/route/v1" -) - -type conditionType interface { - ~string -} - -func ConditionStatus[T conditionType](conditionType T) func(any) corev1.ConditionStatus { - return func(object any) corev1.ConditionStatus { - switch o := object.(type) { - - case *batchv1.Job: - if c := getJobCondition(o.Status.Conditions, batchv1.JobConditionType(conditionType)); c != nil { - return c.Status - } - case *appsv1.Deployment: - if c := getDeploymentCondition(o.Status.Conditions, appsv1.DeploymentConditionType(conditionType)); c != nil { - return c.Status - } - case *routev1.Route: - if len(o.Status.Ingress) == 0 { - // Route is not initialized yet - break - } - if c := getRouteCondition(o.Status.Ingress[0].Conditions, routev1.RouteIngressConditionType(conditionType)); c != nil { - return c.Status - } - } - - return corev1.ConditionUnknown - } -} - -// TODO: to be replaced with a generic version once common struct fields of a type set can be used. -// See https://github.com/golang/go/issues/48522 -func getJobCondition(conditions []batchv1.JobCondition, conditionType batchv1.JobConditionType) *batchv1.JobCondition { - for _, c := range conditions { - if c.Type == conditionType { - return &c - } - } - return nil -} - -func getDeploymentCondition(conditions []appsv1.DeploymentCondition, conditionType appsv1.DeploymentConditionType) *appsv1.DeploymentCondition { - for _, c := range conditions { - if c.Type == conditionType { - return &c - } - } - return nil -} - -func getRouteCondition(conditions []routev1.RouteIngressCondition, conditionType routev1.RouteIngressConditionType) *routev1.RouteIngressCondition { - for _, c := range conditions { - if c.Type == conditionType { - return &c - } - } - return nil -} diff --git a/test/support/core.go b/test/support/core.go deleted file mode 100644 index 70c48c20e..000000000 --- a/test/support/core.go +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "encoding/json" - "io" - - "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -func CreateConfigMap(t Test, namespace string, content map[string][]byte) *corev1.ConfigMap { - configMap := &corev1.ConfigMap{ - TypeMeta: metav1.TypeMeta{ - APIVersion: corev1.SchemeGroupVersion.String(), - Kind: "ConfigMap", - }, - ObjectMeta: metav1.ObjectMeta{ - GenerateName: "config-", - Namespace: namespace, - }, - BinaryData: content, - Immutable: Ptr(true), - } - - configMap, err := t.Client().Core().CoreV1().ConfigMaps(namespace).Create(t.Ctx(), configMap, metav1.CreateOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - t.T().Logf("Created ConfigMap %s/%s successfully", configMap.Namespace, configMap.Name) - - return configMap -} - -func Raw(t Test, obj runtime.Object) runtime.RawExtension { - t.T().Helper() - data, err := json.Marshal(obj) - t.Expect(err).NotTo(gomega.HaveOccurred()) - return runtime.RawExtension{ - Raw: data, - } -} - -func GetPods(t Test, namespace string, options metav1.ListOptions) []corev1.Pod { - t.T().Helper() - pods, err := t.Client().Core().CoreV1().Pods(namespace).List(t.Ctx(), options) - t.Expect(err).NotTo(gomega.HaveOccurred()) - return pods.Items -} - -func GetPodLogs(t Test, pod *corev1.Pod, options corev1.PodLogOptions) []byte { - t.T().Helper() - stream, err := t.Client().Core().CoreV1().Pods(pod.GetNamespace()).GetLogs(pod.GetName(), &options).Stream(t.Ctx()) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - defer func() { - t.Expect(stream.Close()).To(gomega.Succeed()) - }() - - bytes, err := io.ReadAll(stream) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - return bytes -} - -func storeAllPodLogs(t Test, namespace *corev1.Namespace) { - t.T().Helper() - - pods, err := t.Client().Core().CoreV1().Pods(namespace.Name).List(t.Ctx(), metav1.ListOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - for _, pod := range pods.Items { - for _, container := range pod.Spec.Containers { - t.T().Logf("Retrieving Pod Container %s/%s/%s logs", pod.Namespace, pod.Name, container.Name) - storeContainerLog(t, namespace, pod.Name, container.Name) - } - } -} - -func storeContainerLog(t Test, namespace *corev1.Namespace, podName, containerName string) { - t.T().Helper() - - options := corev1.PodLogOptions{Container: containerName} - stream, err := t.Client().Core().CoreV1().Pods(namespace.Name).GetLogs(podName, &options).Stream(t.Ctx()) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - defer func() { - t.Expect(stream.Close()).To(gomega.Succeed()) - }() - - bytes, err := io.ReadAll(stream) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - containerLogFileName := "pod-" + podName + "-" + containerName - WriteToOutputDir(t, containerLogFileName, Log, bytes) -} diff --git a/test/support/defaults.go b/test/support/defaults.go deleted file mode 100644 index 2e0227cf7..000000000 --- a/test/support/defaults.go +++ /dev/null @@ -1,11 +0,0 @@ -package support - -// *********************** -// DO NOT EDIT THIS FILE -// *********************** - -const ( - CodeFlareSDKVersion = "0.10.1" - RayVersion = "2.5.0" - RayImage = "rayproject/ray:2.5.0" -) diff --git a/test/support/events.go b/test/support/events.go deleted file mode 100644 index beafe558e..000000000 --- a/test/support/events.go +++ /dev/null @@ -1,148 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "bytes" - "fmt" - - "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - eventsv1 "k8s.io/api/events/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// Based on https://github.com/apache/incubator-kie-kogito-operator/blob/28b2d3dc945e48659b199cca33723568b848f72e/test/pkg/framework/logging.go - -const ( - eventLastSeenKey = "LAST_SEEN" - eventFirstSeenKey = "FIRST_SEEN" - eventNameKey = "NAME" - eventSubObjectKey = "SUBOBJECT" - eventTypeKey = "TYPE" - eventReasonKey = "REASON" - eventMessageKey = "MESSAGE" - - eventLogFileName = "events" -) - -var eventKeys = []string{ - eventLastSeenKey, - eventFirstSeenKey, - eventNameKey, - eventSubObjectKey, - eventTypeKey, - eventReasonKey, - eventMessageKey, -} - -func storeEvents(t Test, namespace *corev1.Namespace) { - t.T().Helper() - - events, err := t.Client().Core().EventsV1().Events(namespace.Name).List(t.Ctx(), metav1.ListOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - bytes, err := renderEventContent(eventKeys, mapEventsToKeys(events)) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - WriteToOutputDir(t, eventLogFileName, Log, bytes) -} - -func mapEventsToKeys(eventList *eventsv1.EventList) []map[string]string { - eventMaps := []map[string]string{} - - for _, event := range eventList.Items { - eventMap := make(map[string]string) - eventMap[eventLastSeenKey] = getDefaultEventValueIfNull(event.DeprecatedLastTimestamp.Format("2006-01-02 15:04:05")) - eventMap[eventFirstSeenKey] = getDefaultEventValueIfNull(event.DeprecatedFirstTimestamp.Format("2006-01-02 15:04:05")) - eventMap[eventNameKey] = getDefaultEventValueIfNull(event.GetName()) - eventMap[eventSubObjectKey] = getDefaultEventValueIfNull(event.Regarding.FieldPath) - eventMap[eventTypeKey] = getDefaultEventValueIfNull(event.Type) - eventMap[eventReasonKey] = getDefaultEventValueIfNull(event.Reason) - eventMap[eventMessageKey] = getDefaultEventValueIfNull(event.Note) - - eventMaps = append(eventMaps, eventMap) - } - return eventMaps -} - -func getDefaultEventValueIfNull(value string) string { - if len(value) <= 0 { - return "-" - } - return value -} - -func renderEventContent(keys []string, dataMaps []map[string]string) ([]byte, error) { - var content bytes.Buffer - // Get size of strings to be written, to be able to format correctly - maxStringSizeMap := make(map[string]int) - for _, key := range keys { - maxSize := len(key) - for _, dataMap := range dataMaps { - if len(dataMap[key]) > maxSize { - maxSize = len(dataMap[key]) - } - } - maxStringSizeMap[key] = maxSize - } - - // Write headers - for _, header := range keys { - if _, err := content.WriteString(header); err != nil { - return nil, fmt.Errorf("error in writing the header: %v", err) - } - if _, err := content.WriteString(getWhitespaceStr(maxStringSizeMap[header] - len(header) + 1)); err != nil { - return nil, fmt.Errorf("error in writing headers: %v", err) - } - if _, err := content.WriteString(" | "); err != nil { - return nil, fmt.Errorf("error in writing headers : %v", err) - } - } - if _, err := content.WriteString("\n"); err != nil { - return nil, fmt.Errorf("error in writing headers '|': %v", err) - - } - - // Write events - for _, dataMap := range dataMaps { - for _, key := range keys { - if _, err := content.WriteString(dataMap[key]); err != nil { - return nil, fmt.Errorf("error in writing events: %v", err) - } - if _, err := content.WriteString(getWhitespaceStr(maxStringSizeMap[key] - len(dataMap[key]) + 1)); err != nil { - return nil, fmt.Errorf("error in writing events: %v", err) - } - if _, err := content.WriteString(" | "); err != nil { - return nil, fmt.Errorf("error in writing events: %v", err) - } - } - if _, err := content.WriteString("\n"); err != nil { - return nil, fmt.Errorf("error in writing events: %v", err) - } - } - return content.Bytes(), nil -} - -func getWhitespaceStr(size int) string { - whiteSpaceStr := "" - for i := 0; i < size; i++ { - whiteSpaceStr += " " - } - return whiteSpaceStr -} diff --git a/test/support/ingress.go b/test/support/ingress.go deleted file mode 100644 index d834f3b15..000000000 --- a/test/support/ingress.go +++ /dev/null @@ -1,101 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "net/url" - - "github.com/onsi/gomega" - - networkingv1 "k8s.io/api/networking/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func Ingress(t Test, namespace, name string) func(g gomega.Gomega) *networkingv1.Ingress { - return func(g gomega.Gomega) *networkingv1.Ingress { - ingress, err := t.Client().Core().NetworkingV1().Ingresses(namespace).Get(t.Ctx(), name, metav1.GetOptions{}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - return ingress - } -} - -func GetIngress(t Test, namespace, name string) *networkingv1.Ingress { - t.T().Helper() - return Ingress(t, namespace, name)(t) -} - -func LoadBalancerIngresses(ingress *networkingv1.Ingress) []networkingv1.IngressLoadBalancerIngress { - return ingress.Status.LoadBalancer.Ingress -} - -func ExposeServiceByIngress(t Test, name string, namespace string, serviceName string, servicePort string) url.URL { - ingress := &networkingv1.Ingress{ - TypeMeta: metav1.TypeMeta{ - APIVersion: networkingv1.SchemeGroupVersion.String(), - Kind: "Ingress", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Annotations: map[string]string{ - "nginx.ingress.kubernetes.io/use-regex": "true", - "nginx.ingress.kubernetes.io/rewrite-target": "/$2", - }, - }, - Spec: networkingv1.IngressSpec{ - Rules: []networkingv1.IngressRule{ - networkingv1.IngressRule{ - IngressRuleValue: networkingv1.IngressRuleValue{ - HTTP: &networkingv1.HTTPIngressRuleValue{ - Paths: []networkingv1.HTTPIngressPath{ - networkingv1.HTTPIngressPath{ - Path: "/" + name + "(/|$)(.*)", - PathType: Ptr(networkingv1.PathTypePrefix), - Backend: networkingv1.IngressBackend{ - Service: &networkingv1.IngressServiceBackend{ - Name: serviceName, - Port: networkingv1.ServiceBackendPort{ - Name: servicePort, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - } - - _, err := t.Client().Core().NetworkingV1().Ingresses(ingress.Namespace).Create(t.Ctx(), ingress, metav1.CreateOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - t.T().Logf("Created Ingress %s/%s successfully", ingress.Namespace, ingress.Name) - - t.T().Logf("Waiting for Ingress %s/%s to be admitted", ingress.Namespace, ingress.Name) - t.Eventually(Ingress(t, ingress.Namespace, ingress.Name), TestTimeoutMedium). - Should(gomega.WithTransform(LoadBalancerIngresses, gomega.HaveLen(1))) - - ingress = GetIngress(t, ingress.Namespace, ingress.Name) - - ingressURL := url.URL{ - Scheme: "http", - Host: ingress.Status.LoadBalancer.Ingress[0].IP, - Path: name, - } - return ingressURL -} diff --git a/test/support/mcad.go b/test/support/mcad.go deleted file mode 100644 index 8fdda1652..000000000 --- a/test/support/mcad.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "github.com/onsi/gomega" - mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func AppWrapper(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *mcadv1beta1.AppWrapper { - return func(g gomega.Gomega) *mcadv1beta1.AppWrapper { - aw, err := t.Client().MCAD().WorkloadV1beta1().AppWrappers(namespace.Name).Get(t.Ctx(), name, metav1.GetOptions{}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - return aw - } -} - -func AppWrappers(t Test, namespace *corev1.Namespace) func(g gomega.Gomega) []*mcadv1beta1.AppWrapper { - return func(g gomega.Gomega) []*mcadv1beta1.AppWrapper { - aws, err := t.Client().MCAD().WorkloadV1beta1().AppWrappers(namespace.Name).List(t.Ctx(), metav1.ListOptions{}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - - awsp := []*mcadv1beta1.AppWrapper{} - for _, v := range aws.Items { - v := v - awsp = append(awsp, &v) - } - - return awsp - } -} - -func AppWrapperName(aw *mcadv1beta1.AppWrapper) string { - return aw.Name -} - -func AppWrapperState(aw *mcadv1beta1.AppWrapper) mcadv1beta1.AppWrapperState { - return aw.Status.State -} diff --git a/test/support/namespace.go b/test/support/namespace.go deleted file mode 100644 index 145acbb4a..000000000 --- a/test/support/namespace.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func createTestNamespace(t Test, options ...Option[*corev1.Namespace]) *corev1.Namespace { - t.T().Helper() - namespace := &corev1.Namespace{ - TypeMeta: metav1.TypeMeta{ - APIVersion: corev1.SchemeGroupVersion.String(), - Kind: "Namespace", - }, - ObjectMeta: metav1.ObjectMeta{ - GenerateName: "test-ns-", - }, - } - - for _, option := range options { - t.Expect(option.applyTo(namespace)).To(gomega.Succeed()) - } - - namespace, err := t.Client().Core().CoreV1().Namespaces().Create(t.Ctx(), namespace, metav1.CreateOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - - return namespace -} - -func deleteTestNamespace(t Test, namespace *corev1.Namespace) { - t.T().Helper() - propagationPolicy := metav1.DeletePropagationBackground - err := t.Client().Core().CoreV1().Namespaces().Delete(t.Ctx(), namespace.Name, metav1.DeleteOptions{ - PropagationPolicy: &propagationPolicy, - }) - t.Expect(err).NotTo(gomega.HaveOccurred()) -} diff --git a/test/support/ocm.go b/test/support/ocm.go deleted file mode 100644 index 3d6bd7f19..000000000 --- a/test/support/ocm.go +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "fmt" - "os" - - "github.com/onsi/gomega" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - ocmsdk "github.com/openshift-online/ocm-sdk-go" - cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1" -) - -func CreateOCMConnection(test Test) *ocmsdk.Connection { - secretNamespace, secretName := GetInstascaleOcmSecret() - instascaleOCMSecret, err := test.Client().Core().CoreV1().Secrets(secretNamespace).Get(test.Ctx(), secretName, metav1.GetOptions{}) - test.Expect(err).NotTo(gomega.HaveOccurred()) - - ocmToken := string(instascaleOCMSecret.Data["token"]) - test.T().Logf("Retrieved Secret %s/%s successfully", instascaleOCMSecret.Namespace, instascaleOCMSecret.Name) - - connection, err := buildOCMConnection(ocmToken) - test.Expect(err).NotTo(gomega.HaveOccurred()) - return connection -} - -func buildOCMConnection(secret string) (*ocmsdk.Connection, error) { - connection, err := ocmsdk.NewConnectionBuilder(). - Tokens(secret). - Build() - if err != nil { - fmt.Fprintf(os.Stderr, "Can't build connection: %v\n", err) - return nil, err - } - - return connection, nil -} - -func MachinePools(t Test, connection *ocmsdk.Connection) func(g gomega.Gomega) []*cmv1.MachinePool { - osdClusterId, found := GetOsdClusterId() - t.Expect(found).To(gomega.BeTrue(), "OSD cluster id not found, please configure environment properly") - - return func(g gomega.Gomega) []*cmv1.MachinePool { - machinePoolsListResponse, err := connection.ClustersMgmt().V1().Clusters().Cluster(osdClusterId).MachinePools().List().Send() - g.Expect(err).NotTo(gomega.HaveOccurred()) - return machinePoolsListResponse.Items().Slice() - } -} - -func GetMachinePools(t Test, connection *ocmsdk.Connection) []*cmv1.MachinePool { - t.T().Helper() - return MachinePools(t, connection)(t) -} - -func MachinePoolId(machinePool *cmv1.MachinePool) string { - return machinePool.ID() -} diff --git a/test/support/openshift.go b/test/support/openshift.go deleted file mode 100644 index cfe3b5a3f..000000000 --- a/test/support/openshift.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "github.com/onsi/gomega" - - "k8s.io/apimachinery/pkg/api/errors" -) - -func IsOpenShift(test Test) bool { - test.T().Helper() - _, err := test.Client().Core().Discovery().ServerResourcesForGroupVersion("image.openshift.io/v1") - if err != nil && errors.IsNotFound(err) { - return false - } - test.Expect(err).NotTo(gomega.HaveOccurred()) - return true -} diff --git a/test/support/ray_api.go b/test/support/ray_api.go deleted file mode 100644 index 1f04f6dda..000000000 --- a/test/support/ray_api.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "github.com/onsi/gomega" -) - -func GetRayJobAPIDetails(t Test, rayClient RayClusterClient, jobID string) *RayJobDetailsResponse { - t.T().Helper() - return RayJobAPIDetails(t, rayClient, jobID)(t) -} - -func WriteRayJobAPILogs(t Test, rayClient RayClusterClient, jobID string) { - t.T().Helper() - logs, err := rayClient.GetJobLogs(jobID) - t.Expect(err).NotTo(gomega.HaveOccurred()) - WriteToOutputDir(t, "ray-job-log-"+jobID, Log, []byte(logs)) -} - -func RayJobAPIDetails(t Test, rayClient RayClusterClient, jobID string) func(g gomega.Gomega) *RayJobDetailsResponse { - return func(g gomega.Gomega) *RayJobDetailsResponse { - jobDetails, err := rayClient.GetJobDetails(jobID) - t.Expect(err).NotTo(gomega.HaveOccurred()) - return jobDetails - } -} - -func GetRayJobAPIDetailsStatus(jobDetails *RayJobDetailsResponse) string { - return jobDetails.Status -} diff --git a/test/support/ray_cluster_client.go b/test/support/ray_cluster_client.go deleted file mode 100644 index bbce9af2e..000000000 --- a/test/support/ray_cluster_client.go +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" -) - -type RayJobSetup struct { - EntryPoint string `json:"entrypoint"` - RuntimeEnv map[string]any `json:"runtime_env"` -} - -type RayJobResponse struct { - JobID string `json:"job_id"` - SubmissionID string `json:"submission_id"` -} - -type RayJobDetailsResponse struct { - JobID string `json:"job_id"` - SubmissionID string `json:"submission_id"` - Status string `json:"status"` -} - -type RayJobLogsResponse struct { - Logs string `json:"logs"` -} - -var _ RayClusterClient = (*rayClusterClient)(nil) - -type rayClusterClient struct { - endpoint url.URL -} - -type RayClusterClient interface { - CreateJob(job *RayJobSetup) (*RayJobResponse, error) - GetJobDetails(jobID string) (*RayJobDetailsResponse, error) - GetJobLogs(jobID string) (string, error) -} - -func NewRayClusterClient(dashboardEndpoint url.URL) RayClusterClient { - return &rayClusterClient{endpoint: dashboardEndpoint} -} - -func (client *rayClusterClient) CreateJob(job *RayJobSetup) (response *RayJobResponse, err error) { - marshalled, err := json.Marshal(job) - if err != nil { - return - } - - createJobURL := client.endpoint.String() + "/api/jobs/" - resp, err := http.Post(createJobURL, "application/json", bytes.NewReader(marshalled)) - if err != nil { - return - } - - respData, err := io.ReadAll(resp.Body) - if err != nil { - return - } - - if resp.StatusCode != 200 { - return nil, fmt.Errorf("incorrect response code: %d for creating Ray Job, response body: %s", resp.StatusCode, respData) - } - - err = json.Unmarshal(respData, &response) - return -} - -func (client *rayClusterClient) GetJobDetails(jobID string) (response *RayJobDetailsResponse, err error) { - getJobDetailsURL := client.endpoint.String() + "/api/jobs/" + jobID - resp, err := http.Get(getJobDetailsURL) - if err != nil { - return - } - - respData, err := io.ReadAll(resp.Body) - if err != nil { - return - } - - if resp.StatusCode != 200 { - return nil, fmt.Errorf("incorrect response code: %d for retrieving Ray Job details, response body: %s", resp.StatusCode, respData) - } - - err = json.Unmarshal(respData, &response) - return -} - -func (client *rayClusterClient) GetJobLogs(jobID string) (logs string, err error) { - getJobLogsURL := client.endpoint.String() + "/api/jobs/" + jobID + "/logs" - resp, err := http.Get(getJobLogsURL) - if err != nil { - return - } - - respData, err := io.ReadAll(resp.Body) - if err != nil { - return - } - - if resp.StatusCode != 200 { - return "", fmt.Errorf("incorrect response code: %d for retrieving Ray Job logs, response body: %s", resp.StatusCode, respData) - } - - jobLogs := RayJobLogsResponse{} - err = json.Unmarshal(respData, &jobLogs) - return jobLogs.Logs, err -} diff --git a/test/support/route.go b/test/support/route.go deleted file mode 100644 index df1608909..000000000 --- a/test/support/route.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "net/http" - "net/url" - - "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" - - routev1 "github.com/openshift/api/route/v1" -) - -func Route(t Test, namespace, name string) func(g gomega.Gomega) *routev1.Route { - return func(g gomega.Gomega) *routev1.Route { - route, err := t.Client().Route().RouteV1().Routes(namespace).Get(t.Ctx(), name, metav1.GetOptions{}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - return route - } -} - -func GetRoute(t Test, namespace, name string) *routev1.Route { - t.T().Helper() - return Route(t, namespace, name)(t) -} - -func ExposeServiceByRoute(t Test, name string, namespace string, serviceName string, servicePort string) url.URL { - r := &routev1.Route{ - TypeMeta: metav1.TypeMeta{ - APIVersion: routev1.SchemeGroupVersion.String(), - Kind: "Route", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Spec: routev1.RouteSpec{ - To: routev1.RouteTargetReference{ - Name: serviceName, - }, - Port: &routev1.RoutePort{ - TargetPort: intstr.FromString(servicePort), - }, - }, - } - - _, err := t.Client().Route().RouteV1().Routes(r.Namespace).Create(t.Ctx(), r, metav1.CreateOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - t.T().Logf("Created Route %s/%s successfully", r.Namespace, r.Name) - - t.T().Logf("Waiting for Route %s/%s to be available", r.Namespace, r.Name) - t.Eventually(Route(t, r.Namespace, r.Name), TestTimeoutLong). - Should(gomega.WithTransform(ConditionStatus(routev1.RouteAdmitted), gomega.Equal(corev1.ConditionTrue))) - - // Retrieve hostname - r, err = t.Client().Route().RouteV1().Routes(r.Namespace).Get(t.Ctx(), r.Name, metav1.GetOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - hostname := r.Status.Ingress[0].Host - - // Wait for expected HTTP code - t.Eventually(func() int { - resp, _ := http.Get("http://" + hostname) - return resp.StatusCode - }, TestTimeoutLong).Should(gomega.Not(gomega.Equal(503))) - - r = GetRoute(t, r.Namespace, r.Name) - routeURL := url.URL{ - Scheme: "http", - Host: r.Status.Ingress[0].Host, - } - - return routeURL -} diff --git a/test/support/service.go b/test/support/service.go deleted file mode 100644 index d59ea3ec9..000000000 --- a/test/support/service.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import "net/url" - -func ExposeService(t Test, name string, namespace string, serviceName string, servicePort string) url.URL { - if IsOpenShift(t) { - return ExposeServiceByRoute(t, name, namespace, serviceName, servicePort) - } else { - return ExposeServiceByIngress(t, name, namespace, serviceName, servicePort) - } -} diff --git a/test/support/support.go b/test/support/support.go deleted file mode 100644 index 36c8c9beb..000000000 --- a/test/support/support.go +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "fmt" - "os" - "time" - - "github.com/onsi/gomega" - "github.com/onsi/gomega/format" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var ( - ApplyOptions = metav1.ApplyOptions{FieldManager: "codeflare-test", Force: true} - - TestTimeoutShort = 1 * time.Minute - TestTimeoutMedium = 2 * time.Minute - TestTimeoutLong = 5 * time.Minute - TestTimeoutGpuProvisioning = 30 * time.Minute -) - -func init() { - if value, ok := os.LookupEnv("CODEFLARE_TEST_TIMEOUT_SHORT"); ok { - if duration, err := time.ParseDuration(value); err == nil { - TestTimeoutShort = duration - } else { - fmt.Printf("Error parsing CODEFLARE_TEST_TIMEOUT_SHORT. Using default value: %s", TestTimeoutShort) - } - } - if value, ok := os.LookupEnv("CODEFLARE_TEST_TIMEOUT_MEDIUM"); ok { - if duration, err := time.ParseDuration(value); err == nil { - TestTimeoutMedium = duration - } else { - fmt.Printf("Error parsing CODEFLARE_TEST_TIMEOUT_MEDIUM. Using default value: %s", TestTimeoutMedium) - } - } - if value, ok := os.LookupEnv("CODEFLARE_TEST_TIMEOUT_LONG"); ok { - if duration, err := time.ParseDuration(value); err == nil { - TestTimeoutLong = duration - } else { - fmt.Printf("Error parsing CODEFLARE_TEST_TIMEOUT_LONG. Using default value: %s", TestTimeoutLong) - } - } - if value, ok := os.LookupEnv("CODEFLARE_TEST_TIMEOUT_GPU_PROVISIONING"); ok { - if duration, err := time.ParseDuration(value); err == nil { - TestTimeoutGpuProvisioning = duration - } else { - fmt.Printf("Error parsing CODEFLARE_TEST_TIMEOUT_GPU_PROVISIONING. Using default value: %s", TestTimeoutGpuProvisioning) - } - } - - // Gomega settings - gomega.SetDefaultEventuallyTimeout(TestTimeoutShort) - gomega.SetDefaultEventuallyPollingInterval(1 * time.Second) - gomega.SetDefaultConsistentlyDuration(30 * time.Second) - gomega.SetDefaultConsistentlyPollingInterval(1 * time.Second) - // Disable object truncation on test results - format.MaxLength = 0 -} diff --git a/test/support/test.go b/test/support/test.go deleted file mode 100644 index 683b0f214..000000000 --- a/test/support/test.go +++ /dev/null @@ -1,139 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "context" - "os" - "path" - "sync" - "testing" - - "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" -) - -type Test interface { - T() *testing.T - Ctx() context.Context - Client() Client - OutputDir() string - - gomega.Gomega - - NewTestNamespace(...Option[*corev1.Namespace]) *corev1.Namespace -} - -type Option[T any] interface { - applyTo(to T) error -} - -type errorOption[T any] func(to T) error - -// nolint: unused -// To be removed when the false-positivity is fixed. -func (o errorOption[T]) applyTo(to T) error { - return o(to) -} - -var _ Option[any] = errorOption[any](nil) - -func With(t *testing.T) Test { - t.Helper() - ctx := context.Background() - if deadline, ok := t.Deadline(); ok { - withDeadline, cancel := context.WithDeadline(ctx, deadline) - t.Cleanup(cancel) - ctx = withDeadline - } - - return &T{ - WithT: gomega.NewWithT(t), - t: t, - ctx: ctx, - } -} - -type T struct { - *gomega.WithT - t *testing.T - // nolint: containedctx - ctx context.Context - client Client - outputDir string - once struct { - client sync.Once - outputDir sync.Once - } -} - -func (t *T) T() *testing.T { - return t.t -} - -func (t *T) Ctx() context.Context { - return t.ctx -} - -func (t *T) Client() Client { - t.T().Helper() - t.once.client.Do(func() { - c, err := newTestClient() - if err != nil { - t.T().Fatalf("Error creating client: %v", err) - } - t.client = c - }) - return t.client -} - -func (t *T) OutputDir() string { - t.T().Helper() - t.once.outputDir.Do(func() { - if parent, ok := os.LookupEnv(CodeFlareTestOutputDir); ok { - if !path.IsAbs(parent) { - if cwd, err := os.Getwd(); err == nil { - // best effort to output the parent absolute path - parent = path.Join(cwd, parent) - } - } - t.T().Logf("Creating output directory in parent directory: %s", parent) - dir, err := os.MkdirTemp(parent, t.T().Name()) - if err != nil { - t.T().Fatalf("Error creating output directory: %v", err) - } - t.outputDir = dir - } else { - t.T().Logf("Creating ephemeral output directory as %s env variable is unset", CodeFlareTestOutputDir) - t.outputDir = t.T().TempDir() - } - t.T().Logf("Output directory has been created at: %s", t.outputDir) - }) - return t.outputDir -} - -func (t *T) NewTestNamespace(options ...Option[*corev1.Namespace]) *corev1.Namespace { - t.T().Helper() - namespace := createTestNamespace(t, options...) - t.T().Cleanup(func() { - storeAllPodLogs(t, namespace) - storeEvents(t, namespace) - deleteTestNamespace(t, namespace) - }) - return namespace -} diff --git a/test/support/utils.go b/test/support/utils.go deleted file mode 100644 index 595ac4103..000000000 --- a/test/support/utils.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "io/fs" - "os" - "path" - - "github.com/onsi/gomega" -) - -func Ptr[T any](v T) *T { - return &v -} - -type OutputType string - -const ( - Log OutputType = "log" -) - -func WriteToOutputDir(t Test, fileName string, fileType OutputType, data []byte) { - t.T().Helper() - t.Expect(os.WriteFile(path.Join(t.OutputDir(), fileName+"."+string(fileType)), data, fs.ModePerm)). - To(gomega.Succeed()) -} From b938a5822a9863e4fe09dbd5661beff0556e3e8a Mon Sep 17 00:00:00 2001 From: Fiona Waters Date: Fri, 13 Oct 2023 15:49:04 +0100 Subject: [PATCH 2/6] updating support package import --- test/e2e/instascale_app_wrapper.go | 3 +-- test/e2e/instascale_machinepool_test.go | 2 +- test/e2e/mnist_pytorch_mcad_job_test.go | 3 +-- test/e2e/mnist_raycluster_sdk_test.go | 3 +-- test/e2e/mnist_rayjob_mcad_raycluster_test.go | 3 +-- test/e2e/support.go | 3 +-- 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/test/e2e/instascale_app_wrapper.go b/test/e2e/instascale_app_wrapper.go index 805df1bc3..e030817f3 100644 --- a/test/e2e/instascale_app_wrapper.go +++ b/test/e2e/instascale_app_wrapper.go @@ -17,14 +17,13 @@ limitations under the License. package e2e import ( + . "github.com/project-codeflare/codeflare-common/support" mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/project-codeflare/codeflare-operator/test/support" ) func instaScaleJobAppWrapper(test Test, namespace *corev1.Namespace, config *corev1.ConfigMap) *mcadv1beta1.AppWrapper { diff --git a/test/e2e/instascale_machinepool_test.go b/test/e2e/instascale_machinepool_test.go index 386b224db..2791cb07e 100644 --- a/test/e2e/instascale_machinepool_test.go +++ b/test/e2e/instascale_machinepool_test.go @@ -20,11 +20,11 @@ import ( "testing" . "github.com/onsi/gomega" + . "github.com/project-codeflare/codeflare-common/support" mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - . "github.com/project-codeflare/codeflare-operator/test/support" ) func TestInstascaleMachinePool(t *testing.T) { diff --git a/test/e2e/mnist_pytorch_mcad_job_test.go b/test/e2e/mnist_pytorch_mcad_job_test.go index 84722152a..7a157c040 100644 --- a/test/e2e/mnist_pytorch_mcad_job_test.go +++ b/test/e2e/mnist_pytorch_mcad_job_test.go @@ -20,14 +20,13 @@ import ( "testing" . "github.com/onsi/gomega" + . "github.com/project-codeflare/codeflare-common/support" mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/project-codeflare/codeflare-operator/test/support" ) // Trains the MNIST dataset as a batch Job managed by MCAD, and asserts successful completion of the training job. diff --git a/test/e2e/mnist_raycluster_sdk_test.go b/test/e2e/mnist_raycluster_sdk_test.go index 29643fe67..b8cc5af7e 100644 --- a/test/e2e/mnist_raycluster_sdk_test.go +++ b/test/e2e/mnist_raycluster_sdk_test.go @@ -20,6 +20,7 @@ import ( "testing" . "github.com/onsi/gomega" + . "github.com/project-codeflare/codeflare-common/support" mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" @@ -27,8 +28,6 @@ import ( corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/project-codeflare/codeflare-operator/test/support" ) // Creates a Ray cluster, and trains the MNIST dataset using the CodeFlare SDK. diff --git a/test/e2e/mnist_rayjob_mcad_raycluster_test.go b/test/e2e/mnist_rayjob_mcad_raycluster_test.go index a7956f66e..725ced9db 100644 --- a/test/e2e/mnist_rayjob_mcad_raycluster_test.go +++ b/test/e2e/mnist_rayjob_mcad_raycluster_test.go @@ -21,14 +21,13 @@ import ( "testing" . "github.com/onsi/gomega" + . "github.com/project-codeflare/codeflare-common/support" mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/project-codeflare/codeflare-operator/test/support" ) // Trains the MNIST dataset as a RayJob, executed by a Ray cluster managed by MCAD, diff --git a/test/e2e/support.go b/test/e2e/support.go index 14bf19ce4..e91656880 100644 --- a/test/e2e/support.go +++ b/test/e2e/support.go @@ -20,8 +20,7 @@ import ( "embed" "github.com/onsi/gomega" - - "github.com/project-codeflare/codeflare-operator/test/support" + "github.com/project-codeflare/codeflare-common/support" ) //go:embed *.py *.txt From 3b2f041a7e8b364a5ea0ddd9e1cbdf09853feb9f Mon Sep 17 00:00:00 2001 From: Fiona Waters Date: Mon, 16 Oct 2023 11:12:25 +0100 Subject: [PATCH 3/6] removing defaults make target --- Makefile | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index e7bd3787a..43e0c75f0 100644 --- a/Makefile +++ b/Makefile @@ -125,27 +125,6 @@ help: ## Display this help. ##@ Development -DEFAULTS_TEST_FILE := test/support/defaults.go - -.PHONY: defaults -defaults: - $(info Regenerating $(DEFAULTS_TEST_FILE)) - @echo "package support" > $(DEFAULTS_TEST_FILE) - @echo "" >> $(DEFAULTS_TEST_FILE) - @echo "// ***********************" >> $(DEFAULTS_TEST_FILE) - @echo "// DO NOT EDIT THIS FILE" >> $(DEFAULTS_TEST_FILE) - @echo "// ***********************" >> $(DEFAULTS_TEST_FILE) - @echo "" >> $(DEFAULTS_TEST_FILE) - @echo "const (" >> $(DEFAULTS_TEST_FILE) - @echo " CodeFlareSDKVersion = \"$(CODEFLARE_SDK_VERSION)\"" >> $(DEFAULTS_TEST_FILE) - @echo " RayVersion = \"$(RAY_VERSION)\"" >> $(DEFAULTS_TEST_FILE) - @echo " RayImage = \"$(RAY_IMAGE)\"" >> $(DEFAULTS_TEST_FILE) - @echo "" >> $(DEFAULTS_TEST_FILE) - @echo ")" >> $(DEFAULTS_TEST_FILE) - @echo "" >> $(DEFAULTS_TEST_FILE) - - gofmt -w $(DEFAULTS_TEST_FILE) - # this encounters sed issues on MacOS, quick fix is to use gsed or to escape the parentheses i.e. \( \) .PHONY: manifests manifests: controller-gen kustomize ## Generate RBAC objects. @@ -172,11 +151,11 @@ modules: ## Update Go dependencies. go mod tidy .PHONY: build -build: modules defaults fmt vet ## Build manager binary. +build: modules fmt vet ## Build manager binary. go build -o bin/manager main.go .PHONY: run -run: modules defaults manifests fmt vet ## Run a controller from your host. +run: modules manifests fmt vet ## Run a controller from your host. go run ./main.go .PHONY: image-build @@ -283,7 +262,7 @@ validate-bundle: install-operator-sdk $(OPERATOR_SDK) bundle validate ./bundle --select-optional suite=operatorframework .PHONY: bundle -bundle: defaults manifests kustomize install-operator-sdk ## Generate bundle manifests and metadata, then validate generated files. +bundle: manifests kustomize install-operator-sdk ## Generate bundle manifests and metadata, then validate generated files. $(OPERATOR_SDK) generate kustomize manifests -q cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/metadata/annotations/containerImage", "value": "$(IMG)" }]' --kind ClusterServiceVersion @@ -362,11 +341,11 @@ catalog-push: ## Push a catalog image. podman push $(CATALOG_IMG) $(CATALOG_PUSH_OPT) .PHONY: test-unit -test-unit: defaults manifests fmt vet envtest ## Run unit tests. +test-unit: manifests fmt vet envtest ## Run unit tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(go list ./... | grep -v /test/) -coverprofile cover.out .PHONY: test-e2e -test-e2e: defaults manifests fmt vet ## Run e2e tests. +test-e2e: manifests fmt vet ## Run e2e tests. go test -timeout 30m -v ./test/e2e .PHONY: kind-e2e From 32c2dea16330ab6a61837590066e3d09c383681c Mon Sep 17 00:00:00 2001 From: Fiona Waters Date: Mon, 23 Oct 2023 14:41:42 +0100 Subject: [PATCH 4/6] updating files --- test/e2e/instascale_machinepool_test.go | 1 - test/e2e/instascale_machineset_test.go | 5 +- test/support/client.go | 137 ------------------------ test/support/environment.go | 104 ------------------ test/support/machine.go | 32 ------ test/support/ray.go | 70 ------------ 6 files changed, 2 insertions(+), 347 deletions(-) delete mode 100644 test/support/client.go delete mode 100644 test/support/environment.go delete mode 100644 test/support/machine.go delete mode 100644 test/support/ray.go diff --git a/test/e2e/instascale_machinepool_test.go b/test/e2e/instascale_machinepool_test.go index 2791cb07e..69fa037d3 100644 --- a/test/e2e/instascale_machinepool_test.go +++ b/test/e2e/instascale_machinepool_test.go @@ -24,7 +24,6 @@ import ( mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - ) func TestInstascaleMachinePool(t *testing.T) { diff --git a/test/e2e/instascale_machineset_test.go b/test/e2e/instascale_machineset_test.go index fad7717b2..827fd4044 100644 --- a/test/e2e/instascale_machineset_test.go +++ b/test/e2e/instascale_machineset_test.go @@ -4,11 +4,10 @@ import ( "testing" . "github.com/onsi/gomega" + . "github.com/project-codeflare/codeflare-common/support" mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/project-codeflare/codeflare-operator/test/support" ) func TestInstascaleMachineSet(t *testing.T) { @@ -31,7 +30,7 @@ func TestInstascaleMachineSet(t *testing.T) { "mnist.py": ReadFile(test, "mnist.py"), }) - // // Setup batch job and AppWrapper + // Setup batch job and AppWrapper aw := instaScaleJobAppWrapper(test, namespace, cm) // look for machine set with aw name - expect to find it diff --git a/test/support/client.go b/test/support/client.go deleted file mode 100644 index d911c7c2c..000000000 --- a/test/support/client.go +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - mcadclient "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset/versioned" - rayclient "github.com/ray-project/kuberay/ray-operator/pkg/client/clientset/versioned" - - "k8s.io/client-go/dynamic" - "k8s.io/client-go/kubernetes" - _ "k8s.io/client-go/plugin/pkg/client/auth" - "k8s.io/client-go/tools/clientcmd" - - imagev1 "github.com/openshift/client-go/image/clientset/versioned" - machinev1 "github.com/openshift/client-go/machine/clientset/versioned" - routev1 "github.com/openshift/client-go/route/clientset/versioned" - // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) - // to ensure that exec-entrypoint and run can make use of them. -) - -type Client interface { - Core() kubernetes.Interface - Machine() machinev1.Interface - Route() routev1.Interface - Image() imagev1.Interface - MCAD() mcadclient.Interface - Ray() rayclient.Interface - Dynamic() dynamic.Interface -} - -type testClient struct { - core kubernetes.Interface - machine machinev1.Interface - route routev1.Interface - image imagev1.Interface - mcad mcadclient.Interface - ray rayclient.Interface - dynamic dynamic.Interface -} - -var _ Client = (*testClient)(nil) - -func (t *testClient) Core() kubernetes.Interface { - return t.core -} - -func (t *testClient) Machine() machinev1.Interface { - return t.machine -} - -func (t *testClient) Route() routev1.Interface { - return t.route -} - -func (t *testClient) Image() imagev1.Interface { - return t.image -} -func (t *testClient) MCAD() mcadclient.Interface { - return t.mcad -} - -func (t *testClient) Ray() rayclient.Interface { - return t.ray -} - -func (t *testClient) Dynamic() dynamic.Interface { - return t.dynamic -} - -func newTestClient() (Client, error) { - cfg, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig( - clientcmd.NewDefaultClientConfigLoadingRules(), - &clientcmd.ConfigOverrides{}, - ).ClientConfig() - if err != nil { - return nil, err - } - - kubeClient, err := kubernetes.NewForConfig(cfg) - if err != nil { - return nil, err - } - - machineClient, err := machinev1.NewForConfig(cfg) - if err != nil { - return nil, err - } - - routeClient, err := routev1.NewForConfig(cfg) - if err != nil { - return nil, err - } - - imageClient, err := imagev1.NewForConfig(cfg) - if err != nil { - return nil, err - } - - mcadClient, err := mcadclient.NewForConfig(cfg) - if err != nil { - return nil, err - } - - rayClient, err := rayclient.NewForConfig(cfg) - if err != nil { - return nil, err - } - - dynamicClient, err := dynamic.NewForConfig(cfg) - if err != nil { - return nil, err - } - - return &testClient{ - core: kubeClient, - machine: machineClient, - route: routeClient, - image: imageClient, - mcad: mcadClient, - ray: rayClient, - dynamic: dynamicClient, - }, nil -} diff --git a/test/support/environment.go b/test/support/environment.go deleted file mode 100644 index 7d8e6bc80..000000000 --- a/test/support/environment.go +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "os" - "strings" -) - -const ( - // The environment variables hereafter can be used to change the components - // used for testing. - - CodeFlareTestSdkVersion = "CODEFLARE_TEST_SDK_VERSION" - CodeFlareTestRayVersion = "CODEFLARE_TEST_RAY_VERSION" - CodeFlareTestRayImage = "CODEFLARE_TEST_RAY_IMAGE" - CodeFlareTestPyTorchImage = "CODEFLARE_TEST_PYTORCH_IMAGE" - - // The testing output directory, to write output files into. - CodeFlareTestOutputDir = "CODEFLARE_TEST_OUTPUT_DIR" - - // The namespace where a secret containing InstaScale OCM token is stored and the secret name. - InstaScaleOcmSecret = "INSTASCALE_OCM_SECRET" - - // Cluster ID for OSD cluster used in tests, used for testing InstaScale - OsdClusterID = "CLUSTERID" - - // Type of cluster test is run on - ClusterTypeEnvVar = "CLUSTER_TYPE" -) - -type ClusterType string - -const ( - OsdCluster ClusterType = "OSD" - OcpCluster ClusterType = "OCP" - HypershiftCluster ClusterType = "HYPERSHIFT" - UndefinedCluster ClusterType = "UNDEFINED" -) - -func GetCodeFlareSDKVersion() string { - return lookupEnvOrDefault(CodeFlareTestSdkVersion, CodeFlareSDKVersion) -} - -func GetRayVersion() string { - return lookupEnvOrDefault(CodeFlareTestRayVersion, RayVersion) -} - -func GetRayImage() string { - return lookupEnvOrDefault(CodeFlareTestRayImage, RayImage) -} - -func GetPyTorchImage() string { - return lookupEnvOrDefault(CodeFlareTestPyTorchImage, "pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime") -} - -func GetInstascaleOcmSecret() (string, string) { - res := strings.SplitN(lookupEnvOrDefault(InstaScaleOcmSecret, "default/instascale-ocm-secret"), "/", 2) - return res[0], res[1] -} - -func GetOsdClusterId() (string, bool) { - return os.LookupEnv(OsdClusterID) -} - -func GetClusterType(t Test) ClusterType { - clusterType, ok := os.LookupEnv(ClusterTypeEnvVar) - if !ok { - t.T().Logf("Expected environment variable %s not found, cluster type is not defined.", ClusterTypeEnvVar) - return UndefinedCluster - } - switch clusterType { - case "OSD": - return OsdCluster - case "OCP": - return OcpCluster - case "HYPERSHIFT": - return HypershiftCluster - default: - t.T().Logf("Expected environment variable %s contains unexpected value: '%s'", ClusterTypeEnvVar, clusterType) - return UndefinedCluster - } -} - -func lookupEnvOrDefault(key, value string) string { - if v, ok := os.LookupEnv(key); ok { - return v - } - return value -} diff --git a/test/support/machine.go b/test/support/machine.go deleted file mode 100644 index 26acb4bce..000000000 --- a/test/support/machine.go +++ /dev/null @@ -1,32 +0,0 @@ -package support - -import ( - "github.com/onsi/gomega" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - machinev1beta1 "github.com/openshift/api/machine/v1beta1" -) - -func GetMachineSets(t Test) ([]machinev1beta1.MachineSet, error) { - ms, err := t.Client().Machine().MachineV1beta1().MachineSets("openshift-machine-api").List(t.Ctx(), metav1.ListOptions{}) - t.Expect(err).NotTo(gomega.HaveOccurred()) - return ms.Items, err -} - -func Machines(t Test, machineSetName string) func(g gomega.Gomega) []machinev1beta1.Machine { - return func(g gomega.Gomega) []machinev1beta1.Machine { - machine, err := t.Client().Machine().MachineV1beta1().Machines("openshift-machine-api").List(t.Ctx(), metav1.ListOptions{LabelSelector: "machine.openshift.io/cluster-api-machineset=" + machineSetName}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - return machine.Items - } -} - -func GetMachines(t Test, machineSetName string) []machinev1beta1.Machine { - t.T().Helper() - return Machines(t, machineSetName)(t) -} - -func MachineSetId(machineSet machinev1beta1.MachineSet) string { - return machineSet.Name -} diff --git a/test/support/ray.go b/test/support/ray.go deleted file mode 100644 index f18edaa03..000000000 --- a/test/support/ray.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package support - -import ( - "github.com/onsi/gomega" - rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const RayJobDefaultClusterSelectorKey = "ray.io/cluster" - -func RayJob(t Test, namespace, name string) func(g gomega.Gomega) *rayv1.RayJob { - return func(g gomega.Gomega) *rayv1.RayJob { - job, err := t.Client().Ray().RayV1().RayJobs(namespace).Get(t.Ctx(), name, metav1.GetOptions{}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - return job - } -} - -func GetRayJob(t Test, namespace, name string) *rayv1.RayJob { - t.T().Helper() - return RayJob(t, namespace, name)(t) -} - -func RayJobStatus(job *rayv1.RayJob) rayv1.JobStatus { - return job.Status.JobStatus -} - -func GetRayJobId(t Test, namespace, name string) string { - t.T().Helper() - job := RayJob(t, namespace, name)(t) - return job.Status.JobId -} - -func RayCluster(t Test, namespace, name string) func(g gomega.Gomega) *rayv1.RayCluster { - return func(g gomega.Gomega) *rayv1.RayCluster { - cluster, err := t.Client().Ray().RayV1().RayClusters(namespace).Get(t.Ctx(), name, metav1.GetOptions{}) - g.Expect(err).NotTo(gomega.HaveOccurred()) - return cluster - } -} - -func GetRayCluster(t Test, namespace, name string) *rayv1.RayCluster { - t.T().Helper() - return RayCluster(t, namespace, name)(t) -} - -func RayClusterState(cluster *rayv1.RayCluster) rayv1.ClusterState { - return cluster.Status.State -} - -func WriteRayJobLogs(t Test, rayClient RayClusterClient, namespace, name string) { - WriteRayJobAPILogs(t, rayClient, GetRayJobId(t, namespace, name)) -} From 863541228d7ff0be720bb9d7f38cdd9578f6f858 Mon Sep 17 00:00:00 2001 From: Fiona Waters Date: Tue, 24 Oct 2023 13:16:25 +0100 Subject: [PATCH 5/6] update go.mod and go.sum --- go.mod | 5 +++-- go.sum | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 40254116f..912d2a1b2 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,8 @@ go 1.19 require ( github.com/onsi/gomega v1.27.10 - github.com/openshift-online/ocm-sdk-go v0.1.368 github.com/openshift/api v0.0.0-20230213134911-7ba313770556 - github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c + github.com/project-codeflare/codeflare-common v0.0.0-20231023092720-93d03492db16 github.com/project-codeflare/instascale v0.2.1 github.com/project-codeflare/multi-cluster-app-dispatcher v1.37.1 github.com/ray-project/kuberay/ray-operator v0.0.0-20231016183545-097828931d15 @@ -70,6 +69,8 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/openshift-online/ocm-sdk-go v0.1.368 // indirect + github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect diff --git a/go.sum b/go.sum index 867260a31..c2efac624 100644 --- a/go.sum +++ b/go.sum @@ -391,6 +391,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-codeflare/codeflare-common v0.0.0-20231023092720-93d03492db16 h1:TRMLDP6IYt0CAd3+BkvY/r2lkpjI3sOsxf3tnQojZ9k= +github.com/project-codeflare/codeflare-common v0.0.0-20231023092720-93d03492db16/go.mod h1:zdi2GCYJX+QyxFWyCLMoTme3NMz/aucWDJWMqKfigxk= github.com/project-codeflare/instascale v0.2.1 h1:t+Ax/sk4yPQznO6N+U8Cq+bk3afCcZDj9wnHfiGSDBg= github.com/project-codeflare/instascale v0.2.1/go.mod h1:zSzBTP4cFkg+bD4JyYTDmDnGwVKY/+6ACks57NAiscc= github.com/project-codeflare/multi-cluster-app-dispatcher v1.37.1 h1:hZhGwKTPeHYYhNbvO27NOjozVpy7m3I3apKf81u9U3A= From 5bb981a6df44853b96121aad1a8ce3ac71c50672 Mon Sep 17 00:00:00 2001 From: Fiona Waters Date: Tue, 24 Oct 2023 13:16:59 +0100 Subject: [PATCH 6/6] addressing feedback --- .github/workflows/tag-and-build.yml | 2 -- Makefile | 6 ------ 2 files changed, 8 deletions(-) diff --git a/.github/workflows/tag-and-build.yml b/.github/workflows/tag-and-build.yml index 3fa7484d9..83518da5f 100644 --- a/.github/workflows/tag-and-build.yml +++ b/.github/workflows/tag-and-build.yml @@ -93,10 +93,8 @@ jobs: - name: Adjust MCAD, SDK and InstaScale dependencies in the code run: | # Remove leading 'v' - CODEFLARE_SDK_VERSION=$(cut -c2- <<< ${{ github.event.inputs.codeflare-sdk-version }}) 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/(.*CODEFLARE_SDK_VERSION \?= ).*/\1$CODEFLARE_SDK_VERSION/" Makefile sed -i -E "s/(.*INSTASCALE_VERSION \?= ).*/\1${{ github.event.inputs.instascale-version }}/" Makefile - name: Login to Quay.io diff --git a/Makefile b/Makefile index 43e0c75f0..56f9007f1 100644 --- a/Makefile +++ b/Makefile @@ -27,9 +27,6 @@ KUBERAY_VERSION ?= v1.0.0-rc.1 # RAY_VERSION defines the default version of Ray (used for testing) RAY_VERSION ?= 2.5.0 -# CODEFLARE_SDK_VERSION defines the default version of the CodeFlare SDK -CODEFLARE_SDK_VERSION ?= 0.10.1 - # OPERATORS_REPO_ORG points to GitHub repository organization where bundle PR is opened against # OPERATORS_REPO_FORK_ORG points to GitHub repository fork organization where bundle build is pushed to OPERATORS_REPO_ORG ?= redhat-openshift-ecosystem @@ -64,9 +61,6 @@ IMAGE_ORG_BASE ?= quay.io/project-codeflare # codeflare.dev/codeflare-operator-bundle:$VERSION and codeflare.dev/codeflare-operator-catalog:$VERSION. IMAGE_TAG_BASE ?= $(IMAGE_ORG_BASE)/codeflare-operator -# RAY_IMAGE defines the default container image for Ray (used for testing) -RAY_IMAGE ?= rayproject/ray:$(RAY_VERSION) - # BUNDLE_IMG defines the image:tag used for the bundle. # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:$(VERSION)