controller

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const DECODE_ROLE = "decode"
View Source
const ENV_HF_HOME = "HF_HOME"
View Source
const ENV_HF_TOKEN = "HF_TOKEN"
View Source
const HF_PREFIX string = "hf://"
View Source
const MODEL_ARTIFACT_URI_HF = "hf"
View Source
const MODEL_ARTIFACT_URI_HF_PREFIX = MODEL_ARTIFACT_URI_HF + "://"
View Source
const MODEL_ARTIFACT_URI_OCI = "oci"
View Source
const MODEL_ARTIFACT_URI_OCI_PREFIX = MODEL_ARTIFACT_URI_OCI + "://"
View Source
const MODEL_ARTIFACT_URI_PVC = "pvc"
View Source
const MODEL_ARTIFACT_URI_PVC_PREFIX = MODEL_ARTIFACT_URI_PVC + "://"
View Source
const PREFILL_ROLE = "prefill"
View Source
const PVC_PREFIX string = "pvc://"

Variables

This section is empty.

Functions

func AcceleratorTypesToNodeAffinity

func AcceleratorTypesToNodeAffinity(a *v1alpha1.AcceleratorTypes) (*corev1.NodeAffinity, error)

ToNodeAffinity generates a NodeAffinity rule that requires nodes to match the specified accelerator label key and one of the allowed values.

Returns an error if LabelKey is empty or LabelValues is empty.

func InterpolateBaseConfigMap

func InterpolateBaseConfigMap(ctx context.Context, cm *corev1.ConfigMap, msvc *msv1alpha1.ModelService) (*corev1.ConfigMap, error)

InterpolateBaseConfigMap data strings using msvc template variable values

func InterpolateModelService

func InterpolateModelService(ctx context.Context, msvc *msv1alpha1.ModelService) (*msv1alpha1.ModelService, error)

InterpolateModelService interpolates strings using msvc template variable values

func MergeBackendRefSlices added in v0.0.14

func MergeBackendRefSlices(dest, src []gatewayv1.BackendRef) ([]gatewayv1.BackendRef, error)

MergeBackendRefSlices merges src slice containing gatewayv1.ParentRefs into dest in place

func MergeContainerSlices

func MergeContainerSlices(dest, src []corev1.Container) ([]corev1.Container, error)

MergeContainerSlices merges src slice into dest in place

func MergeGatewayRefSlices added in v0.0.14

func MergeGatewayRefSlices(dest, src []gatewayv1.ParentReference) ([]gatewayv1.ParentReference, error)

MergeGatewayRefSlices merges src slice containing gatewayv1.ParentRefs into dest in place

Types

type BaseConfig

type BaseConfig struct {
	ConfigMaps        []corev1.ConfigMap          `json:"configMaps,omitempty"`
	PrefillDeployment *appsv1.Deployment          `json:"prefillDeployment,omitempty"`
	DecodeDeployment  *appsv1.Deployment          `json:"decodeDeployment,omitempty"`
	PrefillService    *corev1.Service             `json:"prefillService,omitempty"`
	DecodeService     *corev1.Service             `json:"decodeService,omitempty"`
	HTTPRoute         *gatewayv1.HTTPRoute        `json:"httpRoute,omitempty"`
	InferencePool     *giev1alpha2.InferencePool  `json:"inferencePool,omitempty"`
	InferenceModel    *giev1alpha2.InferenceModel `json:"inferenceModel,omitempty"`
	EPPDeployment     *appsv1.Deployment          `json:"eppDeployment,omitempty"`
	EPPService        *corev1.Service             `json:"eppService,omitempty"`
	EPPServiceAccount *corev1.ServiceAccount      `json:"eppServiceAccount,omitempty"`
	PDServiceAccount  *corev1.ServiceAccount      `json:"pdServiceAccount,omitempty"`
	EPPRoleBinding    *rbacv1.RoleBinding         `json:"eppRoleBinding,omitempty"`
}

BaseConfig holds information read from the base configmap

func BaseConfigFromCM

func BaseConfigFromCM(cm *corev1.ConfigMap) (*BaseConfig, error)

BaseConfigFromCM returns a BaseConfig object if the input configmap is a valid serialization

func (*BaseConfig) MergeChildResources

func (interpolatedBaseConfig *BaseConfig) MergeChildResources(ctx context.Context, modelService *msv1alpha1.ModelService, scheme *runtime.Scheme, rbacOptions *RBACOptions) *BaseConfig

MergeChildResources merges the MSVC resources into BaseConfig resources merging means MSVC controller is overwriting some fields, such as Name and Namespace for that resource

type ModelServiceReconciler

type ModelServiceReconciler struct {
	RBACOptions RBACOptions
	client.Client
	Scheme *runtime.Scheme
}

ModelServiceReconciler reconciles a ModelService object

func (*ModelServiceReconciler) Reconcile

func (r *ModelServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.4/pkg/reconcile

func (*ModelServiceReconciler) SetupWithManager

func (r *ModelServiceReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type RBACOptions

type RBACOptions struct {
	// EPPPullSecrets contains names of epp pull secrets
	// the secrets objects are assumed to be in the controller namespace
	// these are pull secrets used by epp deployment created by the controller
	EPPPullSecrets []string
	// PDPullSecrets contains names of pd pull secrets;
	// the secrets objects are assumed to be in the controller namespace
	// these are pull secrets used by pd deployment created by the controller
	PDPullSecrets []string
	// EPPClusterRole name of the epp cluster role
	// this is a cluster role used in the rolebinding for the epp deployment
	EPPClusterRole string
}

RBACOptions provides the options need to create service accounts and role binding during reconcile

type TemplateFuncs

type TemplateFuncs struct {
	// contains filtered or unexported fields
}

type TemplateVars

type TemplateVars struct {
	ModelServiceName      string `json:"modelServiceName,omitempty"`
	ModelServiceNamespace string `json:"modelServiceNamespace,omitempty"`
	ModelName             string `json:"modelName,omitempty"`
	HFModelName           string `json:"hfModelName,omitempty"`
	SanitizedModelName    string `json:"sanitizedModelName,omitempty"`
	ModelPath             string `json:"modelPath,omitempty"`
	MountedModelPath      string `json:"mountedModelPath,omitempty"`
	AuthSecretName        string `json:"authSecretName,omitempty"`
	EPPServiceName        string `json:"eppServiceName,omitempty"`
	EPPDeploymentName     string `json:"eppDeploymentName,omitempty"`
	PrefillDeploymentName string `json:"prefillDeploymentName,omitempty"`
	DecodeDeploymentName  string `json:"decodeDeploymentName,omitempty"`
	PrefillServiceName    string `json:"prefillServiceName,omitempty"`
	DecodeServiceName     string `json:"decodeServiceName,omitempty"`
	InferencePoolName     string `json:"inferencePoolName,omitempty"`
	InferenceModelName    string `json:"inferenceModelName,omitempty"`
}

Context is intended to be use for interpolating template variables in BaseConfig

type URIType added in v0.0.14

type URIType string
const (
	PVC        URIType = "pvc"
	HF         URIType = "hf"
	OCI        URIType = "oci"
	UnknownURI URIType = "unknown"
)

func UriType added in v0.0.14

func UriType(uri string) URIType

UriType returns the type of URI

Jump to

Keyboard shortcuts

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