utils

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InferenceModeCustomTemplate kaitov1alpha1.ModelImageAccessMode = "customTemplate"
	ExampleDatasetURL                                              = "" /* 140-byte string literal not displayed */
)
View Source
const (
	E2eNamespace = "kaito-e2e"
)

Variables

View Source
var (
	// PollInterval defines the interval time for a poll operation.
	PollInterval = 2 * time.Second
	// PollTimeout defines the time after which the poll operation times out.
	PollTimeout = 120 * time.Second
)
View Source
var (
	TestingCluster = NewCluster(scheme)
)

Functions

func CopySecret added in v0.3.0

func CopySecret(original *corev1.Secret, targetNamespace string) *corev1.Secret

func ExtractModelVersion added in v0.2.0

func ExtractModelVersion(configs map[string]interface{}) (map[string]string, error)

func GenerateE2ETuningConfigMapManifest added in v0.3.0

func GenerateE2ETuningConfigMapManifest(namespace string) *corev1.ConfigMap

GenerateE2ETuningConfigMapManifest generates a ConfigMap manifest for E2E tuning.

func GenerateE2ETuningWorkspaceManifest added in v0.3.0

func GenerateE2ETuningWorkspaceManifest(name, namespace, imageName, datasetImageName, outputRegistry string,
	resourceCount int, instanceType string, labelSelector *metav1.LabelSelector,
	preferredNodes []string, presetName kaitov1alpha1.ModelName, accessMode kaitov1alpha1.ModelImageAccessMode,
	imagePullSecret []string, customConfigMapName string) *kaitov1alpha1.Workspace

func GenerateInferenceWorkspaceManifest added in v0.3.0

func GenerateInferenceWorkspaceManifest(name, namespace, imageName string, resourceCount int, instanceType string,
	labelSelector *metav1.LabelSelector, preferredNodes []string, presetName kaitov1alpha1.ModelName,
	accessMode kaitov1alpha1.ModelImageAccessMode, imagePullSecret []string,
	podTemplate *corev1.PodTemplateSpec, adapters []kaitov1alpha1.AdapterSpec) *kaitov1alpha1.Workspace

func GeneratePodTemplate

func GeneratePodTemplate(name, namespace, image string, labels map[string]string) *corev1.PodTemplateSpec

func GenerateRandomString added in v0.3.0

func GenerateRandomString() string

GenerateRandomString generates a random number between 0 and 1000 and returns it as a string.

func GenerateTuningWorkspaceManifest added in v0.3.0

func GenerateTuningWorkspaceManifest(name, namespace, imageName string, resourceCount int, instanceType string,
	labelSelector *metav1.LabelSelector, preferredNodes []string, input *kaitov1alpha1.DataSource,
	output *kaitov1alpha1.DataDestination, preset *kaitov1alpha1.PresetSpec, method kaitov1alpha1.TuningMethod) *kaitov1alpha1.Workspace

func GetAllValidNodeClaims added in v0.3.1

func GetAllValidNodeClaims(ctx context.Context, workspaceObj *v1alpha1.Workspace) (*v1beta1.NodeClaimList, error)

GetAllValidNodeClaims get all valid nodeClaims.

func GetClusterClient added in v0.3.1

func GetClusterClient(cluster *Cluster)

GetClusterClient returns a Cluster client for the cluster.

func GetEnv

func GetEnv(envVar string) string

func GetK8sConfig added in v0.3.0

func GetK8sConfig() (*kubernetes.Clientset, error)

func GetModelConfigInfo added in v0.2.0

func GetModelConfigInfo(configFilePath string) (map[string]interface{}, error)

func GetPodLogs added in v0.3.0

func GetPodLogs(coreClient *kubernetes.Clientset, namespace, podName, containerName string) (string, error)

func GetPodNameForDeployment added in v0.3.1

func GetPodNameForDeployment(coreClient *kubernetes.Clientset, namespace, deploymentName string) (string, error)

func GetPodNameForJob added in v0.3.0

func GetPodNameForJob(coreClient *kubernetes.Clientset, namespace, jobName string) (string, error)

func PrintPodLogsOnFailure added in v0.3.1

func PrintPodLogsOnFailure(namespace, labelSelector string)

func ValidateMachineCreation added in v0.3.1

func ValidateMachineCreation(ctx context.Context, workspaceObj *v1alpha1.Workspace, expectedCount int)

ValidateMachineCreation Logic to validate machine creation

func ValidateNodeClaimCreation added in v0.3.1

func ValidateNodeClaimCreation(ctx context.Context, workspaceObj *v1alpha1.Workspace, expectedCount int)

ValidateNodeClaimCreation Logic to validate the nodeClaim creation.

Types

type Cluster added in v0.3.1

type Cluster struct {
	Scheme        *runtime.Scheme
	KubeClient    client.Client
	DynamicClient dynamic.Interface
}

Cluster object defines the required clients of the test cluster.

func NewCluster added in v0.3.1

func NewCluster(scheme *runtime.Scheme) *Cluster

Jump to

Keyboard shortcuts

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