utils

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AzureBlobURL      = "blob.core.windows.net"
	AzureBlobURIRegEx = "https://(.+?).blob.core.windows.net/(.+)"
)

Variables

View Source
var (
	SupportedStorageURIPrefixList = []string{"gs://", "s3://", "pvc://", "file://", "https://", "http://", "hdfs://", "webhdfs://", "oci://"}
)

Constants

Functions

func GetDeploymentMode

func GetDeploymentMode(annotations map[string]string, deployConfig *v1beta1api.DeployConfig) constants.DeploymentModeType

GetDeploymentMode returns the current deployment mode, supports Serverless and RawDeployment case 1: no serving.kserve.org/deploymentMode annotation

return config.deploy.defaultDeploymentMode

case 2: serving.kserve.org/deploymentMode is set

        if the mode is "RawDeployment", "Serverless" or "ModelMesh", return it.
		else return config.deploy.defaultDeploymentMode

func GetModelName added in v0.10.0

func GetModelName(isvc *v1beta1api.InferenceService) string

GetModelName returns the model name for single model serving case

func GetPredictorEndpoint added in v0.11.0

func GetPredictorEndpoint(isvc *v1beta1.InferenceService) (string, error)

GetPredictorEndpoint returns the predictor endpoint if status.address.url is not nil else returns empty string with error.

func GetServingRuntime added in v0.8.0

func GetServingRuntime(cl client.Client, name string, namespace string) (*v1alpha1.ServingRuntimeSpec, error)

GetServingRuntime Get a ServingRuntime by name. First, ServingRuntimes in the given namespace will be checked. If a resource of the specified name is not found, then ClusterServingRuntimes will be checked.

func IsMMSPredictor

func IsMMSPredictor(predictor *v1beta1api.PredictorSpec) bool

IsMMSPredictor Only enable MMS predictor when predictor config sets MMS to true and neither storage uri nor storage spec is set

func IsMemoryResourceAvailable

func IsMemoryResourceAvailable(isvc *v1beta1api.InferenceService, totalReqMemory resource.Quantity) bool

func ListPodsByLabel added in v0.9.0

func ListPodsByLabel(cl client.Client, namespace string, labelKey string, labelVal string) (*v1.PodList, error)

ListPodsByLabel Get a PodList by label.

func MergePodSpec added in v0.8.0

func MergePodSpec(runtimePodSpec *v1alpha1.ServingRuntimePodSpec, predictorPodSpec *v1beta1.PodSpec) (*v1.PodSpec, error)

MergePodSpec Merge the predictor PodSpec struct with the runtime PodSpec struct, allowing users to override runtime PodSpec settings from the predictor spec.

func MergeRuntimeContainers added in v0.8.0

func MergeRuntimeContainers(runtimeContainer *v1.Container, predictorContainer *v1.Container) (*v1.Container, error)

MergeRuntimeContainers Merge the predictor Container struct with the runtime Container struct, allowing users to override runtime container settings from the predictor spec.

func ReplacePlaceholders added in v0.8.0

func ReplacePlaceholders(container *v1.Container, meta metav1.ObjectMeta) error

ReplacePlaceholders Replace placeholders in runtime container by values from inferenceservice metadata

func UpdateImageTag added in v0.8.0

func UpdateImageTag(container *v1.Container, runtimeVersion *string, servingRuntime *string)

UpdateImageTag Update image tag if GPU is enabled or runtime version is provided

func ValidateStorageURI added in v0.11.1

func ValidateStorageURI(storageURI *string, client client.Client) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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