config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0 Imports: 18 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.

Index

Constants

View Source
const (
	EnvEtcdSecretName     = "ETCD_SECRET_NAME"
	DefaultEtcdSecretName = "model-serving-etcd"

	ConfigType    = "yaml"
	MountLocation = "/etc/model-serving/config-defaults.yaml"
)

Variables

This section is empty.

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 SetConfigForTest

func SetConfigForTest(cp *ConfigProvider, cfg *Config)

SetConfigForTest is only for tests

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

	// For internal use only
	InternalModelMeshEnvVars EnvVarList
}

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
}

ConfigProvider provides immutable snapshots of current config

func NewConfigProvider

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

func NewConfigProviderForTest

func NewConfigProviderForTest() *ConfigProvider

NewConfigProviderForTest is only for tests

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 EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type EnvVarList

type EnvVarList []EnvVar

func (EnvVarList) ToKubernetesType

func (evl EnvVarList) ToKubernetesType() []corev1.EnvVar

type ImageConfig

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

func (ImageConfig) TaggedImage

func (m ImageConfig) TaggedImage() string

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 TLSConfig

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

Jump to

Keyboard shortcuts

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