support

package
v0.0.0-...-3801016 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 56 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CodeFlareSDKVersion = "0.12.0"
	RayVersion          = "2.5.0"
	RayImage            = "quay.io/project-codeflare/ray:latest-py39-cu118"
)
View Source
const (
	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
	ClusterID = "CLUSTERID"

	// Type of cluster test is run on
	ClusterTypeEnvVar = "CLUSTER_TYPE"

	// Hostname of the Kubernetes cluster
	ClusterHostname = "CLUSTER_HOSTNAME"
)
View Source
const RayJobDefaultClusterSelectorKey = "ray.io/cluster"

Variables

View Source
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
)

Functions

func AppWrapper

func AppWrapper(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *mcadv1beta2.AppWrapper

func AppWrapperName

func AppWrapperName(aw *mcadv1beta2.AppWrapper) string

func AppWrappers

func AppWrappers(t Test, namespace *corev1.Namespace) func(g gomega.Gomega) []*mcadv1beta2.AppWrapper

func ConditionStatus

func ConditionStatus[T conditionType](conditionType T) func(any) corev1.ConditionStatus

func CreateClusterRole

func CreateClusterRole(t Test, policyRules []rbacv1.PolicyRule) *rbacv1.ClusterRole

func CreateClusterRoleBinding

func CreateClusterRoleBinding(t Test, serviceAccount *corev1.ServiceAccount, role *rbacv1.ClusterRole) *rbacv1.ClusterRoleBinding

func CreateConfigMap

func CreateConfigMap(t Test, namespace string, content map[string][]byte) *corev1.ConfigMap

func CreateKueueClusterQueue

func CreateKueueClusterQueue(t Test, clusterQueueSpec kueuev1beta1.ClusterQueueSpec) *kueuev1beta1.ClusterQueue

func CreateKueueLocalQueue

func CreateKueueLocalQueue(t Test, namespace, clusterQueueName string) *kueuev1beta1.LocalQueue

func CreateKueueResourceFlavor

func CreateKueueResourceFlavor(t Test, resourceFlavorSpec kueuev1beta1.ResourceFlavorSpec) *kueuev1beta1.ResourceFlavor

func CreateOCMConnection

func CreateOCMConnection(test Test) *ocmsdk.Connection

func CreatePersistentVolumeClaim

func CreatePersistentVolumeClaim(t Test, namespace string, storageSize string, accessMode ...corev1.PersistentVolumeAccessMode) *corev1.PersistentVolumeClaim

func CreateRole

func CreateRole(t Test, namespace string, policyRules []rbacv1.PolicyRule) *rbacv1.Role

func CreateRoleBinding

func CreateRoleBinding(t Test, namespace string, serviceAccount *corev1.ServiceAccount, role *rbacv1.Role) *rbacv1.RoleBinding

func CreateServiceAccount

func CreateServiceAccount(t Test, namespace string) *corev1.ServiceAccount

func CreateTestNamespaceWithName

func CreateTestNamespaceWithName(t Test, namespaceName string, options ...Option[*corev1.Namespace]) *corev1.Namespace

func CreateToken

func CreateToken(t Test, namespace string, serviceAccount *corev1.ServiceAccount) string

func CreateUserClusterRoleBinding

func CreateUserClusterRoleBinding(t Test, userName string, role *rbacv1.ClusterRole) *rbacv1.ClusterRoleBinding

func CreateUserRoleBinding

func CreateUserRoleBinding(t Test, namespace string, userName string, role *rbacv1.Role) *rbacv1.RoleBinding

func DeleteTestNamespace

func DeleteTestNamespace(t Test, namespace *corev1.Namespace)

func ExposeService

func ExposeService(t Test, name string, namespace string, serviceName string, servicePort string) url.URL

func ExposeServiceByIngress

func ExposeServiceByIngress(t Test, name string, namespace string, serviceName string, servicePort string) url.URL

func ExposeServiceByRoute

func ExposeServiceByRoute(t Test, name string, namespace string, serviceName string, servicePort string) url.URL

func GetAppWrapper

func GetAppWrapper(t Test, namespace *corev1.Namespace, name string) *mcadv1beta2.AppWrapper

func GetClusterHostname

func GetClusterHostname(t Test) string

func GetClusterId

func GetClusterId() (string, bool)

func GetCodeFlareSDKVersion

func GetCodeFlareSDKVersion() string

func GetImageStream

func GetImageStream(t Test, namespace string, name string) *imagev1.ImageStream

func GetIngress

func GetIngress(t Test, namespace, name string) *networkingv1.Ingress

func GetInstascaleOcmSecret

func GetInstascaleOcmSecret() (string, string)

func GetJob

func GetJob(t Test, namespace, name string) *batchv1.Job

func GetKueueWorkloads

func GetKueueWorkloads(t Test, namespace string) []*kueuev1beta1.Workload

func GetMachinePools

func GetMachinePools(t Test, connection *ocmsdk.Connection) []*cmv1.MachinePool

func GetMachineSets

func GetMachineSets(t Test) ([]machinev1beta1.MachineSet, error)

func GetMachines

func GetMachines(t Test, machineSetName string) []machinev1beta1.Machine

func GetMnistDatasetURL

func GetMnistDatasetURL() string

func GetNamespaceWithName

func GetNamespaceWithName(t Test, namespaceName string) *corev1.Namespace

func GetNodeInternalIP

func GetNodeInternalIP(t Test, node corev1.Node) (IP string)

func GetNodePools

func GetNodePools(t Test, connection *ocmsdk.Connection) []*cmv1.NodePool

func GetNodes

func GetNodes(t Test) []corev1.Node

func GetOpenShiftApiUrl

func GetOpenShiftApiUrl(test Test) string

func GetOpenShiftIngressDomain

func GetOpenShiftIngressDomain(test Test) string

func GetPipIndexURL

func GetPipIndexURL() string

func GetPipTrustedHost

func GetPipTrustedHost() string

func GetPodLogs

func GetPodLogs(t Test, pod *corev1.Pod, options corev1.PodLogOptions) []byte

func GetPods

func GetPods(t Test, namespace string, options metav1.ListOptions) []corev1.Pod

func GetPyTorchImage

func GetPyTorchImage() string

func GetRayCluster

func GetRayCluster(t Test, namespace, name string) *rayv1.RayCluster

func GetRayClusters

func GetRayClusters(t Test, namespace string) []*rayv1.RayCluster

func GetRayImage

func GetRayImage() string

func GetRayJob

func GetRayJob(t Test, namespace, name string) *rayv1.RayJob

func GetRayJobAPIDetailsStatus

func GetRayJobAPIDetailsStatus(jobDetails *RayJobDetailsResponse) string

func GetRayJobId

func GetRayJobId(t Test, namespace, name string) string

func GetRayVersion

func GetRayVersion() string

func GetRoute

func GetRoute(t Test, namespace, name string) *routev1.Route

func Ingress

func Ingress(t Test, namespace, name string) func(g gomega.Gomega) *networkingv1.Ingress

func IsOpenShift

func IsOpenShift(test Test) bool

func Job

func Job(t Test, namespace, name string) func(g gomega.Gomega) *batchv1.Job

func KueueWorkloadAdmitted

func KueueWorkloadAdmitted(workload *kueuev1beta1.Workload) bool

func MachinePoolId

func MachinePoolId(machinePool *cmv1.MachinePool) string

func MachinePoolLabels

func MachinePoolLabels(machinePool *cmv1.MachinePool) map[string]string

func MachinePools

func MachinePools(t Test, connection *ocmsdk.Connection) func(g gomega.Gomega) []*cmv1.MachinePool

func MachineSet

func MachineSet(t Test, namespace string, machineSetName string) func(g gomega.Gomega) *machinev1beta1.MachineSet

func MachineSetId

func MachineSetId(machineSet machinev1beta1.MachineSet) string

func MachineSetReplicas

func MachineSetReplicas(machineSet *machinev1beta1.MachineSet) *int32

func Machines

func Machines(t Test, machineSetName string) func(g gomega.Gomega) []machinev1beta1.Machine

func NodePoolLabels

func NodePoolLabels(nodePool *cmv1.NodePool) map[string]string

func NodePools

func NodePools(t Test, connection *ocmsdk.Connection) func(g gomega.Gomega) []*cmv1.NodePool

func Ptr

func Ptr[T any](v T) *T

func Raw

func RayCluster

func RayCluster(t Test, namespace, name string) func(g gomega.Gomega) *rayv1.RayCluster

func RayClusterState

func RayClusterState(cluster *rayv1.RayCluster) rayv1.ClusterState

func RayClusters

func RayClusters(t Test, namespace string) func(g gomega.Gomega) []*rayv1.RayCluster

func RayJob

func RayJob(t Test, namespace, name string) func(g gomega.Gomega) *rayv1.RayJob

func RayJobAPIDetails

func RayJobAPIDetails(t Test, rayClient RayClusterClient, jobID string) func(g gomega.Gomega) *RayJobDetailsResponse

func RayJobId

func RayJobId(job *rayv1.RayJob) string

func RayJobStatus

func RayJobStatus(job *rayv1.RayJob) rayv1.JobStatus

func Route

func Route(t Test, namespace, name string) func(g gomega.Gomega) *routev1.Route

func StoreNamespaceLogs

func StoreNamespaceLogs(t Test, namespace *corev1.Namespace)

func WriteRayJobAPILogs

func WriteRayJobAPILogs(t Test, rayClient RayClusterClient, jobID string)

func WriteRayJobLogs

func WriteRayJobLogs(t Test, rayClient RayClusterClient, namespace, name string)

func WriteToOutputDir

func WriteToOutputDir(t Test, fileName string, fileType OutputType, data []byte)

Types

type Client

type Client interface {
	Core() kubernetes.Interface
	Kubeflow() kubeflowclient.Interface
	Kueue() kueueclient.Interface
	Machine() machinev1.Interface
	Route() routev1.Interface
	Image() imagev1.Interface
	Ray() rayclient.Interface
	Dynamic() dynamic.Interface
}

type ClusterType

type ClusterType string
const (
	OsdCluster        ClusterType = "OSD"
	OcpCluster        ClusterType = "OCP"
	HypershiftCluster ClusterType = "HYPERSHIFT"
	KindCluster       ClusterType = "KIND"
	UndefinedCluster  ClusterType = "UNDEFINED"
)

func GetClusterType

func GetClusterType(t Test) ClusterType

type Option

type Option[T any] interface {
	// contains filtered or unexported methods
}

type OutputType

type OutputType string
const (
	Log OutputType = "log"
)

type RayClusterClient

type RayClusterClient interface {
	CreateJob(job *RayJobSetup) (*RayJobResponse, error)
	GetJobDetails(jobID string) (*RayJobDetailsResponse, error)
	GetJobLogs(jobID string) (string, error)
}

func NewRayClusterClient

func NewRayClusterClient(dashboardEndpoint url.URL) RayClusterClient

type RayJobDetailsResponse

type RayJobDetailsResponse struct {
	JobID        string `json:"job_id"`
	SubmissionID string `json:"submission_id"`
	Status       string `json:"status"`
}

func GetRayJobAPIDetails

func GetRayJobAPIDetails(t Test, rayClient RayClusterClient, jobID string) *RayJobDetailsResponse

type RayJobLogsResponse

type RayJobLogsResponse struct {
	Logs string `json:"logs"`
}

type RayJobResponse

type RayJobResponse struct {
	JobID        string `json:"job_id"`
	SubmissionID string `json:"submission_id"`
}

type RayJobSetup

type RayJobSetup struct {
	EntryPoint string         `json:"entrypoint"`
	RuntimeEnv map[string]any `json:"runtime_env"`
}

type T

type T struct {
	*gomega.WithT
	// contains filtered or unexported fields
}

func NewTest

func NewTest(t *testing.T) *T

func (*T) Client

func (t *T) Client() Client

func (*T) Ctx

func (t *T) Ctx() context.Context

func (*T) NewTestNamespace

func (t *T) NewTestNamespace(options ...Option[*corev1.Namespace]) *corev1.Namespace

func (*T) OutputDir

func (t *T) OutputDir() string

func (*T) T

func (t *T) T() *testing.T

type Test

type Test interface {
	T() *testing.T
	Ctx() context.Context
	Client() Client
	OutputDir() string

	gomega.Gomega

	NewTestNamespace(...Option[*corev1.Namespace]) *corev1.Namespace
}

func With

func With(t *testing.T) Test

func WithConfig

func WithConfig(t *testing.T, cfg *rest.Config) Test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL