model

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ImageStorePVCName         = "ollama-models-store-pvc"
	ImageStoreStatefulSetName = "ollama-models-store"
)
View Source
const (
	OllamaBaseImage = "ollama/ollama"
)

Variables

This section is empty.

Functions

func EnsureDeploymentCreated

func EnsureDeploymentCreated(
	ctx context.Context,
	c client.Client,
	namespace string,
	name string,
	image string,
	replicas *int32,
	model *ollamav1.Model,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (*appsv1.Deployment, error)

func EnsureImageStorePVCCreated

func EnsureImageStorePVCCreated(
	ctx context.Context,
	client client.Client,
	namespace string,
	storageClassName *string,
	pvcSource *corev1.PersistentVolumeClaimVolumeSource,
	pvSpec *ollamav1.ModelPersistentVolumeSpec,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (*corev1.PersistentVolumeClaim, error)

func EnsureImageStoreServiceCreated

func EnsureImageStoreServiceCreated(
	ctx context.Context,
	client client.Client,
	namespace string,
	statefulSet *appsv1.StatefulSet,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (*corev1.Service, error)

func EnsureImageStoreStatefulSetCreated

func EnsureImageStoreStatefulSetCreated(
	ctx context.Context,
	client client.Client,
	namespace string,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (*appsv1.StatefulSet, error)

func EnsureServiceCreated

func EnsureServiceCreated(
	ctx context.Context,
	c client.Client,
	namespace string,
	name string,
	deployment *appsv1.Deployment,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (*corev1.Service, error)

func ImageStoreLabels added in v0.5.2

func ImageStoreLabels() map[string]string

func IsAvailable added in v0.2.0

func IsAvailable(ctx context.Context, ollamaModelResource ollamav1.Model) bool

func IsDeploymentReady

func IsDeploymentReady(
	ctx context.Context,
	c client.Client,
	namespace string,
	name string,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (bool, error)

func IsImageStoreServiceReady

func IsImageStoreServiceReady(
	ctx context.Context,
	client client.Client,
	namespace string,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (bool, error)

func IsImageStoreStatefulSetReady

func IsImageStoreStatefulSetReady(
	ctx context.Context,
	client client.Client,
	namespace string,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (bool, error)

func IsProgressing added in v0.2.0

func IsProgressing(ctx context.Context, ollamaModelResource ollamav1.Model) bool

func IsServiceReady

func IsServiceReady(
	ctx context.Context,
	c client.Client,
	namespace string,
	name string,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (bool, error)

func ModelAnnotations added in v0.5.0

func ModelAnnotations(name string, imageStore bool) map[string]string

func ModelAppName

func ModelAppName(name string) string

func ModelLabels added in v0.5.0

func ModelLabels(name string) map[string]string

func NewOllamaPullerContainer

func NewOllamaPullerContainer(image string, serverLocatedNamespace string, resources corev1.ResourceRequirements) corev1.Container

func NewOllamaServerContainer

func NewOllamaServerContainer(readOnly bool, resources corev1.ResourceRequirements) corev1.Container

func NewServiceForModel added in v0.4.0

func NewServiceForModel(namespace, name string, deployment *appsv1.Deployment, serviceType corev1.ServiceType) *corev1.Service

func SetAvailable added in v0.2.0

func SetAvailable(
	ctx context.Context,
	c client.Client,
	ollamaModelResource ollamav1.Model,
) (bool, error)

func SetProgressing added in v0.2.0

func SetProgressing(
	ctx context.Context,
	c client.Client,
	ollamaModelResource ollamav1.Model,
) (bool, error)

func SetReplicas added in v0.2.0

func SetReplicas(
	ctx context.Context,
	c client.Client,
	ollamaModelResource ollamav1.Model,
	replicas int32,
	readyReplicas int32,
	availableReplicas int32,
	unavailableReplicas int32,
) (bool, error)

func ShouldSetReplicas added in v0.2.0

func ShouldSetReplicas(
	ctx context.Context,
	ollamaModelResource ollamav1.Model,
	replicas int32,
	readyReplicas int32,
	availableReplicas int32,
	unavailableReplicas int32,
) bool

func UpdateDeployment

func UpdateDeployment(
	ctx context.Context,
	c client.Client,
	model *ollamav1.Model,
	modelRecorder *WrappedRecorder[*ollamav1.Model],
) (bool, error)

Types

type WrappedRecorder

type WrappedRecorder[T runtime.Object] struct {
	// contains filtered or unexported fields
}

func NewWrappedRecorder

func NewWrappedRecorder[T runtime.Object](recorder record.EventRecorder, object T) *WrappedRecorder[T]

func (*WrappedRecorder[T]) AnnotatedEventf

func (r *WrappedRecorder[T]) AnnotatedEventf(annotations map[string]string, eventType, reason, messageFmt string, args ...any)

AnnotatedEventf is just like eventf, but with annotations attached

func (*WrappedRecorder[T]) Event

func (r *WrappedRecorder[T]) Event(eventType, reason, message string)

func (*WrappedRecorder[T]) Eventf

func (r *WrappedRecorder[T]) Eventf(eventType, reason, messageFmt string, args ...any)

Eventf is just like Event, but with Sprintf for the message field.

Jump to

Keyboard shortcuts

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