controllers

package
v0.7.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Overview

Copyright 2021 IBM Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	EnvEtcdSecretName     = "ETCD_SECRET_NAME"
	DefaultEtcdSecretName = "model-serving-etcd"
)
View Source
const (
	// The amount of time failed requests are queued before reattempting
	DefaultRequeueTime = 5 * time.Second

	ConfigType    = "yaml"
	MountLocation = "/etc/model-serving/config-defaults.yaml"
)
View Source
const (
	PredictorCRSourceId    = "ksp"
	TrainedModelCRSourceId = "kstm"
)
View Source
const (
	GrpcRequestTimeout     = 10 * time.Second
	K8sStatusUpdateTimeout = 10 * time.Second
)

Variables

View Source
var RequeueResult = ctrl.Result{RequeueAfter: DefaultRequeueTime}

Functions

func ConfigWatchHandler

func ConfigWatchHandler(configMapName types.NamespacedName, f func() []reconcile.Request,
	cp *ConfigProvider, kclient *client.Client) handler.EventHandler

Handler used by controllers which depend on the user configuration

func Hash

func Hash(predictorSpec *api.PredictorSpec) string

Hash returns a 10-character hash string of the spec

func PrefixName

func PrefixName(prefix string) handler.EventHandler

Types

type Config

type Config struct {
	// System config
	EtcdSecretName    string // DEPRECATED - should be removed in the future
	ModelMeshEndpoint string // For dev use only

	// Service config
	InferenceServiceName    string
	InferenceServicePort    uint16
	TLS                     TLSConfig
	HeadlessService         bool
	GrpcMaxMessageSizeBytes int

	// Runtimes config
	ModelMeshImage         ImageConfig
	ModelMeshResources     ResourceRequirements
	RESTProxy              RESTProxyConfig
	StorageHelperImage     ImageConfig
	StorageHelperResources ResourceRequirements
	PodsPerRuntime         uint16
	StorageSecretName      string
	EnableAccessLogging    bool

	ServiceAccountName string

	Metrics     PrometheusConfig
	ScaleToZero ScaleToZeroConfig
}

Type Config holds process global configuration information

func NewMergedConfigFromConfigMap

func NewMergedConfigFromConfigMap(m corev1.ConfigMap) (*Config, error)

func NewMergedConfigFromString

func NewMergedConfigFromString(configYaml string) (*Config, error)

func (*Config) GetEtcdSecretName

func (c *Config) GetEtcdSecretName() string

type ConfigProvider

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

Type Config holds process global configuration information

func NewConfigProvider

func NewConfigProvider(ctx context.Context, cl client.Client, name types.NamespacedName) (*ConfigProvider, error)

func (*ConfigProvider) AwaitReload

func (cp *ConfigProvider) AwaitReload()

func (*ConfigProvider) GetConfig

func (cp *ConfigProvider) GetConfig() *Config

func (*ConfigProvider) IsReloading

func (cp *ConfigProvider) IsReloading() bool

func (*ConfigProvider) ReloadConfigMap

func (cp *ConfigProvider) ReloadConfigMap(ctx context.Context, c client.Client, name types.NamespacedName) error

type ImageConfig

type ImageConfig struct {
	Name    string
	Tag     string
	Digest  string
	Command []string
}

func (ImageConfig) TaggedImage

func (m ImageConfig) TaggedImage() string

type ModelKeyInfo

type ModelKeyInfo struct {
	StorageKey *string        `json:"storage_key,omitempty"`
	Bucket     *string        `json:"bucket,omitempty"`
	ModelType  *api.ModelType `json:"model_type,omitempty"`
	SchemaPath *string        `json:"schema_path,omitempty"`
}

passed in ModelInfo.Key field of registration requests

type PredictorReconciler

type PredictorReconciler struct {
	client.Client
	Log       logr.Logger
	MMService *mmesh.MMService

	RegistryLookup map[string]api.PredictorRegistry
}

PredictorReconciler reconciles Predictors

func (*PredictorReconciler) Reconcile

func (pr *PredictorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*PredictorReconciler) ReconcilePredictor

func (pr *PredictorReconciler) ReconcilePredictor(ctx context.Context, nname types.NamespacedName,
	sourceId string, registry api.PredictorRegistry) (ctrl.Result, error)

func (*PredictorReconciler) SetupWithManager

func (pr *PredictorReconciler) SetupWithManager(mgr ctrl.Manager, eventStream *mmesh.ModelMeshEventStream,
	watchTrainedModels bool) error

type PrometheusConfig

type PrometheusConfig struct {
	Enabled                          bool
	Port                             uint16
	Scheme                           string
	DisablePrometheusOperatorSupport bool
}

type RESTProxyConfig

type RESTProxyConfig struct {
	Enabled   bool
	Port      uint16
	Image     ImageConfig
	Resources ResourceRequirements
}

type ResourceQuantities

type ResourceQuantities struct {
	CPU    string
	Memory string
}

type ResourceRequirements

type ResourceRequirements struct {
	Requests ResourceQuantities
	Limits   ResourceQuantities
	// contains filtered or unexported fields
}

func (ResourceRequirements) ToKubernetesType

func (rr ResourceRequirements) ToKubernetesType() *corev1.ResourceRequirements

type ScaleToZeroConfig

type ScaleToZeroConfig struct {
	Enabled bool
	// how long to wait after the last predictor assigned to a runtime is deleted
	// before scaling to zero
	GracePeriodSeconds uint16
}

type ServiceReconciler

type ServiceReconciler struct {
	client.Client
	Log                  logr.Logger
	Scheme               *runtime.Scheme
	ConfigProvider       *ConfigProvider
	ConfigMapName        types.NamespacedName
	ControllerDeployment types.NamespacedName

	ModelMeshService *mmesh.MMService
	ModelEventStream *mmesh.ModelMeshEventStream

	ServiceMonitorCRDExists bool
}

ServiceReconciler reconciles a ServingRuntime object

func (*ServiceReconciler) Reconcile

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

func (*ServiceReconciler) ReconcileServiceMonitor

func (r *ServiceReconciler) ReconcileServiceMonitor(ctx context.Context, metrics PrometheusConfig, owner metav1.Object) (error, bool)

func (*ServiceReconciler) SetupWithManager

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

type ServingRuntimeReconciler

type ServingRuntimeReconciler struct {
	client.Client
	Log                 logr.Logger
	Scheme              *runtime.Scheme
	ConfigProvider      *ConfigProvider
	ConfigMapName       types.NamespacedName
	DeploymentName      string
	DeploymentNamespace string

	EnableTrainedModelWatch bool
	// contains filtered or unexported fields
}

ServingRuntimeReconciler reconciles a ServingRuntime object

func (*ServingRuntimeReconciler) Reconcile

func (*ServingRuntimeReconciler) SetupWithManager

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

type TLSConfig

type TLSConfig struct {
	// TLS disabled if omitted
	SecretName string
	// Mutual TLS disabled if omitted
	ClientAuth string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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